Avoid recursive calls to init (we would crash).
llvm-svn: 249412
This commit is contained in:
parent
d76603fbe7
commit
b90582dbbd
|
@ -143,21 +143,24 @@ template <class ELFT> void SymbolTable::init(uint16_t EMachine) {
|
|||
}
|
||||
|
||||
template <class ELFT> void SymbolTable::addELFFile(ELFFileBase *File) {
|
||||
if (const ELFFileBase *Old = getFirstELF()) {
|
||||
if (!Old->isCompatibleWith(*File))
|
||||
const ELFFileBase *Old = getFirstELF();
|
||||
if (Old && !Old->isCompatibleWith(*File))
|
||||
error(Twine(Old->getName() + " is incompatible with " + File->getName()));
|
||||
} else {
|
||||
|
||||
if (auto *O = dyn_cast<ObjectFileBase>(File))
|
||||
ObjectFiles.emplace_back(O);
|
||||
else if (auto *S = dyn_cast<SharedFile<ELFT>>(File))
|
||||
SharedFiles.emplace_back(S);
|
||||
|
||||
if (!Old)
|
||||
init<ELFT>(File->getEMachine());
|
||||
}
|
||||
|
||||
if (auto *O = dyn_cast<ObjectFileBase>(File)) {
|
||||
ObjectFiles.emplace_back(O);
|
||||
for (SymbolBody *Body : O->getSymbols())
|
||||
resolve<ELFT>(Body);
|
||||
}
|
||||
|
||||
if (auto *S = dyn_cast<SharedFile<ELFT>>(File)) {
|
||||
SharedFiles.emplace_back(S);
|
||||
for (SharedSymbol<ELFT> &Body : S->getSharedSymbols())
|
||||
resolve<ELFT>(&Body);
|
||||
}
|
||||
|
|
|
@ -23,3 +23,11 @@
|
|||
# CHECK-NEXT: T bar
|
||||
# CHECK-NEXT: T end
|
||||
# CHECK-NEXT: w foo
|
||||
|
||||
|
||||
# Test that the hitting the first object file after having a lazy symbol for
|
||||
# _start is handled correctly.
|
||||
# RUN: lld -flavor gnu2 %tar %t -o %tout
|
||||
# RUN: llvm-nm %tout | FileCheck --check-prefix=AR-FIRST %s
|
||||
|
||||
# AR-FIRST: T _start
|
||||
|
|
Loading…
Reference in New Issue