Fix handling of _start being undefined.

We were crashing before.

llvm-svn: 247481
This commit is contained in:
Rafael Espindola 2015-09-11 21:44:55 +00:00
parent 9d08009dff
commit 1d12ab3db1
2 changed files with 7 additions and 2 deletions

View File

@ -476,8 +476,6 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
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>::createSections() {
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))

View File

@ -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