Lines 145-150
Link Here
|
145 |
static int do_dynamic; |
145 |
static int do_dynamic; |
146 |
static int do_syms; |
146 |
static int do_syms; |
147 |
static int do_reloc; |
147 |
static int do_reloc; |
|
|
148 |
static int do_direct; |
148 |
static int do_sections; |
149 |
static int do_sections; |
149 |
static int do_section_groups; |
150 |
static int do_section_groups; |
150 |
static int do_section_details; |
151 |
static int do_section_details; |
Lines 1481-1486
Link Here
|
1481 |
case DT_SYMINFO: return "SYMINFO"; /* aka ADDRRNGHI */ |
1482 |
case DT_SYMINFO: return "SYMINFO"; /* aka ADDRRNGHI */ |
1482 |
|
1483 |
|
1483 |
case DT_VERSYM: return "VERSYM"; |
1484 |
case DT_VERSYM: return "VERSYM"; |
|
|
1485 |
case DT_SUSE_DIRECT: return "SUSE_DIRECT"; |
1484 |
|
1486 |
|
1485 |
case DT_TLSDESC_GOT: return "TLSDESC_GOT"; |
1487 |
case DT_TLSDESC_GOT: return "TLSDESC_GOT"; |
1486 |
case DT_TLSDESC_PLT: return "TLSDESC_PLT"; |
1488 |
case DT_TLSDESC_PLT: return "TLSDESC_PLT"; |
Lines 2644-2649
Link Here
|
2644 |
{"symbols", no_argument, 0, 's'}, |
2646 |
{"symbols", no_argument, 0, 's'}, |
2645 |
{"syms", no_argument, 0, 's'}, |
2647 |
{"syms", no_argument, 0, 's'}, |
2646 |
{"relocs", no_argument, 0, 'r'}, |
2648 |
{"relocs", no_argument, 0, 'r'}, |
|
|
2649 |
{"direct", no_argument, 0, 'y'}, |
2647 |
{"notes", no_argument, 0, 'n'}, |
2650 |
{"notes", no_argument, 0, 'n'}, |
2648 |
{"dynamic", no_argument, 0, 'd'}, |
2651 |
{"dynamic", no_argument, 0, 'd'}, |
2649 |
{"arch-specific", no_argument, 0, 'A'}, |
2652 |
{"arch-specific", no_argument, 0, 'A'}, |
Lines 2681-2686
Link Here
|
2681 |
--symbols An alias for --syms\n\ |
2684 |
--symbols An alias for --syms\n\ |
2682 |
-n --notes Display the core notes (if present)\n\ |
2685 |
-n --notes Display the core notes (if present)\n\ |
2683 |
-r --relocs Display the relocations (if present)\n\ |
2686 |
-r --relocs Display the relocations (if present)\n\ |
|
|
2687 |
-y --direct Display direct linkage table (if present)\n\ |
2684 |
-u --unwind Display the unwind info (if present)\n\ |
2688 |
-u --unwind Display the unwind info (if present)\n\ |
2685 |
-d --dynamic Display the dynamic section (if present)\n\ |
2689 |
-d --dynamic Display the dynamic section (if present)\n\ |
2686 |
-V --version-info Display the version sections (if present)\n\ |
2690 |
-V --version-info Display the version sections (if present)\n\ |
Lines 2770-2776
Link Here
|
2770 |
usage (); |
2774 |
usage (); |
2771 |
|
2775 |
|
2772 |
while ((c = getopt_long |
2776 |
while ((c = getopt_long |
2773 |
(argc, argv, "ersuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF) |
2777 |
(argc, argv, "erysuahnldSDAINtgw::x:i:vVWH", options, NULL)) != EOF) |
2774 |
{ |
2778 |
{ |
2775 |
char *cp; |
2779 |
char *cp; |
2776 |
int section; |
2780 |
int section; |
Lines 2787-2792
Link Here
|
2787 |
case 'a': |
2791 |
case 'a': |
2788 |
do_syms++; |
2792 |
do_syms++; |
2789 |
do_reloc++; |
2793 |
do_reloc++; |
|
|
2794 |
do_direct++; |
2790 |
do_unwind++; |
2795 |
do_unwind++; |
2791 |
do_dynamic++; |
2796 |
do_dynamic++; |
2792 |
do_header++; |
2797 |
do_header++; |
Lines 2820-2825
Link Here
|
2820 |
case 'r': |
2825 |
case 'r': |
2821 |
do_reloc++; |
2826 |
do_reloc++; |
2822 |
break; |
2827 |
break; |
|
|
2828 |
case 'y': |
2829 |
do_direct++; |
2830 |
break; |
2823 |
case 'u': |
2831 |
case 'u': |
2824 |
do_unwind++; |
2832 |
do_unwind++; |
2825 |
break; |
2833 |
break; |
Lines 3029-3035
Link Here
|
3029 |
if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections |
3037 |
if (!do_dynamic && !do_syms && !do_reloc && !do_unwind && !do_sections |
3030 |
&& !do_segments && !do_header && !do_dump && !do_version |
3038 |
&& !do_segments && !do_header && !do_dump && !do_version |
3031 |
&& !do_histogram && !do_debugging && !do_arch && !do_notes |
3039 |
&& !do_histogram && !do_debugging && !do_arch && !do_notes |
3032 |
&& !do_section_groups) |
3040 |
&& !do_section_groups && !do_direct) |
3033 |
usage (); |
3041 |
usage (); |
3034 |
else if (argc < 3) |
3042 |
else if (argc < 3) |
3035 |
{ |
3043 |
{ |
Lines 4667-4672
Link Here
|
4667 |
return 1; |
4675 |
return 1; |
4668 |
} |
4676 |
} |
4669 |
|
4677 |
|
|
|
4678 |
static void |
4679 |
print_dt_needed_name (int idx) |
4680 |
{ |
4681 |
const char *name = NULL; |
4682 |
Elf_Internal_Dyn *entry; |
4683 |
|
4684 |
idx &= DT_SUSE_DIRECT_MASK; |
4685 |
|
4686 |
switch (idx) |
4687 |
{ |
4688 |
case 0: |
4689 |
name = _("<self>"); |
4690 |
break; |
4691 |
case DT_SUSE_DIRECT_UNKNOWN: |
4692 |
name = _("<unknown>"); |
4693 |
break; |
4694 |
default: |
4695 |
idx--; |
4696 |
|
4697 |
for (entry = dynamic_section; |
4698 |
entry < dynamic_section + dynamic_nent && idx > 0; |
4699 |
entry++) |
4700 |
if (entry->d_tag == DT_NEEDED) |
4701 |
idx--; |
4702 |
|
4703 |
if (idx == 0) |
4704 |
{ |
4705 |
if (VALID_DYNAMIC_NAME (entry->d_un.d_val)) |
4706 |
name = GET_DYNAMIC_NAME (entry->d_un.d_val); |
4707 |
else |
4708 |
name = NULL; |
4709 |
} |
4710 |
break; |
4711 |
} |
4712 |
|
4713 |
if (!name) |
4714 |
name = _("<out-of-range>"); |
4715 |
if (do_wide) |
4716 |
printf ("%s", name); |
4717 |
else |
4718 |
printf ("%-25s", name); |
4719 |
} |
4720 |
|
4721 |
static int |
4722 |
process_direct (FILE *file) |
4723 |
{ |
4724 |
unsigned int i; |
4725 |
unsigned int si; |
4726 |
char *strtab; |
4727 |
unsigned char *directtab; |
4728 |
Elf_Internal_Sym *symtab = NULL; |
4729 |
Elf_Internal_Sym *psym; |
4730 |
Elf_Internal_Shdr *direct = NULL; |
4731 |
Elf_Internal_Shdr *dynsym = NULL; |
4732 |
Elf_Internal_Shdr *section; |
4733 |
|
4734 |
if (!do_direct) |
4735 |
return 1; |
4736 |
if (!dynamic_symbols || !dynamic_section || !dynamic_strings) |
4737 |
return 1; |
4738 |
|
4739 |
for (i = 0, section = section_headers; |
4740 |
i < elf_header.e_shnum; |
4741 |
i++, section++) |
4742 |
{ |
4743 |
if (section->sh_type == SHT_DYNSYM) |
4744 |
dynsym = section; |
4745 |
if (!strcmp (SECTION_NAME (section), ".suse.direct")) |
4746 |
direct = section; |
4747 |
} |
4748 |
if (!dynsym || !direct) |
4749 |
return 1; |
4750 |
|
4751 |
symtab = GET_ELF_SYMBOLS (file, dynsym); |
4752 |
if (!symtab) |
4753 |
return 1; |
4754 |
|
4755 |
directtab = get_data (NULL, file, direct->sh_offset, |
4756 |
direct->sh_size, 1, _("direct linkage table")); |
4757 |
if (!symtab) |
4758 |
{ |
4759 |
free (symtab); |
4760 |
return 1; |
4761 |
} |
4762 |
|
4763 |
if (dynsym->sh_link == elf_header.e_shstrndx) |
4764 |
strtab = string_table; |
4765 |
else |
4766 |
{ |
4767 |
Elf_Internal_Shdr *string_sec; |
4768 |
|
4769 |
string_sec = SECTION_HEADER (dynsym->sh_link); |
4770 |
|
4771 |
strtab = get_data (NULL, file, string_sec->sh_offset, |
4772 |
string_sec->sh_size, 1, _("string table")); |
4773 |
} |
4774 |
|
4775 |
assert (strtab != NULL); |
4776 |
|
4777 |
printf (_("\nDirect relocations for image:\n")); |
4778 |
printf (_(" Num: Index Vague Binding Symbol\n")); |
4779 |
for (si = 0, psym = symtab; |
4780 |
si < dynsym->sh_size / dynsym->sh_entsize; |
4781 |
si++, psym++) |
4782 |
{ |
4783 |
unsigned int field; |
4784 |
printf ("%6d: ", si); |
4785 |
field = byte_get (directtab + (si * 2), 2); |
4786 |
printf ("[0x%.4x] ", field); |
4787 |
printf ("%s", (field & DT_SUSE_DIRECT_VAGUE) ? "Vague" : " "); |
4788 |
printf (" "); |
4789 |
print_dt_needed_name (field); |
4790 |
printf (" "); |
4791 |
print_symbol (25, strtab + psym->st_name); |
4792 |
printf ("\n"); |
4793 |
} |
4794 |
|
4795 |
|
4796 |
free (symtab); |
4797 |
if (strtab != string_table) |
4798 |
free (strtab); |
4799 |
|
4800 |
return 1; |
4801 |
} |
4802 |
|
4803 |
|
4670 |
/* Process the unwind section. */ |
4804 |
/* Process the unwind section. */ |
4671 |
|
4805 |
|
4672 |
#include "unwind-ia64.h" |
4806 |
#include "unwind-ia64.h" |
Lines 9003-9008
Link Here
|
9003 |
|
9137 |
|
9004 |
process_relocs (file); |
9138 |
process_relocs (file); |
9005 |
|
9139 |
|
|
|
9140 |
process_direct (file); |
9141 |
|
9006 |
process_unwind (file); |
9142 |
process_unwind (file); |
9007 |
|
9143 |
|
9008 |
process_symbol_table (file); |
9144 |
process_symbol_table (file); |