Package Elf :: Module elf_lookup
[hide private]
[frames] | no frames]

Source Code for Module Elf.elf_lookup

  1  ## EM enumeration definitions 
  2  EM_NONE = 0 
  3  EM_M32 = 1 
  4  EM_SPARC = 2 
  5  EM_386 = 3 
  6  EM_68K = 4 
  7  EM_88K = 5 
  8  EM_860 = 7 
  9  EM_MIPS = 8 
 10  EM_S370 = 9 
 11  EM_MIPS_RS3_LE = 10 
 12  EM_PARISC = 15 
 13  EM_VPP500 = 17 
 14  EM_SPARC32PLUS = 18 
 15  EM_960 = 19 
 16  EM_PPC = 20 
 17  EM_PPC64 = 21 
 18  EM_S390 = 22 
 19  EM_V800 = 36 
 20  EM_FR20 = 37 
 21  EM_RH32 = 38 
 22  EM_RCE = 39 
 23  EM_ARM = 40 
 24  EM_FAKE_ALPHA = 41 
 25  EM_SH = 42 
 26  EM_SPARCV9 = 43 
 27  EM_TRICORE = 44 
 28  EM_ARC = 45 
 29  EM_H8_300 = 46 
 30  EM_H8_300H = 47 
 31  EM_H8S = 48 
 32  EM_H8_500 = 49 
 33  EM_IA_64 = 50 
 34  EM_MIPS_X = 51 
 35  EM_COLDFIRE = 52 
 36  EM_68HC12 = 53 
 37  EM_MMA = 54 
 38  EM_PCP = 55 
 39  EM_NCPU = 56 
 40  EM_NDR1 = 57 
 41  EM_STARCORE = 58 
 42  EM_ME16 = 59 
 43  EM_ST100 = 60 
 44  EM_TINYJ = 61 
 45  EM_X86_64 = 62 
 46  EM_PDSP = 63 
 47  EM_FX66 = 66 
 48  EM_ST9PLUS = 67 
 49  EM_ST7 = 68 
 50  EM_68HC16 = 69 
 51  EM_68HC11 = 70 
 52  EM_68HC08 = 71 
 53  EM_68HC05 = 72 
 54  EM_SVX = 73 
 55  EM_ST19 = 74 
 56  EM_VAX = 75 
 57  EM_CRIS = 76 
 58  EM_JAVELIN = 77 
 59  EM_FIREPATH = 78 
 60  EM_ZSP = 79 
 61  EM_MMIX = 80 
 62  EM_HUANY = 81 
 63  EM_PRISM = 82 
 64  EM_AVR = 83 
 65  EM_FR30 = 84 
 66  EM_D10V = 85 
 67  EM_D30V = 86 
 68  EM_V850 = 87 
 69  EM_M32R = 88 
 70  EM_MN10300 = 89 
 71  EM_MN10200 = 90 
 72  EM_PJ = 91 
 73  EM_OPENRISC = 92 
 74  EM_ARC_A5 = 93 
 75  EM_XTENSA = 94 
 76  EM_NUM = 95 
 77  EM_ALPHA = 0x9026 
 78   
 79  # There are plenty more of these to 
 80  # fill in, but...  this is all I need 
 81  # for now... 
 82  e_machine_32 =  ( 
 83                  EM_386, 
 84                  EM_PPC, 
 85                  EM_ARM, 
 86                  ) 
 87  e_machine_64 =  ( 
 88                  EM_PPC64, 
 89                  EM_SPARCV9, 
 90                  EM_X86_64 
 91                  ) 
 92   
 93  e_machine_types = { 
 94  EM_NONE:"No machine", 
 95  EM_M32:"AT&T WE 32100", 
 96  EM_SPARC:"SUN SPARC", 
 97  EM_386:"Intel 80386", 
 98  EM_68K:"Motorola m68k family", 
 99  EM_88K:"Motorola m88k family", 
100  EM_860:"Intel 80860", 
101  EM_MIPS:"MIPS R3000 big-endian", 
102  EM_S370:"IBM System/370", 
103  EM_MIPS_RS3_LE:"MIPS R3000 little-endian", 
104  EM_PARISC:"HPPA", 
105  EM_VPP500:"Fujitsu VPP500", 
106  EM_SPARC32PLUS:"Suns v8plus", 
107  EM_960:"Intel 80960", 
108  EM_PPC:"PowerPC", 
109  EM_PPC64:"PowerPC 64-bit", 
110  EM_S390:"IBM S390", 
111  EM_V800:"NEC V800 series", 
112  EM_FR20:"Fujitsu FR20", 
113  EM_RH32:"TRW RH-32", 
114  EM_RCE:"Motorola RCE", 
115  EM_ARM:"ARM", 
116  EM_FAKE_ALPHA:"Digital Alpha", 
117  EM_SH:"Hitachi SH", 
118  EM_SPARCV9:"SPARC v9 64-bit", 
119  EM_TRICORE:"Siemens Tricore", 
120  EM_ARC:"Argonaut RISC Core", 
121  EM_H8_300:"Hitachi H8/300", 
122  EM_H8_300H:"Hitachi H8/300H", 
123  EM_H8S:"Hitachi H8S", 
124  EM_H8_500:"Hitachi H8/500", 
125  EM_IA_64:"Intel Merced", 
126  EM_MIPS_X:"Stanford MIPS-X", 
127  EM_COLDFIRE:"Motorola Coldfire", 
128  EM_68HC12:"Motorola M68HC12", 
129  EM_MMA:"Fujitsu MMA Multimedia", 
130  EM_PCP:"Siemens PCP", 
131  EM_NCPU:"Sony nCPU embeeded RISC", 
132  EM_NDR1:"Denso NDR1 microprocessor", 
133  EM_STARCORE:"Motorola Start*Core processor", 
134  EM_ME16:"Toyota ME16 processor", 
135  EM_ST100:"STMicroelectronic ST100 processor", 
136  EM_TINYJ:"Advanced Logic Corp. Tinyj", 
137  EM_X86_64:"AMD x86-64 architecture", 
138  EM_PDSP:"Sony DSP Processor", 
139  EM_FX66:"Siemens FX66 microcontroller", 
140  EM_ST9PLUS:"STMicroelectronics ST9+ 8/16 mc", 
141  EM_ST7:"STmicroelectronics ST7 8 bit mc", 
142  EM_68HC16:"Motorola MC68HC16 microcontroller", 
143  EM_68HC11:"Motorola MC68HC11 microcontroller", 
144  EM_68HC08:"Motorola MC68HC08 microcontroller", 
145  EM_68HC05:"Motorola MC68HC05 microcontroller", 
146  EM_SVX:"Silicon Graphics SVx", 
147  EM_ST19:"STMicroelectronics ST19 8 bit mc", 
148  EM_VAX:"Digital VAX", 
149  EM_CRIS:"Axis Communications 32-bit embedded processor", 
150  EM_JAVELIN:"Infineon Technologies 32-bit embedded processor", 
151  EM_FIREPATH:"Element 14 64-bit DSP Processor", 
152  EM_ZSP:"LSI Logic 16-bit DSP Processor", 
153  EM_MMIX:"Donald Knuths educational 64-bit processor", 
154  EM_HUANY:"Harvard University machine-independent object files", 
155  EM_PRISM:"SiTera Prism", 
156  EM_AVR:"Atmel AVR 8-bit microcontroller", 
157  EM_FR30:"Fujitsu FR30", 
158  EM_D10V:"Mitsubishi D10V", 
159  EM_D30V:"Mitsubishi D30V", 
160  EM_V850:"NEC v850", 
161  EM_M32R:"Mitsubishi M32R", 
162  EM_MN10300:"Matsushita MN10300", 
163  EM_MN10200:"Matsushita MN10200", 
164  EM_PJ:"picoJava", 
165  EM_OPENRISC:"OpenRISC 32-bit embedded processor", 
166  EM_ARC_A5:"ARC Cores Tangent-A5", 
167  EM_XTENSA:"Tensilica Xtensa Architecture", 
168  EM_NUM:"", 
169  EM_ALPHA:"", 
170  } 
171   
172  ET_NONE = 0 
173  ET_REL = 1 
174  ET_EXEC = 2 
175  ET_DYN = 3 
176  ET_CORE = 4 
177  ET_NUM = 5 
178  ET_LOOS = 0xfe00 
179  ET_HIOS = 0xfeff 
180  ET_LOPROC = 0xff00 
181  ET_HIPROC = 0xffff 
182   
183  e_types = { 
184  ET_NONE:"No file type", 
185  ET_REL:"Relocatable file", 
186  ET_EXEC:"Executable file", 
187  ET_DYN:"Shared object file", 
188  ET_CORE:"Core file", 
189  ET_NUM:"Number of defined types", 
190  ET_LOOS:"OS-specific range start", 
191  ET_HIOS:"OS-specific range end", 
192  ET_LOPROC:"Processor-specific range start", 
193  ET_HIPROC:"Processor-specific range end", 
194  } 
195   
196  EV_NONE = 0 
197  EV_CURRENT = 1 
198  EV_NUM = 2 
199   
200  e_versions = { 
201  EV_NONE:"Invalid ELF version", 
202  EV_CURRENT:"Current version", 
203  EV_NUM:"", 
204  } 
205  R_68K_NONE = 0 
206  R_68K_32 = 1 
207  R_68K_16 = 2 
208  R_68K_8 = 3 
209  R_68K_PC32 = 4 
210  R_68K_PC16 = 5 
211  R_68K_PC8 = 6 
212  R_68K_GOT32 = 7 
213  R_68K_GOT16 = 8 
214  R_68K_GOT8 = 9 
215  R_68K_GOT32O = 10 
216  R_68K_GOT16O = 11 
217  R_68K_GOT8O = 12 
218  R_68K_PLT32 = 13 
219  R_68K_PLT16 = 14 
220  R_68K_PLT8 = 15 
221  R_68K_PLT32O = 16 
222  R_68K_PLT16O = 17 
223  R_68K_PLT8O = 18 
224  R_68K_COPY = 19 
225  R_68K_GLOB_DAT = 20 
226  R_68K_JMP_SLOT = 21 
227  R_68K_RELATIVE = 22 
228   
229  e_flags_68k = { 
230  R_68K_NONE:"No reloc", 
231  R_68K_32:"Direct 32 bit", 
232  R_68K_16:"Direct 16 bit", 
233  R_68K_8:"Direct 8 bit", 
234  R_68K_PC32:"PC relative 32 bit", 
235  R_68K_PC16:"PC relative 16 bit", 
236  R_68K_PC8:"PC relative 8 bit", 
237  R_68K_GOT32:"32 bit PC relative GOT entry", 
238  R_68K_GOT16:"16 bit PC relative GOT entry", 
239  R_68K_GOT8:"8 bit PC relative GOT entry", 
240  R_68K_GOT32O:"32 bit GOT offset", 
241  R_68K_GOT16O:"16 bit GOT offset", 
242  R_68K_GOT8O:"8 bit GOT offset", 
243  R_68K_PLT32:"32 bit PC relative PLT address", 
244  R_68K_PLT16:"16 bit PC relative PLT address", 
245  R_68K_PLT8:"8 bit PC relative PLT address", 
246  R_68K_PLT32O:"32 bit PLT offset", 
247  R_68K_PLT16O:"16 bit PLT offset", 
248  R_68K_PLT8O:"8 bit PLT offset", 
249  R_68K_COPY:"Copy symbol at runtime", 
250  R_68K_GLOB_DAT:"Create GOT entry", 
251  R_68K_JMP_SLOT:"Create PLT entry", 
252  R_68K_RELATIVE:"Adjust by program base", 
253  } 
254   
255  R_386_NONE = 0 
256  R_386_32 = 1 
257  R_386_PC32 = 2 
258  R_386_GOT32 = 3 
259  R_386_PLT32 = 4 
260  R_386_COPY = 5 
261  R_386_GLOB_DAT = 6 
262  R_386_JMP_SLOT = 7 
263  R_386_RELATIVE = 8 
264  R_386_GOTOFF = 9 
265  R_386_GOTPC = 10 
266  R_386_32PLT = 11 
267  R_386_TLS_TPOFF = 14 
268  R_386_TLS_IE = 15 
269  R_386_TLS_GOTIE = 16 
270  R_386_TLS_LE = 17 
271  R_386_TLS_GD = 18 
272  R_386_TLS_LDM = 19 
273  R_386_16 = 20 
274  R_386_PC16 = 21 
275  R_386_8 = 22 
276  R_386_PC8 = 23 
277  R_386_TLS_GD_32 = 24 
278  R_386_TLS_GD_PUSH = 25 
279  R_386_TLS_GD_CALL = 26 
280  R_386_TLS_GD_POP = 27 
281  R_386_TLS_LDM_32 = 28 
282  R_386_TLS_LDM_PUSH = 29 
283  R_386_TLS_LDM_CALL = 30 
284  R_386_TLS_LDM_POP = 31 
285  R_386_TLS_LDO_32 = 32 
286  R_386_TLS_IE_32 = 33 
287  R_386_TLS_LE_32 = 34 
288  R_386_TLS_DTPMOD32 = 35 
289  R_386_TLS_DTPOFF32 = 36 
290  R_386_TLS_TPOFF32 = 37 
291   
292  r_types_386 = { 
293  R_386_NONE:"No reloc", 
294  R_386_32:"Direct 32 bit", 
295  R_386_PC32:"PC relative 32 bit", 
296  R_386_GOT32:"32 bit GOT entry", 
297  R_386_PLT32:"32 bit PLT address", 
298  R_386_COPY:"Copy symbol at runtime", 
299  R_386_GLOB_DAT:"Create GOT entry", 
300  R_386_JMP_SLOT:"Create PLT entry", 
301  R_386_RELATIVE:"Adjust by program base", 
302  R_386_GOTOFF:"32 bit offset to GOT", 
303  R_386_GOTPC:"32 bit PC relative offset to GOT", 
304  R_386_32PLT:"", 
305  R_386_TLS_TPOFF:"Offset in static TLS block", 
306  R_386_TLS_IE:"Address of GOT entry for static", 
307  R_386_TLS_GOTIE:"GOT entry for static TLS", 
308  R_386_TLS_LE:"Offset relative to static", 
309  R_386_TLS_GD:"Direct 32 bit for GNU version", 
310  R_386_TLS_LDM:"Direct 32 bit for GNU version", 
311  R_386_16:"", 
312  R_386_PC16:"", 
313  R_386_8:"", 
314  R_386_PC8:"", 
315  R_386_TLS_GD_32:"Direct 32 bit for general", 
316  R_386_TLS_GD_PUSH:"Tag for pushl in GD TLS code", 
317  R_386_TLS_GD_CALL:"Relocation for call", 
318  R_386_TLS_GD_POP:"Tag for popl in GD TLS code", 
319  R_386_TLS_LDM_32:"Direct 32 bit for local", 
320  R_386_TLS_LDM_PUSH:"Tag for pushl in LDM TLS code", 
321  R_386_TLS_LDM_CALL:"Relocation for call", 
322  R_386_TLS_LDM_POP:"Tag for popl in LDM TLS code", 
323  R_386_TLS_LDO_32:"Offset relative to TLS block", 
324  R_386_TLS_IE_32:"GOT entry for negated static", 
325  R_386_TLS_LE_32:"Negated offset relative to", 
326  R_386_TLS_DTPMOD32:"ID of module containing symbol", 
327  R_386_TLS_DTPOFF32:"Offset in TLS block", 
328  R_386_TLS_TPOFF32:"Negated offset in static TLS block", 
329  } 
330   
331  R_X86_64_NONE        = 0 
332  R_X86_64_64          = 1 
333  R_X86_64_PC32        = 2 
334  R_X86_64_GOT32       = 3 
335  R_X86_64_PLT32       = 4 
336  R_X86_64_COPY        = 5 
337  R_X86_64_GLOB_DAT    = 6 
338  R_X86_64_JUMP_SLOT   = 7 
339  R_X86_64_RELATIVE    = 8 
340  R_X86_64_GOTPCREL    = 9 
341  R_X86_64_32          = 10 
342  R_X86_64_32S         = 11 
343  R_X86_64_16          = 12 
344  R_X86_64_PC16        = 13 
345  R_X86_64_8           = 14 
346  R_X86_64_PC8         = 15 
347  R_X86_64_DTPMOD64    = 16 
348  R_X86_64_DTPOFF64    = 17 
349  R_X86_64_TPOFF64     = 18 
350  R_X86_64_TLSGD       = 19 
351  R_X86_64_TLSLD       = 20 
352  R_X86_64_DTPOFF32    = 21 
353  R_X86_64_GOTTPOFF    = 22 
354  R_X86_64_TPOFF32     = 23 
355  R_X86_64_NUM         = 24 
356   
357  r_types_amd64 = { 
358  R_X86_64_NONE       :'No reloc', 
359  R_X86_64_64         :'Direct 64 bit ', 
360  R_X86_64_PC32       :'PC relative 32 bit signed', 
361  R_X86_64_GOT32      :'32 bit GOT entry', 
362  R_X86_64_PLT32      :'32 bit PLT address', 
363  R_X86_64_COPY       :'Copy symbol at runtime', 
364  R_X86_64_GLOB_DAT   :'Create GOT entry', 
365  R_X86_64_JUMP_SLOT  :'Create PLT entry', 
366  R_X86_64_RELATIVE   :'Adjust by program base', 
367  R_X86_64_GOTPCREL   :'32 bit signed PC relative offset to GOT', 
368  R_X86_64_32         :'Direct 32 bit zero extended', 
369  R_X86_64_32S        :'Direct 32 bit sign extended', 
370  R_X86_64_16         :'Direct 16 bit zero extended', 
371  R_X86_64_PC16       :'16 bit sign extended pc relative', 
372  R_X86_64_8          :'Direct 8 bit sign extended ', 
373  R_X86_64_PC8        :'8 bit sign extended pc relative', 
374  R_X86_64_DTPMOD64   :'ID of module containing symbol', 
375  R_X86_64_DTPOFF64   :'Offset in modules TLS block', 
376  R_X86_64_TPOFF64    :'Offset in initial TLS block', 
377  R_X86_64_TLSGD      :'32 bit signed PC relative offset to two GOT entries for GD symbol', 
378  R_X86_64_TLSLD      :'32 bit signed PC relative offset to two GOT entries for LD symbol', 
379  R_X86_64_DTPOFF32   :'Offset in TLS block', 
380  R_X86_64_GOTTPOFF   :'32 bit signed PC relative offset to GOT entry for IE symbol', 
381  R_X86_64_TPOFF32    :'Offset in initial TLS block', 
382  } 
383   
384  ## Define e_flags to 386 
385  SHT_NULL = 0 
386  SHT_PROGBITS = 1 
387  SHT_SYMTAB = 2 
388  SHT_STRTAB = 3 
389  SHT_RELA = 4 
390  SHT_HASH = 5 
391  SHT_DYNAMIC = 6 
392  SHT_NOTE = 7 
393  SHT_NOBITS = 8 
394  SHT_REL = 9 
395  SHT_SHLIB = 10 
396  SHT_DYNSYM = 11 
397  SHT_INIT_ARRAY = 14 
398  SHT_FINI_ARRAY = 15 
399  SHT_PREINIT_ARRAY = 16 
400  SHT_GROUP = 17 
401  SHT_SYMTAB_SHNDX = 18 
402  SHT_LOOS = 0x60000000 
403  SHT_GNU_LIBLIST = 0x6ffffff7 
404  SHT_CHECKSUM = 0x6ffffff8 
405  SHT_LOSUNW = 0x6ffffffa 
406  SHT_GNU_verdef = 0x6ffffffd 
407  SHT_GNU_verneed = 0x6ffffffe 
408  SHT_GNU_versym = 0x6fffffff 
409  SHT_HISUNW = 0x6fffffff 
410  SHT_HIOS = 0x6fffffff 
411  SHT_LOPROC = 0x70000000 
412  SHT_HIPROC = 0x7fffffff 
413  SHT_LOUSER = 0x80000000 
414  SHT_HIUSER = 0x8fffffff 
415   
416  sh_type = { 
417  SHT_NULL:"Section header table entry unused", 
418  SHT_PROGBITS:"Program data", 
419  SHT_SYMTAB:"Symbol table", 
420  SHT_STRTAB:"String table", 
421  SHT_RELA:"Relocation entries with addends", 
422  SHT_HASH:"Symbol hash table", 
423  SHT_DYNAMIC:"Dynamic linking information", 
424  SHT_NOTE:"Notes", 
425  SHT_NOBITS:"Program space with no data (bss)", 
426  SHT_REL:"Relocation entries, no addends", 
427  SHT_SHLIB:"Reserved", 
428  SHT_DYNSYM:"Dynamic linker symbol table", 
429  SHT_INIT_ARRAY:"Array of constructors", 
430  SHT_FINI_ARRAY:"Array of destructors", 
431  SHT_PREINIT_ARRAY:"Array of pre-constructors", 
432  SHT_GROUP:"Section group", 
433  SHT_SYMTAB_SHNDX:"Extended section indeces", 
434  SHT_LOOS:"Start OS-specific", 
435  SHT_GNU_LIBLIST:"Prelink library list", 
436  SHT_CHECKSUM:"Checksum for DSO content.", 
437  SHT_LOSUNW:"Sun-specific low bound.", 
438  SHT_GNU_verdef:"Version definition section.", 
439  SHT_GNU_verneed:"Version needs section.", 
440  SHT_GNU_versym:"Version symbol table.", 
441  SHT_HISUNW:"Sun-specific high bound.", 
442  SHT_HIOS:"End OS-specific type", 
443  SHT_LOPROC:"Start of processor-specific", 
444  SHT_HIPROC:"End of processor-specific", 
445  SHT_LOUSER:"Start of application-specific", 
446  SHT_HIUSER:"End of application-specific", 
447  } 
448   
449  SHF_WRITE = 1 
450  SHF_ALLOC = 2 
451  SHF_EXECINSTR = 4 
452  SHF_MERGE = 16 
453  SHF_STRINGS = 32 
454  SHF_INFO_LINK = 64 
455  SHF_LINK_ORDER = 128 
456  SHF_OS_NONCONFORMING = 256 
457  SHF_GROUP = 512 
458  SHF_TLS = 1024 
459  SHF_ORDERED = 1073741824 
460  SHF_EXCLUDE = 2147483648 
461   
462  sh_flags = { 
463  SHF_WRITE:"Writable", 
464  SHF_ALLOC:"Occupies memory during execution", 
465  SHF_EXECINSTR:"Executable", 
466  SHF_MERGE:"Might be merged", 
467  SHF_STRINGS:"Contains nul-terminated strings", 
468  SHF_INFO_LINK:"`sh_info' contains SHT index", 
469  SHF_LINK_ORDER:"Preserve order after combining", 
470  SHF_OS_NONCONFORMING:"Non-standard OS specific", 
471  SHF_GROUP:"Section is member of a group.", 
472  SHF_TLS:"Section hold thread-local data.", 
473  SHF_ORDERED:"Special ordering", 
474  SHF_EXCLUDE:"Section is excluded", 
475  } 
476   
477  STB_LOCAL = 0 
478  STB_GLOBAL = 1 
479  STB_WEAK = 2 
480  STB_LOOS = 10 
481  STB_HIOS = 12 
482  STB_LOPROC = 13 
483  STB_HIPROC = 15 
484   
485  st_info_bind = { 
486  STB_LOCAL:"Local symbol", 
487  STB_GLOBAL:"Global symbol", 
488  STB_WEAK:"Weak symbol", 
489  STB_LOOS:"Start of OS-specific", 
490  STB_HIOS:"End of OS-specific", 
491  STB_LOPROC:"Start of processor-specific", 
492  STB_HIPROC:"End of processor-specific", 
493  } 
494   
495  STT_NOTYPE = 0 
496  STT_OBJECT = 1 
497  STT_FUNC = 2 
498  STT_SECTION = 3 
499  STT_FILE = 4 
500  STT_COMMON = 5 
501  STT_TLS = 6 
502  STT_LOOS = 10 
503  STT_HIOS = 12 
504  STT_LOPROC = 13 
505  STT_HIPROC = 15 
506   
507  st_info_type = { 
508  STT_NOTYPE:"Symbol type is unspecified", 
509  STT_OBJECT:"Symbol is a data object", 
510  STT_FUNC:"Symbol is a code object", 
511  STT_SECTION:"Symbol associated with a section", 
512  STT_FILE:"Symbol's name is file name", 
513  STT_COMMON:"Symbol is a common data object", 
514  STT_TLS:"Symbol is thread-local data", 
515  STT_LOOS:"Start of OS-specific", 
516  STT_HIOS:"End of OS-specific", 
517  STT_LOPROC:"Start of processor-specific", 
518  STT_HIPROC:"End of processor-specific", 
519  } 
520   
521  DT_NULL     = 0 
522  DT_NEEDED   = 1 
523  DT_PLTRELSZ = 2 
524  DT_PLTGOT   = 3 
525  DT_HASH     = 4 
526  DT_STRTAB   = 5 
527  DT_SYMTAB   = 6 
528  DT_RELA     = 7 
529  DT_RELASZ   = 8 
530  DT_RELAENT  = 9 
531  DT_STRSZ    = 10 
532  DT_SYMENT   = 11 
533  DT_INIT     = 12 
534  DT_FINI     = 13 
535  DT_SONAME   = 14 
536  DT_RPATH    = 15 
537  DT_SYMBOLIC = 16 
538  DT_REL      = 17 
539  DT_RELSZ    = 18 
540  DT_RELENT   = 19 
541  DT_PLTREL   = 20 
542  DT_DEBUG    = 21 
543  DT_TEXTREL  = 22 
544  DT_JMPREL   = 23 
545  DT_BIND_NOW = 24 
546  DT_INIT_ARRAY   = 25 
547  DT_FINI_ARRAY   = 26 
548  DT_INIT_ARRAYSZ = 27 
549  DT_FINI_ARRAYSZ = 28 
550  DT_RUNPATH  = 29 
551  DT_FLAGS    = 30 
552  DT_ENCODING = 32 
553  DT_PREINIT_ARRAY = 32 
554  DT_PREINIT_ARRAYSZ = 33 
555  DT_NUM      = 34 
556  DT_GNU_PRELINKED    = 0x6ffffdf5  
557  DT_GNU_CONFLICTSZ   = 0x6ffffdf6  
558  DT_GNU_LIBLISTSZ    = 0x6ffffdf7  
559  DT_CHECKSUM         = 0x6ffffdf8  
560  DT_PLTPADSZ         = 0x6ffffdf9  
561  DT_MOVEENT          = 0x6ffffdfa  
562  DT_MOVESZ           = 0x6ffffdfb  
563  DT_FEATURE_1        = 0x6ffffdfc  
564  DT_POSFLAG_1        = 0x6ffffdfd  
565  DT_SYMINSZ          = 0x6ffffdfe  
566  DT_SYMINENT         = 0x6ffffdff  
567  DT_GNU_HASH         = 0x6ffffef5  
568  DT_TLSDESC_PLT      = 0x6ffffef6  
569  DT_TLSDESC_GOT      = 0x6ffffef7  
570  DT_GNU_CONFLICT     = 0x6ffffef8  
571  DT_GNU_LIBLIST      = 0x6ffffef9  
572  DT_CONFIG           = 0x6ffffefa  
573  DT_DEPAUDIT         = 0x6ffffefb  
574  DT_AUDIT            = 0x6ffffefc  
575  DT_PLTPAD           = 0x6ffffefd  
576  DT_MOVETAB          = 0x6ffffefe  
577  DT_SYMINFO          = 0x6ffffeff  
578  DT_VERSYM           = 0x6ffffff0  
579  DT_RELACOUNT        = 0x6ffffff9  
580  DT_RELCOUNT         = 0x6ffffffa  
581  DT_FLAGS_1          = 0x6ffffffb  
582  DT_VERDEF           = 0x6ffffffc  
583  DT_VERDEFNUM        = 0x6ffffffd  
584  DT_VERNEED          = 0x6ffffffe  
585  DT_VERNEEDNUM       = 0x6fffffff  
586  DT_AUXILIARY        = 0x7ffffffd  
587  DT_FILTER           = 0x7fffffff  
588  DT_LOOS             = 0x6000000d 
589  DT_HIOS             = 0x6ffff000 
590  DT_LOPROC           = 0x70000000 
591  DT_HIPROC           = 0x7fffffff 
592  #DT_PROCNUM  = DT_MIPS_NUM 
593   
594  dt_types = { 
595  DT_NULL     : "Marks end of dynamic section ", 
596  DT_NEEDED   : "Name of needed library ", 
597  DT_PLTRELSZ : "Size in bytes of PLT relocs ", 
598  DT_PLTGOT   : "Processor defined value ", 
599  DT_HASH     : "Address of symbol hash table ", 
600  DT_STRTAB   : "Address of string table ", 
601  DT_SYMTAB   : "Address of symbol table ", 
602  DT_RELA     : "Address of Rela relocs ", 
603  DT_RELASZ   : "Total size of Rela relocs ", 
604  DT_RELAENT  : "Size of one Rela reloc ", 
605  DT_STRSZ    : "Size of string table ", 
606  DT_SYMENT   : "Size of one symbol table entry ", 
607  DT_INIT     : "Address of init function ", 
608  DT_FINI     : "Address of termination function ", 
609  DT_SONAME   : "Name of shared object ", 
610  DT_RPATH    : "Library search path (deprecated) ", 
611  DT_SYMBOLIC : "Start symbol search here ", 
612  DT_REL      : "Address of Rel relocs ", 
613  DT_RELSZ    : "Total size of Rel relocs ", 
614  DT_RELENT   : "Size of one Rel reloc ", 
615  DT_PLTREL   : "Type of reloc in PLT ", 
616  DT_DEBUG    : "For debugging; unspecified ", 
617  DT_TEXTREL  : "Reloc might modify .text ", 
618  DT_JMPREL   : "Address of PLT relocs ", 
619  DT_BIND_NOW : "Process relocations of object ", 
620  DT_INIT_ARRAY   : "Array with addresses of init fct ", 
621  DT_FINI_ARRAY   : "Array with addresses of fini fct ", 
622  DT_INIT_ARRAYSZ : "Size in bytes of DT_INIT_ARRAY ", 
623  DT_FINI_ARRAYSZ : "Size in bytes of DT_FINI_ARRAY ", 
624  DT_RUNPATH  : "Library search path ", 
625  DT_FLAGS    : "Flags for the object being loaded ", 
626  DT_ENCODING : "Start of encoded range ", 
627  DT_PREINIT_ARRAY : "Array with addresses of preinit fct", 
628  DT_PREINIT_ARRAYSZ : "size in bytes of DT_PREINIT_ARRAY ", 
629  DT_NUM      : "Number used ", 
630  DT_LOOS     : "Start of OS-specific ", 
631  DT_HIOS     : "End of OS-specific ", 
632  DT_LOPROC   : "Start of processor-specific ", 
633  DT_HIPROC   : "End of processor-specific ", 
634  #DT_PROCNUM  : "Most used by any processor ", 
635  } 
636   
637   
638  PT_NULL     = 0 
639  PT_LOAD     = 1 
640  PT_DYNAMIC  = 2 
641  PT_INTERP   = 3 
642  PT_NOTE     = 4 
643  PT_SHLIB    = 5 
644  PT_PHDR     = 6 
645  PT_TLS      = 7 
646  PT_NUM      = 8 
647  PT_LOOS     = 0x60000000 
648  PT_GNU_EH_FRAME  = 0x6474e550 
649  PT_GNU_STACK  = 0x6474e551 
650  PT_GNU_RELRO  = 0x6474e552 
651  PT_LOSUNW   = 0x6ffffffa 
652  PT_SUNWBSS  = 0x6ffffffa 
653  PT_SUNWSTACK = 0x6ffffffb 
654  PT_HISUNW =  0x6fffffff 
655  PT_HIOS   =  0x6fffffff 
656  PT_LOPROC =  0x70000000 
657  PT_HIPROC =  0x7fffffff 
658   
659  ph_types = { 
660  PT_NULL:"Program header table entry unused", 
661  PT_LOAD:"Loadable program segment", 
662  PT_DYNAMIC:"Dynamic linking information", 
663  PT_INTERP:"Program interpreter", 
664  PT_NOTE:"Auxiliary information", 
665  PT_SHLIB:"Reserved", 
666  PT_PHDR:"Entry for header table itself", 
667  PT_TLS:"Thread-local storage segment", 
668  PT_NUM:"Number of defined types", 
669  PT_LOOS:"Start of OS-specific", 
670  PT_GNU_EH_FRAME:"GCC .eh_frame_hdr segment", 
671  PT_GNU_STACK:"Indicates stack executability", 
672  PT_GNU_RELRO:"Read-only after relocation", 
673  PT_SUNWBSS:"Sun Specific segment", 
674  PT_SUNWSTACK:"Stack segment", 
675  PT_HIOS:"End of OS-specific", 
676  PT_LOPROC:"Start of processor-specific", 
677  PT_HIPROC:"End of processor-specific"} 
678