[lld] r247481 - Fix handling of _start being undefined.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 14:44:55 PDT 2015
Author: rafael
Date: Fri Sep 11 16:44:55 2015
New Revision: 247481
URL: http://llvm.org/viewvc/llvm-project?rev=247481&view=rev
Log:
Fix handling of _start being undefined.
We were crashing before.
Added:
lld/trunk/test/elf2/undef-start.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=247481&r1=247480&r2=247481&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep 11 16:44:55 2015
@@ -476,8 +476,6 @@ template <class ELFT> void SymbolTableSe
Out = &W.getBSS();
break;
case SymbolBody::UndefinedKind:
- if (!Body->isWeak())
- error(Twine("undefined symbol: ") + Name);
case SymbolBody::DefinedAbsoluteKind:
case SymbolBody::SharedKind:
break;
@@ -614,6 +612,9 @@ template <class ELFT> void Writer<ELFT>:
for (auto &P : Symtab.getSymbols()) {
StringRef Name = P.first;
SymbolBody *Body = P.second->Body;
+ if (Body->isStrongUndefined())
+ error(Twine("undefined symbol: ") + Name);
+
if (auto *C = dyn_cast<DefinedCommon<ELFT>>(Body))
CommonSymbols.push_back(C);
if (!includeInSymtab(*Body))
Added: lld/trunk/test/elf2/undef-start.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/undef-start.s?rev=247481&view=auto
==============================================================================
--- lld/trunk/test/elf2/undef-start.s (added)
+++ lld/trunk/test/elf2/undef-start.s Fri Sep 11 16:44:55 2015
@@ -0,0 +1,4 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: not lld -flavor gnu2 %t -o %t2 2>&1 | FileCheck %s
+# CHECK: undefined symbol: _start
+# REQUIRES: x86
More information about the llvm-commits
mailing list