[ELF] Dont add local symbols for dynamic lookup.
authorShankar Easwaran <shankare@codeaurora.org>
Fri, 20 Mar 2015 23:47:05 +0000 (23:47 +0000)
committerShankar Easwaran <shankare@codeaurora.org>
Fri, 20 Mar 2015 23:47:05 +0000 (23:47 +0000)
Unable to add a unit test for this, as there is only one local undefined
symbol in regular shared libraries without a name.

llvm-svn: 232867

lld/lib/ReaderWriter/ELF/DynamicFile.h

index 8a30d9f..c4e3e71 100644 (file)
@@ -64,6 +64,11 @@ protected:
       if ((ec = name.getError()))
         return ec;
 
+      // Dont add local symbols to dynamic entries. The first symbol in the
+      // dynamic symbol table is a local symbol.
+      if (i->getBinding() == llvm::ELF::STB_LOCAL)
+        continue;
+
       // TODO: Add absolute symbols
       if (i->st_shndx == llvm::ELF::SHN_ABS)
         continue;