[PATCH] D36499: If --dynamic-list is given, only those symbols are preemptible
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 10 08:53:41 PDT 2017
Shoaib Meenai via Phabricator <reviews at reviews.llvm.org> writes:
> smeenai added a comment.
>
> Thank you!
>
> One issue I have is that this still conflates version scripts and dynamic lists, whereas they're orthogonal concepts in my mind; a version script controls dynamic symbol table population, while a dynamic list (for a shared library) controls preemptibility. The test case below demonstrates this; it passes with ld.bfd and ld.gold.
I first thought of just disallowing the combination of -dynamic-list and
-version-scirpt, but I think I now realize it is a realistic use
case. One can want a few symbols exported, but only a subset of those
preemptible.
I will try to fix this to handle your testcase.
Thanks,
Rafael
> # REQUIRES: x86
>
> # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
> # RUN: echo "{ foo; };" > %t.list
> # RUN: echo "{ global: foo; bar; };" > %t.vers
> # RUN: ld.lld -fatal-warnings -dynamic-list %t.list -version-script %t.vers -shared %t.o -o %t.so
> # RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=RELOCS %s
> # RUN: llvm-nm -DU %t.so | FileCheck --check-prefix=DYNSYMS %s
>
> # RELOCS: Relocations [
> # RELOCS-NEXT: Section ({{.*}}) .rela.plt {
> # RELOCS-NEXT: R_X86_64_JUMP_SLOT foo 0x0
> # RELOCS-NEXT: }
> # RELOCS-NEXT: ]
>
> # DYNSYMS: bar
> # DYNSYMS-NEXT: foo
>
> .globl foo
> foo:
> ret
>
> .globl bar
> bar:
> ret
>
> call foo at PLT
> call bar at PLT
>
>
> https://reviews.llvm.org/D36499
More information about the llvm-commits
mailing list