[PATCH] D24363: [ELF] Fix DT_NEEDED value

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 13:51:18 PDT 2016


davide updated this revision to Diff 70746.

https://reviews.llvm.org/D24363

Files:
  ELF/InputFiles.cpp
  test/ELF/as-needed-no-reloc.s
  test/ELF/shared.s

Index: test/ELF/shared.s
===================================================================
--- test/ELF/shared.s
+++ test/ELF/shared.s
@@ -119,7 +119,7 @@
 // CHECK-NEXT:   EntrySize: 8
 // CHECK-NEXT:   SectionData (
 // CHECK:        )
-// CHECK-NEXT: }
+// CHECK: }
 
 // CHECK:      Name: .symtab
 // CHECK-NEXT: Type: SHT_SYMTAB
Index: test/ELF/as-needed-no-reloc.s
===================================================================
--- test/ELF/as-needed-no-reloc.s
+++ test/ELF/as-needed-no-reloc.s
@@ -16,7 +16,7 @@
 # CHECK-NEXT: Other: 0
 # CHECK-NEXT: Section: Undefined
 
-# CHECK: NEEDED SharedLibrary ({{.*}}2.so)
+# CHECK: NEEDED SharedLibrary (as-needed-no-reloc{{.*}}2.so)
 
         .globl _start
 _start:
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -20,6 +20,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Path.h"
 
 using namespace llvm;
 using namespace llvm::ELF;
@@ -477,7 +478,7 @@
   }
 
   this->initStringTable();
-  SoName = this->getName();
+  SoName = sys::path::filename(this->getName());
 
   if (!DynamicSec)
     return;
@@ -490,7 +491,7 @@
       uintX_t Val = Dyn.getVal();
       if (Val >= this->StringTable.size())
         fatal(getFilename(this) + ": invalid DT_SONAME entry");
-      SoName = StringRef(this->StringTable.data() + Val);
+      SoName = sys::path::filename(StringRef(this->StringTable.data() + Val));
       return;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24363.70746.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160908/33f4115d/attachment.bin>


More information about the llvm-commits mailing list