Lines 50-56
Link Here
|
50 |
|
50 |
|
51 |
#include "_elftc.h" |
51 |
#include "_elftc.h" |
52 |
|
52 |
|
53 |
ELFTC_VCSID("$Id: elfdump.c 3250 2015-10-06 13:56:15Z emaste $"); |
53 |
ELFTC_VCSID("$Id: elfdump.c 3391 2016-02-05 19:43:01Z emaste $"); |
54 |
|
54 |
|
55 |
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) |
55 |
#if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) |
56 |
#include "native-elf-format.h" |
56 |
#include "native-elf-format.h" |
Lines 155-231
le32dec(const void *pp)
Link Here
|
155 |
static const char * |
155 |
static const char * |
156 |
d_tags(uint64_t tag) |
156 |
d_tags(uint64_t tag) |
157 |
{ |
157 |
{ |
|
|
158 |
static char unknown_buf[64]; |
159 |
|
158 |
switch (tag) { |
160 |
switch (tag) { |
159 |
case 0: return "DT_NULL"; |
161 |
case DT_NULL: return "DT_NULL"; |
160 |
case 1: return "DT_NEEDED"; |
162 |
case DT_NEEDED: return "DT_NEEDED"; |
161 |
case 2: return "DT_PLTRELSZ"; |
163 |
case DT_PLTRELSZ: return "DT_PLTRELSZ"; |
162 |
case 3: return "DT_PLTGOT"; |
164 |
case DT_PLTGOT: return "DT_PLTGOT"; |
163 |
case 4: return "DT_HASH"; |
165 |
case DT_HASH: return "DT_HASH"; |
164 |
case 5: return "DT_STRTAB"; |
166 |
case DT_STRTAB: return "DT_STRTAB"; |
165 |
case 6: return "DT_SYMTAB"; |
167 |
case DT_SYMTAB: return "DT_SYMTAB"; |
166 |
case 7: return "DT_RELA"; |
168 |
case DT_RELA: return "DT_RELA"; |
167 |
case 8: return "DT_RELASZ"; |
169 |
case DT_RELASZ: return "DT_RELASZ"; |
168 |
case 9: return "DT_RELAENT"; |
170 |
case DT_RELAENT: return "DT_RELAENT"; |
169 |
case 10: return "DT_STRSZ"; |
171 |
case DT_STRSZ: return "DT_STRSZ"; |
170 |
case 11: return "DT_SYMENT"; |
172 |
case DT_SYMENT: return "DT_SYMENT"; |
171 |
case 12: return "DT_INIT"; |
173 |
case DT_INIT: return "DT_INIT"; |
172 |
case 13: return "DT_FINI"; |
174 |
case DT_FINI: return "DT_FINI"; |
173 |
case 14: return "DT_SONAME"; |
175 |
case DT_SONAME: return "DT_SONAME"; |
174 |
case 15: return "DT_RPATH"; |
176 |
case DT_RPATH: return "DT_RPATH"; |
175 |
case 16: return "DT_SYMBOLIC"; |
177 |
case DT_SYMBOLIC: return "DT_SYMBOLIC"; |
176 |
case 17: return "DT_REL"; |
178 |
case DT_REL: return "DT_REL"; |
177 |
case 18: return "DT_RELSZ"; |
179 |
case DT_RELSZ: return "DT_RELSZ"; |
178 |
case 19: return "DT_RELENT"; |
180 |
case DT_RELENT: return "DT_RELENT"; |
179 |
case 20: return "DT_PLTREL"; |
181 |
case DT_PLTREL: return "DT_PLTREL"; |
180 |
case 21: return "DT_DEBUG"; |
182 |
case DT_DEBUG: return "DT_DEBUG"; |
181 |
case 22: return "DT_TEXTREL"; |
183 |
case DT_TEXTREL: return "DT_TEXTREL"; |
182 |
case 23: return "DT_JMPREL"; |
184 |
case DT_JMPREL: return "DT_JMPREL"; |
183 |
case 24: return "DT_BIND_NOW"; |
185 |
case DT_BIND_NOW: return "DT_BIND_NOW"; |
184 |
case 25: return "DT_INIT_ARRAY"; |
186 |
case DT_INIT_ARRAY: return "DT_INIT_ARRAY"; |
185 |
case 26: return "DT_FINI_ARRAY"; |
187 |
case DT_FINI_ARRAY: return "DT_FINI_ARRAY"; |
186 |
case 27: return "DT_INIT_ARRAYSZ"; |
188 |
case DT_INIT_ARRAYSZ: return "DT_INIT_ARRAYSZ"; |
187 |
case 28: return "DT_FINI_ARRAYSZ"; |
189 |
case DT_FINI_ARRAYSZ: return "DT_FINI_ARRAYSZ"; |
188 |
case 29: return "DT_RUNPATH"; |
190 |
case DT_RUNPATH: return "DT_RUNPATH"; |
189 |
case 30: return "DT_FLAGS"; |
191 |
case DT_FLAGS: return "DT_FLAGS"; |
190 |
case 32: return "DT_PREINIT_ARRAY"; /* XXX: DT_ENCODING */ |
192 |
case DT_PREINIT_ARRAY: return "DT_PREINIT_ARRAY"; /* XXX DT_ENCODING */ |
191 |
case 33: return "DT_PREINIT_ARRAYSZ"; |
193 |
case DT_PREINIT_ARRAYSZ:return "DT_PREINIT_ARRAYSZ"; |
192 |
/* 0x6000000D - 0x6ffff000 operating system-specific semantics */ |
194 |
/* 0x6000000D - 0x6ffff000 operating system-specific semantics */ |
193 |
case 0x6ffffdf5: return "DT_GNU_PRELINKED"; |
195 |
case 0x6ffffdf5: return "DT_GNU_PRELINKED"; |
194 |
case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ"; |
196 |
case 0x6ffffdf6: return "DT_GNU_CONFLICTSZ"; |
195 |
case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ"; |
197 |
case 0x6ffffdf7: return "DT_GNU_LIBLISTSZ"; |
196 |
case 0x6ffffdf8: return "DT_SUNW_CHECKSUM"; |
198 |
case 0x6ffffdf8: return "DT_SUNW_CHECKSUM"; |
197 |
case 0x6ffffdf9: return "DT_PLTPADSZ"; |
199 |
case DT_PLTPADSZ: return "DT_PLTPADSZ"; |
198 |
case 0x6ffffdfa: return "DT_MOVEENT"; |
200 |
case DT_MOVEENT: return "DT_MOVEENT"; |
199 |
case 0x6ffffdfb: return "DT_MOVESZ"; |
201 |
case DT_MOVESZ: return "DT_MOVESZ"; |
200 |
case 0x6ffffdfc: return "DT_FEATURE"; |
202 |
case 0x6ffffdfc: return "DT_FEATURE"; |
201 |
case 0x6ffffdfd: return "DT_POSFLAG_1"; |
203 |
case DT_POSFLAG_1: return "DT_POSFLAG_1"; |
202 |
case 0x6ffffdfe: return "DT_SYMINSZ"; |
204 |
case DT_SYMINSZ: return "DT_SYMINSZ"; |
203 |
case 0x6ffffdff: return "DT_SYMINENT (DT_VALRNGHI)"; |
205 |
case DT_SYMINENT: return "DT_SYMINENT (DT_VALRNGHI)"; |
204 |
case 0x6ffffe00: return "DT_ADDRRNGLO"; |
206 |
case DT_ADDRRNGLO: return "DT_ADDRRNGLO"; |
205 |
case 0x6ffffef5: return "DT_GNU_HASH"; |
207 |
case DT_GNU_HASH: return "DT_GNU_HASH"; |
206 |
case 0x6ffffef8: return "DT_GNU_CONFLICT"; |
208 |
case 0x6ffffef8: return "DT_GNU_CONFLICT"; |
207 |
case 0x6ffffef9: return "DT_GNU_LIBLIST"; |
209 |
case 0x6ffffef9: return "DT_GNU_LIBLIST"; |
208 |
case 0x6ffffefa: return "DT_CONFIG"; |
210 |
case 0x6ffffefa: return "DT_CONFIG"; |
209 |
case 0x6ffffefb: return "DT_DEPAUDIT"; |
211 |
case 0x6ffffefb: return "DT_DEPAUDIT"; |
210 |
case 0x6ffffefc: return "DT_AUDIT"; |
212 |
case 0x6ffffefc: return "DT_AUDIT"; |
211 |
case 0x6ffffefd: return "DT_PLTPAD"; |
213 |
case 0x6ffffefd: return "DT_PLTPAD"; |
212 |
case 0x6ffffefe: return "DT_MOVETAB"; |
214 |
case 0x6ffffefe: return "DT_MOVETAB"; |
213 |
case 0x6ffffeff: return "DT_SYMINFO (DT_ADDRRNGHI)"; |
215 |
case DT_SYMINFO: return "DT_SYMINFO (DT_ADDRRNGHI)"; |
214 |
case 0x6ffffff9: return "DT_RELACOUNT"; |
216 |
case DT_RELACOUNT: return "DT_RELACOUNT"; |
215 |
case 0x6ffffffa: return "DT_RELCOUNT"; |
217 |
case DT_RELCOUNT: return "DT_RELCOUNT"; |
216 |
case 0x6ffffffb: return "DT_FLAGS_1"; |
218 |
case DT_FLAGS_1: return "DT_FLAGS_1"; |
217 |
case 0x6ffffffc: return "DT_VERDEF"; |
219 |
case DT_VERDEF: return "DT_VERDEF"; |
218 |
case 0x6ffffffd: return "DT_VERDEFNUM"; |
220 |
case DT_VERDEFNUM: return "DT_VERDEFNUM"; |
219 |
case 0x6ffffffe: return "DT_VERNEED"; |
221 |
case DT_VERNEED: return "DT_VERNEED"; |
220 |
case 0x6fffffff: return "DT_VERNEEDNUM"; |
222 |
case DT_VERNEEDNUM: return "DT_VERNEEDNUM"; |
221 |
case 0x6ffffff0: return "DT_GNU_VERSYM"; |
223 |
case 0x6ffffff0: return "DT_GNU_VERSYM"; |
222 |
/* 0x70000000 - 0x7fffffff processor-specific semantics */ |
224 |
/* 0x70000000 - 0x7fffffff processor-specific semantics */ |
223 |
case 0x70000000: return "DT_IA_64_PLT_RESERVE"; |
225 |
case 0x70000000: return "DT_IA_64_PLT_RESERVE"; |
224 |
case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; |
226 |
case 0x7ffffffd: return "DT_SUNW_AUXILIARY"; |
225 |
case 0x7ffffffe: return "DT_SUNW_USED"; |
227 |
case 0x7ffffffe: return "DT_SUNW_USED"; |
226 |
case 0x7fffffff: return "DT_SUNW_FILTER"; |
228 |
case 0x7fffffff: return "DT_SUNW_FILTER"; |
227 |
default: return "ERROR: TAG NOT DEFINED"; |
|
|
228 |
} |
229 |
} |
|
|
230 |
|
231 |
snprintf(unknown_buf, sizeof(unknown_buf), |
232 |
"<unknown: %#llx>", (unsigned long long)tag); |
233 |
return (unknown_buf); |
229 |
} |
234 |
} |
230 |
|
235 |
|
231 |
static const char * |
236 |
static const char * |
Lines 313-354
sh_name(struct elfdump *ed, int ndx)
Link Here
|
313 |
|
318 |
|
314 |
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */ |
319 |
/* http://www.sco.com/developers/gabi/latest/ch4.sheader.html#sh_type */ |
315 |
static const char * |
320 |
static const char * |
316 |
sh_types(u_int64_t sht) { |
321 |
sh_types(uint64_t mach, uint64_t sht) { |
317 |
switch (sht) { |
322 |
static char unknown_buf[64]; |
318 |
case 0: return "SHT_NULL"; |
323 |
|
319 |
case 1: return "SHT_PROGBITS"; |
324 |
if (sht < 0x60000000) { |
320 |
case 2: return "SHT_SYMTAB"; |
325 |
switch (sht) { |
321 |
case 3: return "SHT_STRTAB"; |
326 |
case SHT_NULL: return "SHT_NULL"; |
322 |
case 4: return "SHT_RELA"; |
327 |
case SHT_PROGBITS: return "SHT_PROGBITS"; |
323 |
case 5: return "SHT_HASH"; |
328 |
case SHT_SYMTAB: return "SHT_SYMTAB"; |
324 |
case 6: return "SHT_DYNAMIC"; |
329 |
case SHT_STRTAB: return "SHT_STRTAB"; |
325 |
case 7: return "SHT_NOTE"; |
330 |
case SHT_RELA: return "SHT_RELA"; |
326 |
case 8: return "SHT_NOBITS"; |
331 |
case SHT_HASH: return "SHT_HASH"; |
327 |
case 9: return "SHT_REL"; |
332 |
case SHT_DYNAMIC: return "SHT_DYNAMIC"; |
328 |
case 10: return "SHT_SHLIB"; |
333 |
case SHT_NOTE: return "SHT_NOTE"; |
329 |
case 11: return "SHT_DYNSYM"; |
334 |
case SHT_NOBITS: return "SHT_NOBITS"; |
330 |
case 14: return "SHT_INIT_ARRAY"; |
335 |
case SHT_REL: return "SHT_REL"; |
331 |
case 15: return "SHT_FINI_ARRAY"; |
336 |
case SHT_SHLIB: return "SHT_SHLIB"; |
332 |
case 16: return "SHT_PREINIT_ARRAY"; |
337 |
case SHT_DYNSYM: return "SHT_DYNSYM"; |
333 |
case 17: return "SHT_GROUP"; |
338 |
case SHT_INIT_ARRAY: return "SHT_INIT_ARRAY"; |
334 |
case 18: return "SHT_SYMTAB_SHNDX"; |
339 |
case SHT_FINI_ARRAY: return "SHT_FINI_ARRAY"; |
335 |
/* 0x60000000 - 0x6fffffff operating system-specific semantics */ |
340 |
case SHT_PREINIT_ARRAY: return "SHT_PREINIT_ARRAY"; |
336 |
case 0x6ffffff0: return "XXX:VERSYM"; |
341 |
case SHT_GROUP: return "SHT_GROUP"; |
337 |
case 0x6ffffff4: return "SHT_SUNW_dof"; |
342 |
case SHT_SYMTAB_SHNDX: return "SHT_SYMTAB_SHNDX"; |
338 |
case 0x6ffffff6: return "SHT_GNU_HASH"; |
343 |
} |
339 |
case 0x6ffffff7: return "SHT_GNU_LIBLIST"; |
344 |
} else if (sht < 0x70000000) { |
340 |
case 0x6ffffffc: return "XXX:VERDEF"; |
345 |
/* 0x60000000-0x6fffffff operating system-specific semantics */ |
341 |
case 0x6ffffffd: return "SHT_SUNW(GNU)_verdef"; |
346 |
switch (sht) { |
342 |
case 0x6ffffffe: return "SHT_SUNW(GNU)_verneed"; |
347 |
case 0x6ffffff0: return "XXX:VERSYM"; |
343 |
case 0x6fffffff: return "SHT_SUNW(GNU)_versym"; |
348 |
case SHT_SUNW_dof: return "SHT_SUNW_dof"; |
344 |
/* 0x70000000 - 0x7fffffff processor-specific semantics */ |
349 |
case SHT_GNU_HASH: return "SHT_GNU_HASH"; |
345 |
case 0x70000000: return "SHT_IA_64_EXT"; |
350 |
case 0x6ffffff7: return "SHT_GNU_LIBLIST"; |
346 |
case 0x70000001: return "SHT_IA_64_UNWIND"; |
351 |
case 0x6ffffffc: return "XXX:VERDEF"; |
347 |
case 0x7ffffffd: return "XXX:AUXILIARY"; |
352 |
case SHT_SUNW_verdef: return "SHT_SUNW(GNU)_verdef"; |
348 |
case 0x7fffffff: return "XXX:FILTER"; |
353 |
case SHT_SUNW_verneed: return "SHT_SUNW(GNU)_verneed"; |
349 |
/* 0x80000000 - 0xffffffff application programs */ |
354 |
case SHT_SUNW_versym: return "SHT_SUNW(GNU)_versym"; |
350 |
default: return "ERROR: SHT NOT DEFINED"; |
355 |
} |
|
|
356 |
} else if (sht < 0x80000000) { |
357 |
/* 0x70000000 - 0x7fffffff processor-specific semantics */ |
358 |
switch (mach) { |
359 |
case EM_ARM: |
360 |
switch (sht) { |
361 |
case SHT_ARM_EXIDX: return "SHT_ARM_EXIDX"; |
362 |
case SHT_ARM_PREEMPTMAP: return "SHT_ARM_PREEMPTMAP"; |
363 |
case SHT_ARM_ATTRIBUTES: return "SHT_ARM_ATTRIBUTES"; |
364 |
case SHT_ARM_DEBUGOVERLAY: |
365 |
return "SHT_ARM_DEBUGOVERLAY"; |
366 |
case SHT_ARM_OVERLAYSECTION: |
367 |
return "SHT_ARM_OVERLAYSECTION"; |
368 |
} |
369 |
break; |
370 |
case EM_IA_64: |
371 |
switch (sht) { |
372 |
case 0x70000000: return "SHT_IA_64_EXT"; |
373 |
case 0x70000001: return "SHT_IA_64_UNWIND"; |
374 |
} |
375 |
break; |
376 |
case EM_MIPS: |
377 |
switch (sht) { |
378 |
case SHT_MIPS_REGINFO: return "SHT_MIPS_REGINFO"; |
379 |
case SHT_MIPS_OPTIONS: return "SHT_MIPS_OPTIONS"; |
380 |
case SHT_MIPS_ABIFLAGS: return "SHT_MIPS_ABIFLAGS"; |
381 |
} |
382 |
break; |
383 |
} |
384 |
switch (sht) { |
385 |
case 0x7ffffffd: return "XXX:AUXILIARY"; |
386 |
case 0x7fffffff: return "XXX:FILTER"; |
387 |
} |
351 |
} |
388 |
} |
|
|
389 |
/* 0x80000000 - 0xffffffff application programs */ |
390 |
|
391 |
snprintf(unknown_buf, sizeof(unknown_buf), |
392 |
"<unknown: %#llx>", (unsigned long long)sht); |
393 |
return (unknown_buf); |
352 |
} |
394 |
} |
353 |
|
395 |
|
354 |
/* |
396 |
/* |
Lines 390-411
sh_flags(uint64_t shf)
Link Here
|
390 |
return (flg); |
432 |
return (flg); |
391 |
} |
433 |
} |
392 |
|
434 |
|
393 |
static const char *st_types[] = { |
435 |
static const char * |
394 |
"STT_NOTYPE", "STT_OBJECT", "STT_FUNC", "STT_SECTION", "STT_FILE", |
436 |
st_type(unsigned int mach, unsigned int type) |
395 |
"STT_COMMON", "STT_TLS" |
437 |
{ |
396 |
}; |
438 |
static char s_type[32]; |
|
|
439 |
|
440 |
switch (type) { |
441 |
case STT_NOTYPE: return "STT_NOTYPE"; |
442 |
case STT_OBJECT: return "STT_OBJECT"; |
443 |
case STT_FUNC: return "STT_FUNC"; |
444 |
case STT_SECTION: return "STT_SECTION"; |
445 |
case STT_FILE: return "STT_FILE"; |
446 |
case STT_COMMON: return "STT_COMMON"; |
447 |
case STT_TLS: return "STT_TLS"; |
448 |
case 13: |
449 |
if (mach == EM_SPARCV9) |
450 |
return "STT_SPARC_REGISTER"; |
451 |
break; |
452 |
} |
453 |
snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type); |
454 |
return (s_type); |
455 |
} |
397 |
|
456 |
|
398 |
static const char *st_types_S[] = { |
457 |
static const char * |
399 |
"NOTY", "OBJT", "FUNC", "SECT", "FILE" |
458 |
st_type_S(unsigned int type) |
400 |
}; |
459 |
{ |
|
|
460 |
static char s_type[32]; |
401 |
|
461 |
|
402 |
static const char *st_bindings[] = { |
462 |
switch (type) { |
403 |
"STB_LOCAL", "STB_GLOBAL", "STB_WEAK" |
463 |
case STT_NOTYPE: return "NOTY"; |
404 |
}; |
464 |
case STT_OBJECT: return "OBJT"; |
|
|
465 |
case STT_FUNC: return "FUNC"; |
466 |
case STT_SECTION: return "SECT"; |
467 |
case STT_FILE: return "FILE"; |
468 |
} |
469 |
snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type); |
470 |
return (s_type); |
471 |
} |
405 |
|
472 |
|
406 |
static const char *st_bindings_S[] = { |
473 |
static const char * |
407 |
"LOCL", "GLOB", "WEAK" |
474 |
st_bindings(unsigned int sbind) |
408 |
}; |
475 |
{ |
|
|
476 |
static char s_sbind[32]; |
477 |
|
478 |
switch (sbind) { |
479 |
case STB_LOCAL: return "STB_LOCAL"; |
480 |
case STB_GLOBAL: return "STB_GLOBAL"; |
481 |
case STB_WEAK: return "STB_WEAK"; |
482 |
case STB_GNU_UNIQUE: return "STB_GNU_UNIQUE"; |
483 |
default: |
484 |
if (sbind >= STB_LOOS && sbind <= STB_HIOS) |
485 |
return "OS"; |
486 |
else if (sbind >= STB_LOPROC && sbind <= STB_HIPROC) |
487 |
return "PROC"; |
488 |
else |
489 |
snprintf(s_sbind, sizeof(s_sbind), "<unknown: %#x>", |
490 |
sbind); |
491 |
return (s_sbind); |
492 |
} |
493 |
} |
494 |
|
495 |
static const char * |
496 |
st_bindings_S(unsigned int sbind) |
497 |
{ |
498 |
static char s_sbind[32]; |
499 |
|
500 |
switch (sbind) { |
501 |
case STB_LOCAL: return "LOCL"; |
502 |
case STB_GLOBAL: return "GLOB"; |
503 |
case STB_WEAK: return "WEAK"; |
504 |
case STB_GNU_UNIQUE: return "UNIQ"; |
505 |
default: |
506 |
if (sbind >= STB_LOOS && sbind <= STB_HIOS) |
507 |
return "OS"; |
508 |
else if (sbind >= STB_LOPROC && sbind <= STB_HIPROC) |
509 |
return "PROC"; |
510 |
else |
511 |
snprintf(s_sbind, sizeof(s_sbind), "<%#x>", |
512 |
sbind); |
513 |
return (s_sbind); |
514 |
} |
515 |
} |
409 |
|
516 |
|
410 |
static unsigned char st_others[] = { |
517 |
static unsigned char st_others[] = { |
411 |
'D', 'I', 'H', 'P' |
518 |
'D', 'I', 'H', 'P' |
Lines 426-432
r_type(unsigned int mach, unsigned int type)
Link Here
|
426 |
case 4: return "R_386_PLT32"; |
533 |
case 4: return "R_386_PLT32"; |
427 |
case 5: return "R_386_COPY"; |
534 |
case 5: return "R_386_COPY"; |
428 |
case 6: return "R_386_GLOB_DAT"; |
535 |
case 6: return "R_386_GLOB_DAT"; |
429 |
case 7: return "R_386_JMP_SLOT"; |
536 |
case 7: return "R_386_JUMP_SLOT"; |
430 |
case 8: return "R_386_RELATIVE"; |
537 |
case 8: return "R_386_RELATIVE"; |
431 |
case 9: return "R_386_GOTOFF"; |
538 |
case 9: return "R_386_GOTOFF"; |
432 |
case 10: return "R_386_GOTPC"; |
539 |
case 10: return "R_386_GOTPC"; |
Lines 769-775
r_type(unsigned int mach, unsigned int type)
Link Here
|
769 |
case 4: return "R_X86_64_PLT32"; |
876 |
case 4: return "R_X86_64_PLT32"; |
770 |
case 5: return "R_X86_64_COPY"; |
877 |
case 5: return "R_X86_64_COPY"; |
771 |
case 6: return "R_X86_64_GLOB_DAT"; |
878 |
case 6: return "R_X86_64_GLOB_DAT"; |
772 |
case 7: return "R_X86_64_JMP_SLOT"; |
879 |
case 7: return "R_X86_64_JUMP_SLOT"; |
773 |
case 8: return "R_X86_64_RELATIVE"; |
880 |
case 8: return "R_X86_64_RELATIVE"; |
774 |
case 9: return "R_X86_64_GOTPCREL"; |
881 |
case 9: return "R_X86_64_GOTPCREL"; |
775 |
case 10: return "R_X86_64_32"; |
882 |
case 10: return "R_X86_64_32"; |
Lines 1608-1614
elf_print_shdr(struct elfdump *ed)
Link Here
|
1608 |
else |
1715 |
else |
1609 |
PRT(" sh_flags: 0\n"); |
1716 |
PRT(" sh_flags: 0\n"); |
1610 |
PRT(" sh_size: %#-14jx", (uintmax_t)s->sz); |
1717 |
PRT(" sh_size: %#-14jx", (uintmax_t)s->sz); |
1611 |
PRT(" sh_type: [ %s ]\n", sh_types(s->type)); |
1718 |
PRT(" sh_type: [ %s ]\n", |
|
|
1719 |
sh_types(ed->ehdr.e_machine, s->type)); |
1612 |
PRT(" sh_offset: %#-14jx", (uintmax_t)s->off); |
1720 |
PRT(" sh_offset: %#-14jx", (uintmax_t)s->off); |
1613 |
PRT(" sh_entsize: %#jx\n", (uintmax_t)s->entsize); |
1721 |
PRT(" sh_entsize: %#jx\n", (uintmax_t)s->entsize); |
1614 |
PRT(" sh_link: %-14u", s->link); |
1722 |
PRT(" sh_link: %-14u", s->link); |
Lines 1618-1624
elf_print_shdr(struct elfdump *ed)
Link Here
|
1618 |
PRT("\n"); |
1726 |
PRT("\n"); |
1619 |
PRT("entry: %ju\n", (uintmax_t)i); |
1727 |
PRT("entry: %ju\n", (uintmax_t)i); |
1620 |
PRT("\tsh_name: %s\n", s->name); |
1728 |
PRT("\tsh_name: %s\n", s->name); |
1621 |
PRT("\tsh_type: %s\n", sh_types(s->type)); |
1729 |
PRT("\tsh_type: %s\n", |
|
|
1730 |
sh_types(ed->ehdr.e_machine, s->type)); |
1622 |
PRT("\tsh_flags: %s\n", sh_flags(s->flags)); |
1731 |
PRT("\tsh_flags: %s\n", sh_flags(s->flags)); |
1623 |
PRT("\tsh_addr: %#jx\n", (uintmax_t)s->addr); |
1732 |
PRT("\tsh_addr: %#jx\n", (uintmax_t)s->addr); |
1624 |
PRT("\tsh_offset: %ju\n", (uintmax_t)s->off); |
1733 |
PRT("\tsh_offset: %ju\n", (uintmax_t)s->off); |
Lines 1745-1752
elf_print_symtab(struct elfdump *ed, int i)
Link Here
|
1745 |
PRT("0x%8.8jx ", (uintmax_t)sym.st_size); |
1854 |
PRT("0x%8.8jx ", (uintmax_t)sym.st_size); |
1746 |
else |
1855 |
else |
1747 |
PRT("0x%12.12jx ", (uintmax_t)sym.st_size); |
1856 |
PRT("0x%12.12jx ", (uintmax_t)sym.st_size); |
1748 |
PRT("%s ", st_types_S[GELF_ST_TYPE(sym.st_info)]); |
1857 |
PRT("%s ", st_type_S(GELF_ST_TYPE(sym.st_info))); |
1749 |
PRT("%s ", st_bindings_S[GELF_ST_BIND(sym.st_info)]); |
1858 |
PRT("%s ", st_bindings_S(GELF_ST_BIND(sym.st_info))); |
1750 |
PRT("%c ", st_others[sym.st_other]); |
1859 |
PRT("%c ", st_others[sym.st_other]); |
1751 |
PRT("%3u ", (vs == NULL ? 0 : vs[j])); |
1860 |
PRT("%3u ", (vs == NULL ? 0 : vs[j])); |
1752 |
PRT("%-11.11s ", sh_name(ed, sym.st_shndx)); |
1861 |
PRT("%-11.11s ", sh_name(ed, sym.st_shndx)); |
Lines 1757-1764
elf_print_symtab(struct elfdump *ed, int i)
Link Here
|
1757 |
PRT("\tst_value: %#jx\n", (uintmax_t)sym.st_value); |
1866 |
PRT("\tst_value: %#jx\n", (uintmax_t)sym.st_value); |
1758 |
PRT("\tst_size: %ju\n", (uintmax_t)sym.st_size); |
1867 |
PRT("\tst_size: %ju\n", (uintmax_t)sym.st_size); |
1759 |
PRT("\tst_info: %s %s\n", |
1868 |
PRT("\tst_info: %s %s\n", |
1760 |
st_types[GELF_ST_TYPE(sym.st_info)], |
1869 |
st_type(ed->ehdr.e_machine, |
1761 |
st_bindings[GELF_ST_BIND(sym.st_info)]); |
1870 |
GELF_ST_TYPE(sym.st_info)), |
|
|
1871 |
st_bindings(GELF_ST_BIND(sym.st_info))); |
1762 |
PRT("\tst_shndx: %ju\n", (uintmax_t)sym.st_shndx); |
1872 |
PRT("\tst_shndx: %ju\n", (uintmax_t)sym.st_shndx); |
1763 |
} |
1873 |
} |
1764 |
} |
1874 |
} |
Lines 2173-2183
elf_print_got_section(struct elfdump *ed, struct section *s)
Link Here
|
2173 |
for(i = 0; i < len; i++) { |
2283 |
for(i = 0; i < len; i++) { |
2174 |
PRT("[%5.5d] ", i); |
2284 |
PRT("[%5.5d] ", i); |
2175 |
if (ed->ec == ELFCLASS32) { |
2285 |
if (ed->ec == ELFCLASS32) { |
2176 |
PRT("%-8.8jx ", s->addr + i * s->entsize); |
2286 |
PRT("%-8.8jx ", |
|
|
2287 |
(uintmax_t) (s->addr + i * s->entsize)); |
2177 |
PRT("%-8.8x ", *((uint32_t *)dst.d_buf + i)); |
2288 |
PRT("%-8.8x ", *((uint32_t *)dst.d_buf + i)); |
2178 |
} else { |
2289 |
} else { |
2179 |
PRT("%-16.16jx ", s->addr + i * s->entsize); |
2290 |
PRT("%-16.16jx ", |
2180 |
PRT("%-16.16jx ", *((uint64_t *)dst.d_buf + i)); |
2291 |
(uintmax_t) (s->addr + i * s->entsize)); |
|
|
2292 |
PRT("%-16.16jx ", |
2293 |
(uintmax_t) *((uint64_t *)dst.d_buf + i)); |
2181 |
} |
2294 |
} |
2182 |
PRT("%-18s ", r_type(ed->ehdr.e_machine, |
2295 |
PRT("%-18s ", r_type(ed->ehdr.e_machine, |
2183 |
GELF_R_TYPE(got[i].u_r.rel.r_info))); |
2296 |
GELF_R_TYPE(got[i].u_r.rel.r_info))); |
Lines 2198-2204
elf_print_got_section(struct elfdump *ed, struct section *s)
Link Here
|
2198 |
if (ed->ec == ELFCLASS32) |
2311 |
if (ed->ec == ELFCLASS32) |
2199 |
PRT("\t%#x\n", *((uint32_t *)dst.d_buf + i)); |
2312 |
PRT("\t%#x\n", *((uint32_t *)dst.d_buf + i)); |
2200 |
else |
2313 |
else |
2201 |
PRT("\t%#jx\n", *((uint64_t *)dst.d_buf + i)); |
2314 |
PRT("\t%#jx\n", |
|
|
2315 |
(uintmax_t) *((uint64_t *)dst.d_buf + i)); |
2202 |
} |
2316 |
} |
2203 |
} |
2317 |
} |
2204 |
} |
2318 |
} |