[lld] r312812 - Handle lazy symbols is computeIsPreemptible.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 14:39:26 PDT 2017


On Fri, Sep 8, 2017 at 11:41 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Fri Sep  8 11:41:49 2017
> New Revision: 312812
>
> URL: http://llvm.org/viewvc/llvm-project?rev=312812&view=rev
> Log:
> Handle lazy symbols is computeIsPreemptible.
>
> Added:
>     lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s
>     lld/trunk/test/ELF/dynamic-list-weak-archive.s
> Modified:
>     lld/trunk/ELF/Writer.cpp
>
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.
> cpp?rev=312812&r1=312811&r2=312812&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Fri Sep  8 11:41:49 2017
> @@ -1240,7 +1240,7 @@ static bool computeIsPreemptible(const S
>    // executables are automatically exported so that the runtime linker
>    // can try to resolve them. In that case, they are preemptible. So, we
>    // return true for an undefined symbols in all cases.
> -  if (B.isUndefined() || B.isShared())
> +  if (!B.isInCurrentDSO())
>      return true;
>

The comment here probably needs some updating.

-- Sean Silva


>
>    // If we have a dynamic list it specifies which local symbols are
> preemptible.
>
> Added: lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/
> Inputs/dynamic-list-weak-archive.s?rev=312812&view=auto
> ============================================================
> ==================
> --- lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s (added)
> +++ lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s Fri Sep  8
> 11:41:49 2017
> @@ -0,0 +1,2 @@
> +.globl foo
> +foo:
>
> Added: lld/trunk/test/ELF/dynamic-list-weak-archive.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/
> dynamic-list-weak-archive.s?rev=312812&view=auto
> ============================================================
> ==================
> --- lld/trunk/test/ELF/dynamic-list-weak-archive.s (added)
> +++ lld/trunk/test/ELF/dynamic-list-weak-archive.s Fri Sep  8 11:41:49
> 2017
> @@ -0,0 +1,18 @@
> +# REQUIRES: x86
> +
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux
> %S/Inputs/dynamic-list-weak-archive.s -o %t2.o
> +# RUN: rm -f %t.a
> +# RUN: llvm-ar rcs %t.a %t2.o
> +# RUN: echo "{ zed; };" > %t.list
> +# RUN: ld.lld -shared --dynamic-list %t.list %t1.o %t.a -o %t.so
> +# RUN: llvm-readobj -r %t.so | FileCheck %s
> +
> +# CHECK:      Relocations [
> +# CHECK-NEXT:   Section ({{.*}}) .rela.plt {
> +# CHECK-NEXT:     0x2018 R_X86_64_JUMP_SLOT foo
> +# CHECK-NEXT:   }
> +# CHECK-NEXT: ]
> +
> +callq foo at PLT
> +.weak foo
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170908/01b3ccdb/attachment.html>


More information about the llvm-commits mailing list