Skip to content

Commit

Permalink
Don't create dynamic relocations for weak undefined symbols.
Browse files Browse the repository at this point in the history
llvm-svn: 249520
  • Loading branch information
espindola committed Oct 7, 2015
1 parent 55bbe66 commit cea0b3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lld/ELF/OutputSections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions lld/test/elf2/dynamic-reloc.s
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@
.global _start
_start:
.quad bar + 0x42
.weak foo
.quad foo
call main

0 comments on commit cea0b3b

Please sign in to comment.