Hi,

This small patch to readelf.c displays the library name from which a 
dynamic symbol of specific version should be resolved.


=====
diff --git a/src/readelf.c b/src/readelf.c
index 5255860..c8c37f0 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -2068,9 +2068,11 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)

                  if (vernaux != NULL && vernaux->vna_other == *versym)
                    {
-                     printf ("@%s (%u)",
+                     printf ("@%s %s (%u)",
                              elf_strptr (ebl->elf, verneed_stridx,
                                          vernaux->vna_name),
+                             elf_strptr (ebl->elf, verneed_stridx,
+                                         verneed->vn_file),
                              (unsigned int) vernaux->vna_other);
                      check_def = 0;
                    }
=====

Sample output: (edited to fit in space) looks like

=====
$ ./readelf -s ar

    0: ...  DEFAULT    UNDEF
    1: ...  DEFAULT UNDEF __errno_locat...@glibc_2.0 libc.so.6 (2)
    2: ...  DEFAULT UNDEF gelf_get...@elfutils_1.0 libelf.so.1 (3)
    3: ...  DEFAULT UNDEF basen...@glibc_2.0 libc.so.6 (2)
    4: ...  DEFAULT UNDEF elf_str...@elfutils_1.0 libelf.so.1 (3)
    5: ...  DEFAULT UNDEF sysc...@glibc_2.0 libc.so.6 (2)
    6: ...  DEFAULT UNDEF mem...@glibc_2.0 libc.so.6 (2)
    7: ...  DEFAULT UNDEF ope...@glibc_2.1 libc.so.6 (4)
    8: ...  DEFAULT UNDEF elf_getd...@elfutils_1.0 libelf.so.1 (3)
    9: ...  DEFAULT UNDEF __fsetlock...@glibc_2.2 libc.so.6 (5)

    ...

=====


I would really appreciate it if it gets accepted for the main branch, as 
that'll be a lot of help to me.


Thank you.
--
Regards
   - Prasad
_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel

Reply via email to