[lld] r249520 - Don't create dynamic relocations for weak undefined symbols.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 21:48:29 PDT 2015


With this change all llvm and clang tests pass when built with lld.

Amusingly the only failures now in check-all are lld's :-)

On 7 October 2015 at 00:22, Rafael Espindola via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Tue Oct  6 23:22:55 2015
> New Revision: 249520
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249520&view=rev
> Log:
> Don't create dynamic relocations for weak undefined symbols.
>
> Modified:
>     lld/trunk/ELF/OutputSections.cpp
>     lld/trunk/test/elf2/dynamic-reloc.s
>
> Modified: lld/trunk/ELF/OutputSections.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=249520&r1=249519&r2=249520&view=diff
> ==============================================================================
> --- lld/trunk/ELF/OutputSections.cpp (original)
> +++ lld/trunk/ELF/OutputSections.cpp Tue Oct  6 23:22:55 2015
> @@ -413,7 +413,9 @@ lld::elf2::getLocalSymVA(const typename
>  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;
>
> Modified: lld/trunk/test/elf2/dynamic-reloc.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf2/dynamic-reloc.s?rev=249520&r1=249519&r2=249520&view=diff
> ==============================================================================
> --- lld/trunk/test/elf2/dynamic-reloc.s (original)
> +++ lld/trunk/test/elf2/dynamic-reloc.s Tue Oct  6 23:22:55 2015
> @@ -59,4 +59,6 @@
>  .global _start
>  _start:
>  .quad bar + 0x42
> +.weak foo
> +.quad foo
>  call main
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list