[lld] r289217 - Don't crash on an extra symbol in a version script.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 07:08:41 PST 2016
Author: rafael
Date: Fri Dec 9 09:08:40 2016
New Revision: 289217
URL: http://llvm.org/viewvc/llvm-project?rev=289217&view=rev
Log:
Don't crash on an extra symbol in a version script.
Added:
lld/trunk/test/ELF/version-script-missing.s
Modified:
lld/trunk/ELF/SymbolTable.cpp
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=289217&r1=289216&r2=289217&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Dec 9 09:08:40 2016
@@ -618,7 +618,8 @@ template <class ELFT> void SymbolTable<E
continue;
}
for (SymbolBody *B : find(Ver))
- B->symbol()->VersionId = VER_NDX_GLOBAL;
+ if (B)
+ B->symbol()->VersionId = VER_NDX_GLOBAL;
}
}
Added: lld/trunk/test/ELF/version-script-missing.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-missing.s?rev=289217&view=auto
==============================================================================
--- lld/trunk/test/ELF/version-script-missing.s (added)
+++ lld/trunk/test/ELF/version-script-missing.s Fri Dec 9 09:08:40 2016
@@ -0,0 +1,7 @@
+# REQUIRES: x86
+
+# We used to crash if a symbol in a version script was not in the symbol table.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: echo "{ foobar; };" > %t.script
+# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
More information about the llvm-commits
mailing list