[PATCH] D58707: [llvm-objdump] Should print strings when dumping DT_RPATH and DT_RUNPATH tags in dynamic section.

Xing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 27 01:33:05 PST 2019


Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar.
Herald added subscribers: llvm-commits, jfb, rupprecht.
Herald added a project: LLVM.

Before:

  Dynamic Section:
    NEEDED               libpthread.so.0
    ...
    NEEDED               ld-linux-x86-64.so.2
    RPATH                0x00000000001c2e61

After:

  Dynamic Section:
    NEEDED               libpthread.so.0
    ...
    NEEDED               ld-linux-x86-64.so.2
    RPATH                $ORIGIN/../lib

Only a small problem here, I have no idea on choosing test case. I see there's a test 
file(test/tools/llvm-objdump/private-headers-dynamic-section.test). But it has no DT_RPATH and DT_RUNPATH tags. Shall I replace the ELF file in the 
Inputs dir by a new one?


Repository:
  rL LLVM

https://reviews.llvm.org/D58707

Files:
  tools/llvm-objdump/ELFDump.cpp


Index: tools/llvm-objdump/ELFDump.cpp
===================================================================
--- tools/llvm-objdump/ELFDump.cpp
+++ tools/llvm-objdump/ELFDump.cpp
@@ -188,7 +188,8 @@
 
     const char *Fmt =
         ELFT::Is64Bits ? "0x%016" PRIx64 "\n" : "0x%08" PRIx64 "\n";
-    if (Dyn.d_tag == ELF::DT_NEEDED) {
+    if (Dyn.d_tag == ELF::DT_NEEDED || Dyn.d_tag == ELF::DT_RPATH ||
+        Dyn.d_tag == ELF::DT_RUNPATH) {
       Expected<StringRef> StrTabOrErr = getDynamicStrTab(Elf);
       if (StrTabOrErr) {
         const char *Data = StrTabOrErr.get().data();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58707.188503.patch
Type: text/x-patch
Size: 586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190227/e755eb9c/attachment.bin>


More information about the llvm-commits mailing list