Don't create dynamic relocations for weak undefined symbols.

llvm-svn: 249520
This commit is contained in:
Rafael Espindola 2015-10-07 04:22:55 +00:00
parent 55bbe664bd
commit cea0b3b45d
2 changed files with 5 additions and 1 deletions

View File

@ -413,7 +413,9 @@ lld::elf2::getLocalSymVA(const typename ELFFile<ELFT>::Elf_Sym *Sym,
bool lld::elf2::canBePreempted(const SymbolBody *Body) {
if (!Body)
return false;
if (Body->isShared() || Body->isUndefined())
if (Body->isShared())
return true;
if (Body->isUndefined() && !Body->isWeak())
return true;
if (!Config->Shared)
return false;

View File

@ -59,4 +59,6 @@
.global _start
_start:
.quad bar + 0x42
.weak foo
.quad foo
call main