On Wed, 2013-11-13 at 20:08 +0100, Jan Kratochvil wrote: > On Wed, 13 Nov 2013 12:48:29 +0100, Mark Wielaard wrote: > > So, I think the user might also want to get hold of the file. Do you > > think it makes sense to provide the user with extended versions of > > getsym and addrsym based on this? > > > > const char *dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx, > > GElf_Sym *sym, GElf_Word *shndxp, > > Elf *elf) > > > > char *dwfl_module_addrsym_elf (Dwfl_Module *mod, GElf_Addr address, > > GElf_Sym *sym, GElf_Word *shndxp, > > Elf *elf) > > > > Where elf will be the main or debug file. > > Primarily the current functions > > extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx, > GElf_Sym *sym, GElf_Word *shndxp) > extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address, > GElf_Sym *sym, GElf_Word *shndxp) > > do not make sense as they are. And current src/ subdir never uses their > *SHNDXP. Therefore either 'GElf_Word *shndxp' should be removed from them > (in API incompatible but ABI compatible way, as usual) or there should be > added the parameter 'Elf *elfp' (again in API incompatible but ABI compatible > way).
They don't make sense if referring to non-special section constants, but you can still check against special section constants like SHN_UNDEF and SHN_ABS. So we should clearly document that. For source compatibility it matters more that code outside core/src elfutils uses the functions than those within. And these functions are used in e.g. systemtap (they do check shndx against SHN_UNDEF). I don't like breaking source compatibility for public functions that are actually used, and aren't fundamentally broken (which these aren't IMHO, they are just not as useful as they could be) it prevents building older versions against a newer elfutils release. In this particular case it makes more sense to keep the old functions, but also introduce more capable functions that do provide the ELF file to be able to refer to non-special section indexes. Thanks, Mark
>From 1bd3f3c5d83de252337ef315f919d2b0e8068696 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <[email protected]> Date: Tue, 26 Nov 2013 14:56:36 +0100 Subject: [PATCH] libdwfl: Add dwfl_module_addrsym_elf and dwfl_module_getsym_elf. Introduce two new functions that also return the elf associated with a symbol to make symbol section indexing work for non-special sections. Document limitations of shndx with existing dwfl_module_addrsym and dwfl_module_getsym. Extend dwflsyms testcase to check some more symbol and section (index) properties. Signed-off-by: Mark Wielaard <[email protected]> --- libdw/ChangeLog | 5 ++ libdw/libdw.map | 3 + libdwfl/ChangeLog | 12 +++++ libdwfl/dwfl_module_addrsym.c | 21 +++++++- libdwfl/dwfl_module_getsym.c | 12 +++++ libdwfl/libdwfl.h | 20 +++++++- libdwfl/libdwflP.h | 2 + tests/ChangeLog | 8 +++ tests/dwflsyms.c | 49 +++++++++++++++++-- tests/run-dwflsyms.sh | 110 ++++++++++++++++++++-------------------- 10 files changed, 180 insertions(+), 62 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index dc0c4c9..820acc2 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2013-11-26 Mark Wielaard <[email protected]> + + * libdw.map (ELFUTILS_0.158): Add dwfl_module_addrsym_elf and + dwfl_module_getsym_elf. + 2013-11-09 Mark Wielaard <[email protected]> * dwarf_getaranges.c (dwarf_getaranges): Read segment_size and diff --git a/libdw/libdw.map b/libdw/libdw.map index 922608a..e7b6a57 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -282,4 +282,7 @@ ELFUTILS_0.158 { global: # Replaced ELFUTILS_0.146 version, which has a wrapper without executable. dwfl_core_file_report; + + dwfl_module_addrsym_elf; + dwfl_module_getsym_elf; } ELFUTILS_0.157; diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index deb5014..c17624c 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,15 @@ +2013-11-26 Mark Wielaard <[email protected]> + + * dwfl_module_addrsym.c (dwfl_module_addrsym): Rename to and call... + (dwfl_module_addrsym_elf): this. Add elfp argument, keep track of + closest_file and sizeless_file. + * dwfl_module_getsym.c (dwfl_module_getsym_elf): New function. + * libdwfl.h (dwfl_module_getsym): Document limitations of shndx. + (dwfl_module_getsym_elf): New function declaration. + (dwfl_module_addrsym_elf): Likewise. + * libdwflP.h (dwfl_module_addrsym_elf): INTDECL. + (dwfl_module_getsym_elf): Likewise. + 2013-11-21 Jan Kratochvil <[email protected]> Fix non-build-id core files on build-id system. diff --git a/libdwfl/dwfl_module_addrsym.c b/libdwfl/dwfl_module_addrsym.c index d9eb0a2..4f43db5 100644 --- a/libdwfl/dwfl_module_addrsym.c +++ b/libdwfl/dwfl_module_addrsym.c @@ -32,8 +32,8 @@ Never returns symbols at addresses above ADDR. */ const char * -dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, - GElf_Sym *closest_sym, GElf_Word *shndxp) +dwfl_module_addrsym_elf (Dwfl_Module *mod, GElf_Addr addr, + GElf_Sym *closest_sym, GElf_Word *shndxp, Elf **elfp) { int syments = INTUSE(dwfl_module_getsymtab) (mod); if (syments < 0) @@ -77,11 +77,13 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, Here we store only symbols with nonzero st_size. */ const char *closest_name = NULL; GElf_Word closest_shndx = SHN_UNDEF; + struct dwfl_file *closest_file = NULL; /* Keep track of an eligible symbol with st_size == 0 as a fallback. */ const char *sizeless_name = NULL; GElf_Sym sizeless_sym = { 0, 0, 0, 0, 0, SHN_UNDEF }; GElf_Word sizeless_shndx = SHN_UNDEF; + struct dwfl_file *sizeless_file = NULL; /* Keep track of the lowest address a relevant sizeless symbol could have. */ GElf_Addr min_label = 0; @@ -136,6 +138,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, { *closest_sym = sym; closest_shndx = shndx; + closest_file = file; closest_name = name; } else if (closest_name == NULL @@ -148,6 +151,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, the same section as ADDR. */ sizeless_sym = sym; sizeless_shndx = shndx; + sizeless_file = file; sizeless_name = name; } } @@ -166,6 +170,7 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, { *closest_sym = sym; closest_shndx = shndx; + closest_file = file; closest_name = name; } } @@ -200,11 +205,23 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, { *closest_sym = sizeless_sym; closest_shndx = sizeless_shndx; + closest_file = sizeless_file; closest_name = sizeless_name; } if (shndxp != NULL) *shndxp = closest_shndx; + if (elfp != NULL) + *elfp = closest_file->elf; return closest_name; } +INTDEF (dwfl_module_addrsym_elf) + + +const char * +dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr, + GElf_Sym *closest_sym, GElf_Word *shndxp) +{ + return INTUSE(dwfl_module_addrsym_elf) (mod, addr, closest_sym, shndxp, NULL); +} INTDEF (dwfl_module_addrsym) diff --git a/libdwfl/dwfl_module_getsym.c b/libdwfl/dwfl_module_getsym.c index 0f5dd37..0e3f632 100644 --- a/libdwfl/dwfl_module_getsym.c +++ b/libdwfl/dwfl_module_getsym.c @@ -164,3 +164,15 @@ dwfl_module_getsym (Dwfl_Module *mod, int ndx, return __libdwfl_module_getsym (mod, ndx, sym, shndxp, NULL); } INTDEF (dwfl_module_getsym) + +const char * +dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx, + GElf_Sym *sym, GElf_Word *shndxp, Elf **elfp) +{ + struct dwfl_file *file; + const char *name = __libdwfl_module_getsym (mod, ndx, sym, shndxp, &file); + if (elfp != NULL) + *elfp = file->elf; + return name; +} +INTDEF (dwfl_module_getsym_elf) diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h index c1a0fb9..bb80876 100644 --- a/libdwfl/libdwfl.h +++ b/libdwfl/libdwfl.h @@ -436,11 +436,22 @@ extern int dwfl_module_getsymtab (Dwfl_Module *mod); an absolute value based on the module's location, when the symbol is in an SHF_ALLOC section. If SHNDXP is non-null, it's set with the section index (whether from st_shndx or extended index table); in case of a - symbol in a non-allocated section, *SHNDXP is instead set to -1. */ + symbol in a non-allocated section, *SHNDXP is instead set to -1. + Note that since symbols can come from either the main, debug or auxiliary + ELF symbol file (either dynsym or symtab) the section index can only + be reliably used to compare against special section constants like + SHN_UNDEF or SHN_ABS. */ extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Word *shndxp) __nonnull_attribute__ (3); +/* Same as dwfl_module_getsym but also returns the ELF file, when not NULL, + that the symbol came from so the section index can be reliably used. */ +extern const char *dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx, + GElf_Sym *sym, GElf_Word *shndxp, + Elf **elfp) + __nonnull_attribute__ (3); + /* Find the symbol that ADDRESS lies inside, and return its name. */ extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address); @@ -450,6 +461,13 @@ extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address, GElf_Sym *sym, GElf_Word *shndxp) __nonnull_attribute__ (3); +/* Same as dwfl_module_addrsym but also returns the ELF file, when not NULL, + that the symbol came from so the section index can be reliably used. */ +extern const char *dwfl_module_addrsym_elf (Dwfl_Module *mod, + GElf_Addr address, GElf_Sym *sym, + GElf_Word *shndxp, Elf **elfp) + __nonnull_attribute__ (3); + /* Find the ELF section that *ADDRESS lies inside and return it. On success, adjusts *ADDRESS to be relative to the section, and sets *BIAS to the difference between addresses used in diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index b8a64d8..b437c71 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -648,10 +648,12 @@ INTDECL (dwfl_getmodules) INTDECL (dwfl_module_addrdie) INTDECL (dwfl_module_address_section) INTDECL (dwfl_module_addrsym) +INTDECL (dwfl_module_addrsym_elf) INTDECL (dwfl_module_build_id) INTDECL (dwfl_module_getdwarf) INTDECL (dwfl_module_getelf) INTDECL (dwfl_module_getsym) +INTDECL (dwfl_module_getsym_elf) INTDECL (dwfl_module_getsymtab) INTDECL (dwfl_module_getsrc) INTDECL (dwfl_module_report_build_id) diff --git a/tests/ChangeLog b/tests/ChangeLog index 9a8ac61..9eaadfc 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2013-11-26 Mark Wielaard <[email protected]> + + * dwflsyms.c (gelf_bind_order): New function. + (elf_section_name): Likewise. + (list_syms): Use dwfl_module_getsym_elf and dwfl_module_addrsym_elf. + Refine assert using gelf_bind_order. Print elf_section_name. + * run-dwflsyms.sh: Add section names to expected output. + 2013-11-18 Josh Stone <[email protected]> * testfilebazdbg_plr.bz2: New testfile. diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c index 55f2653..86b5e13 100644 --- a/tests/dwflsyms.c +++ b/tests/dwflsyms.c @@ -69,6 +69,33 @@ gelf_bind (GElf_Sym *sym) } static int +gelf_bind_order (GElf_Sym *sym) +{ + switch (GELF_ST_BIND (sym->st_info)) + { + case STB_LOCAL: + return 1; + case STB_WEAK: + return 2; + case STB_GLOBAL: + return 3; + default: + return 0; + } +} + +static const char * +elf_section_name (Elf *elf, GElf_Word shndx) +{ + GElf_Ehdr ehdr; + GElf_Shdr shdr; + Elf_Scn *scn = elf_getscn (elf, shndx); + gelf_getshdr (scn, &shdr); + gelf_getehdr (elf, &ehdr); + return elf_strptr (elf, ehdr.e_shstrndx, shdr.sh_name); +} + +static int list_syms (struct Dwfl_Module *mod, void **user __attribute__ ((unused)), const char *mod_name __attribute__ ((unused)), @@ -82,7 +109,9 @@ list_syms (struct Dwfl_Module *mod, { GElf_Sym sym; GElf_Word shndxp; - const char *name = dwfl_module_getsym (mod, ndx, &sym, &shndxp); + Elf *elf; + const char *name = dwfl_module_getsym_elf (mod, ndx, &sym, &shndxp, + &elf); printf("%4d: %s\t%s\t%s (%" PRIu64 ") %#" PRIx64, ndx, gelf_type (&sym), gelf_bind (&sym), name, sym.st_size, sym.st_value); @@ -95,12 +124,24 @@ list_syms (struct Dwfl_Module *mod, GElf_Addr addr = sym.st_value; GElf_Sym asym; GElf_Word ashndxp; - const char *aname = dwfl_module_addrsym (mod, addr, &asym, &ashndxp); - assert (strcmp (name, aname) == 0); + Elf *aelf; + const char *aname = dwfl_module_addrsym_elf (mod, addr, &asym, + &ashndxp, &aelf); + + /* Either they are the same symbol (name), the binding of + asym is "stronger" (or equal) to sym or asym is more specific + (has a lower address) than sym. */ + assert ((strcmp (name, aname) == 0 + || gelf_bind_order (&asym) >= gelf_bind_order (&sym)) + && asym.st_value <= sym.st_value); int res = dwfl_module_relocate_address (mod, &addr); assert (res != -1); - printf(", rel: %#" PRIx64 "", addr); + if (shndxp < SHN_LORESERVE) + printf(", rel: %#" PRIx64 " (%s)", addr, + elf_section_name (elf, shndxp)); + else + printf(", rel: %#" PRIx64 "", addr); } printf ("\n"); } diff --git a/tests/run-dwflsyms.sh b/tests/run-dwflsyms.sh index 2adec5a..3cd7bf3 100755 --- a/tests/run-dwflsyms.sh +++ b/tests/run-dwflsyms.sh @@ -72,17 +72,17 @@ cat > testfile.symtab.in <<\EOF 32: SECTION LOCAL (0) 0 33: FILE LOCAL crtstuff.c (0) 0 34: OBJECT LOCAL __JCR_LIST__ (0) 0x200de0 - 35: FUNC LOCAL deregister_tm_clones (0) 0x710, rel: 0x710 - 36: FUNC LOCAL register_tm_clones (0) 0x740, rel: 0x740 - 37: FUNC LOCAL __do_global_dtors_aux (0) 0x780, rel: 0x780 + 35: FUNC LOCAL deregister_tm_clones (0) 0x710, rel: 0x710 (.text) + 36: FUNC LOCAL register_tm_clones (0) 0x740, rel: 0x740 (.text) + 37: FUNC LOCAL __do_global_dtors_aux (0) 0x780, rel: 0x780 (.text) 38: OBJECT LOCAL completed.6137 (1) 0x20103c 39: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x200dd8 - 40: FUNC LOCAL frame_dummy (0) 0x7c0, rel: 0x7c0 + 40: FUNC LOCAL frame_dummy (0) 0x7c0, rel: 0x7c0 (.text) 41: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x200dd0 42: FILE LOCAL foo.c (0) 0 43: FILE LOCAL bar.c (0) 0 44: OBJECT LOCAL b1 (4) 0x201034 - 45: FUNC LOCAL foo (20) 0x814, rel: 0x814 + 45: FUNC LOCAL foo (20) 0x814, rel: 0x814 (.text) 46: FILE LOCAL crtstuff.c (0) 0 47: OBJECT LOCAL __FRAME_END__ (0) 0xa58 48: OBJECT LOCAL __JCR_END__ (0) 0x200de0 @@ -91,28 +91,28 @@ cat > testfile.symtab.in <<\EOF 51: OBJECT LOCAL _DYNAMIC (0) 0x200df0 52: NOTYPE LOCAL __init_array_start (0) 0x200dd0 53: OBJECT LOCAL _GLOBAL_OFFSET_TABLE_ (0) 0x201000 - 54: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 + 54: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text) 55: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0 56: NOTYPE WEAK data_start (0) 0x201030 57: NOTYPE GLOBAL _edata (0) 0x20103c - 58: FUNC GLOBAL bar (44) 0x828, rel: 0x828 - 59: FUNC GLOBAL _fini (0) 0x8f4, rel: 0x8f4 + 58: FUNC GLOBAL bar (44) 0x828, rel: 0x828 (.text) + 59: FUNC GLOBAL _fini (0) 0x8f4, rel: 0x8f4 (.fini) 60: FUNC GLOBAL __libc_start_main@@GLIBC_2.2.5 (0) 0 61: NOTYPE GLOBAL __data_start (0) 0x201030 62: NOTYPE WEAK __gmon_start__ (0) 0 63: OBJECT GLOBAL __dso_handle (0) 0x200de8 64: OBJECT GLOBAL _IO_stdin_used (4) 0x900 65: OBJECT GLOBAL b2 (4) 0x201038 - 66: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 + 66: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 (.text) 67: NOTYPE GLOBAL _end (0) 0x201040 - 68: FUNC GLOBAL _start (0) 0x6e0, rel: 0x6e0 + 68: FUNC GLOBAL _start (0) 0x6e0, rel: 0x6e0 (.text) 69: NOTYPE GLOBAL __bss_start (0) 0x20103c - 70: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 + 70: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 (.text) 71: NOTYPE WEAK _Jv_RegisterClasses (0) 0 72: OBJECT GLOBAL __TMC_END__ (0) 0x201040 73: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0 74: FUNC WEAK __cxa_finalize@@GLIBC_2.2.5 (0) 0 - 75: FUNC GLOBAL _init (0) 0x680, rel: 0x680 + 75: FUNC GLOBAL _init (0) 0x680, rel: 0x680 (.init) EOF cat > testfile.symtab_pl.in <<\EOF @@ -151,17 +151,17 @@ cat > testfile.symtab_pl.in <<\EOF 32: SECTION LOCAL (0) 0 33: FILE LOCAL crtstuff.c (0) 0 34: OBJECT LOCAL __JCR_LIST__ (0) 0x3000200de0 - 35: FUNC LOCAL deregister_tm_clones (0) 0x3000000710, rel: 0x710 - 36: FUNC LOCAL register_tm_clones (0) 0x3000000740, rel: 0x740 - 37: FUNC LOCAL __do_global_dtors_aux (0) 0x3000000780, rel: 0x780 + 35: FUNC LOCAL deregister_tm_clones (0) 0x3000000710, rel: 0x710 (.text) + 36: FUNC LOCAL register_tm_clones (0) 0x3000000740, rel: 0x740 (.text) + 37: FUNC LOCAL __do_global_dtors_aux (0) 0x3000000780, rel: 0x780 (.text) 38: OBJECT LOCAL completed.6137 (1) 0x300020103c 39: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x3000200dd8 - 40: FUNC LOCAL frame_dummy (0) 0x30000007c0, rel: 0x7c0 + 40: FUNC LOCAL frame_dummy (0) 0x30000007c0, rel: 0x7c0 (.text) 41: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x3000200dd0 42: FILE LOCAL foo.c (0) 0 43: FILE LOCAL bar.c (0) 0 44: OBJECT LOCAL b1 (4) 0x3000201034 - 45: FUNC LOCAL foo (20) 0x3000000814, rel: 0x814 + 45: FUNC LOCAL foo (20) 0x3000000814, rel: 0x814 (.text) 46: FILE LOCAL crtstuff.c (0) 0 47: OBJECT LOCAL __FRAME_END__ (0) 0x3000000a58 48: OBJECT LOCAL __JCR_END__ (0) 0x3000200de0 @@ -170,28 +170,28 @@ cat > testfile.symtab_pl.in <<\EOF 51: OBJECT LOCAL _DYNAMIC (0) 0x3000200df0 52: NOTYPE LOCAL __init_array_start (0) 0x3000200dd0 53: OBJECT LOCAL _GLOBAL_OFFSET_TABLE_ (0) 0x3000201000 - 54: FUNC GLOBAL __libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 + 54: FUNC GLOBAL __libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 (.text) 55: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0 56: NOTYPE WEAK data_start (0) 0x3000201030 57: NOTYPE GLOBAL _edata (0) 0x300020103c - 58: FUNC GLOBAL bar (44) 0x3000000828, rel: 0x828 - 59: FUNC GLOBAL _fini (0) 0x30000008f4, rel: 0x8f4 + 58: FUNC GLOBAL bar (44) 0x3000000828, rel: 0x828 (.text) + 59: FUNC GLOBAL _fini (0) 0x30000008f4, rel: 0x8f4 (.fini) 60: FUNC GLOBAL __libc_start_main@@GLIBC_2.2.5 (0) 0 61: NOTYPE GLOBAL __data_start (0) 0x3000201030 62: NOTYPE WEAK __gmon_start__ (0) 0 63: OBJECT GLOBAL __dso_handle (0) 0x3000200de8 64: OBJECT GLOBAL _IO_stdin_used (4) 0x3000000900 65: OBJECT GLOBAL b2 (4) 0x3000201038 - 66: FUNC GLOBAL __libc_csu_init (137) 0x3000000860, rel: 0x860 + 66: FUNC GLOBAL __libc_csu_init (137) 0x3000000860, rel: 0x860 (.text) 67: NOTYPE GLOBAL _end (0) 0x3000201040 - 68: FUNC GLOBAL _start (0) 0x30000006e0, rel: 0x6e0 + 68: FUNC GLOBAL _start (0) 0x30000006e0, rel: 0x6e0 (.text) 69: NOTYPE GLOBAL __bss_start (0) 0x300020103c - 70: FUNC GLOBAL main (35) 0x30000007f0, rel: 0x7f0 + 70: FUNC GLOBAL main (35) 0x30000007f0, rel: 0x7f0 (.text) 71: NOTYPE WEAK _Jv_RegisterClasses (0) 0 72: OBJECT GLOBAL __TMC_END__ (0) 0x3000201040 73: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0 74: FUNC WEAK __cxa_finalize@@GLIBC_2.2.5 (0) 0 - 75: FUNC GLOBAL _init (0) 0x3000000680, rel: 0x680 + 75: FUNC GLOBAL _init (0) 0x3000000680, rel: 0x680 (.init) EOF cat > testfile.dynsym.in <<\EOF @@ -205,22 +205,22 @@ cat > testfile.dynsym.in <<\EOF 7: FUNC WEAK __cxa_finalize (0) 0 8: NOTYPE GLOBAL _edata (0) 0x20103c 9: NOTYPE GLOBAL _end (0) 0x201040 - 10: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 + 10: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 (.text) 11: NOTYPE GLOBAL __bss_start (0) 0x20103c - 12: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 - 13: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 + 12: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 (.text) + 13: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text) EOF cat > testfile.minsym.in <<\EOF 0: NOTYPE LOCAL (0) 0 1: SECTION LOCAL (0) 0x238 - 2: FUNC LOCAL deregister_tm_clones (0) 0x710, rel: 0x710 - 3: FUNC LOCAL register_tm_clones (0) 0x740, rel: 0x740 - 4: FUNC LOCAL __do_global_dtors_aux (0) 0x780, rel: 0x780 + 2: FUNC LOCAL deregister_tm_clones (0) 0x710, rel: 0x710 (.text) + 3: FUNC LOCAL register_tm_clones (0) 0x740, rel: 0x740 (.text) + 4: FUNC LOCAL __do_global_dtors_aux (0) 0x780, rel: 0x780 (.text) 5: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x200dd8 - 6: FUNC LOCAL frame_dummy (0) 0x7c0, rel: 0x7c0 + 6: FUNC LOCAL frame_dummy (0) 0x7c0, rel: 0x7c0 (.text) 7: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x200dd0 - 8: FUNC LOCAL foo (20) 0x814, rel: 0x814 + 8: FUNC LOCAL foo (20) 0x814, rel: 0x814 (.text) 9: NOTYPE LOCAL __init_array_end (0) 0x200dd8 10: NOTYPE LOCAL __init_array_start (0) 0x200dd0 11: SECTION LOCAL (0) 0x238 @@ -257,26 +257,26 @@ cat > testfile.minsym.in <<\EOF 42: FUNC WEAK __cxa_finalize (0) 0 43: NOTYPE GLOBAL _edata (0) 0x20103c 44: NOTYPE GLOBAL _end (0) 0x201040 - 45: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 + 45: FUNC GLOBAL __libc_csu_init (137) 0x860, rel: 0x860 (.text) 46: NOTYPE GLOBAL __bss_start (0) 0x20103c - 47: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 - 48: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 - 49: FUNC GLOBAL bar (44) 0x828, rel: 0x828 - 50: FUNC GLOBAL _fini (0) 0x8f4, rel: 0x8f4 - 51: FUNC GLOBAL _start (0) 0x6e0, rel: 0x6e0 - 52: FUNC GLOBAL _init (0) 0x680, rel: 0x680 + 47: FUNC GLOBAL main (35) 0x7f0, rel: 0x7f0 (.text) + 48: FUNC GLOBAL __libc_csu_fini (2) 0x8f0, rel: 0x8f0 (.text) + 49: FUNC GLOBAL bar (44) 0x828, rel: 0x828 (.text) + 50: FUNC GLOBAL _fini (0) 0x8f4, rel: 0x8f4 (.fini) + 51: FUNC GLOBAL _start (0) 0x6e0, rel: 0x6e0 (.text) + 52: FUNC GLOBAL _init (0) 0x680, rel: 0x680 (.init) EOF cat > testfile.minsym_pl.in <<\EOF 0: NOTYPE LOCAL (0) 0 1: SECTION LOCAL (0) 0x3000000238 - 2: FUNC LOCAL deregister_tm_clones (0) 0x3000000710, rel: 0x710 - 3: FUNC LOCAL register_tm_clones (0) 0x3000000740, rel: 0x740 - 4: FUNC LOCAL __do_global_dtors_aux (0) 0x3000000780, rel: 0x780 + 2: FUNC LOCAL deregister_tm_clones (0) 0x3000000710, rel: 0x710 (.text) + 3: FUNC LOCAL register_tm_clones (0) 0x3000000740, rel: 0x740 (.text) + 4: FUNC LOCAL __do_global_dtors_aux (0) 0x3000000780, rel: 0x780 (.text) 5: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x3000200dd8 - 6: FUNC LOCAL frame_dummy (0) 0x30000007c0, rel: 0x7c0 + 6: FUNC LOCAL frame_dummy (0) 0x30000007c0, rel: 0x7c0 (.text) 7: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x3000200dd0 - 8: FUNC LOCAL foo (20) 0x3000000814, rel: 0x814 + 8: FUNC LOCAL foo (20) 0x3000000814, rel: 0x814 (.text) 9: NOTYPE LOCAL __init_array_end (0) 0x3000200dd8 10: NOTYPE LOCAL __init_array_start (0) 0x3000200dd0 11: SECTION LOCAL (0) 0x3000000238 @@ -313,14 +313,14 @@ cat > testfile.minsym_pl.in <<\EOF 42: FUNC WEAK __cxa_finalize (0) 0 43: NOTYPE GLOBAL _edata (0) 0x300020103c 44: NOTYPE GLOBAL _end (0) 0x3000201040 - 45: FUNC GLOBAL __libc_csu_init (137) 0x3000000860, rel: 0x860 + 45: FUNC GLOBAL __libc_csu_init (137) 0x3000000860, rel: 0x860 (.text) 46: NOTYPE GLOBAL __bss_start (0) 0x300020103c - 47: FUNC GLOBAL main (35) 0x30000007f0, rel: 0x7f0 - 48: FUNC GLOBAL __libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 - 49: FUNC GLOBAL bar (44) 0x3000000828, rel: 0x828 - 50: FUNC GLOBAL _fini (0) 0x30000008f4, rel: 0x8f4 - 51: FUNC GLOBAL _start (0) 0x30000006e0, rel: 0x6e0 - 52: FUNC GLOBAL _init (0) 0x3000000680, rel: 0x680 + 47: FUNC GLOBAL main (35) 0x30000007f0, rel: 0x7f0 (.text) + 48: FUNC GLOBAL __libc_csu_fini (2) 0x30000008f0, rel: 0x8f0 (.text) + 49: FUNC GLOBAL bar (44) 0x3000000828, rel: 0x828 (.text) + 50: FUNC GLOBAL _fini (0) 0x30000008f4, rel: 0x8f4 (.fini) + 51: FUNC GLOBAL _start (0) 0x30000006e0, rel: 0x6e0 (.text) + 52: FUNC GLOBAL _init (0) 0x3000000680, rel: 0x680 (.init) EOF cat testfile.symtab.in \ @@ -352,14 +352,14 @@ sed s/0x3000/0x4200/g testfile.minsym_pl.in \ testrun_compare ${abs_builddir}/dwflsyms -e testfilebasmin <<\EOF 0: NOTYPE LOCAL (0) 0 - 1: FUNC LOCAL foo (18) 0x400168, rel: 0x400168 + 1: FUNC LOCAL foo (18) 0x400168, rel: 0x400168 (.text) 2: SECTION LOCAL (0) 0x400120 3: SECTION LOCAL (0) 0x400144 4: SECTION LOCAL (0) 0x4001c0 5: SECTION LOCAL (0) 0x600258 - 6: FUNC GLOBAL _start (21) 0x4001a8, rel: 0x4001a8 - 7: FUNC GLOBAL main (33) 0x400144, rel: 0x400144 - 8: FUNC GLOBAL bar (44) 0x40017a, rel: 0x40017a + 6: FUNC GLOBAL _start (21) 0x4001a8, rel: 0x4001a8 (.text) + 7: FUNC GLOBAL main (33) 0x400144, rel: 0x400144 (.text) + 8: FUNC GLOBAL bar (44) 0x40017a, rel: 0x40017a (.text) EOF exit 0 -- 1.7.1
