[PATCH] D36499: If --dynamic-list is given, only those symbols are preemptible

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 10:44:46 PDT 2017

Yup, that's the use case I was thinking of. The combination of -dynamic-list
and -version-script wouldn't make any sense for an executable, where
-dynamic-list does in fact control dynamic symbol population, but it can be
useful for a shared library. Thanks!

It's pretty unfortunate -dynamic-list means entirely different things
depending on if an executable or a shared library is being built.

On 8/10/17, 8:53 AM, "llvm-commits on behalf of Rafael Avila de Espindola via llvm-commits" <llvm-commits-bounces at lists.llvm.org on behalf of llvm-commits at lists.llvm.org> wrote:

    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
    I will try to fix this to handle your testcase.
    >   # 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://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D36499&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=o-eIbQE7YRS5flg88ZHYd9022YENyIVVPTixeygqUS0&s=8jQh3W4UTy0e_8kG4ZLRukI7CEILzmzsAqDMrqoQ7vY&e= 
    llvm-commits mailing list
    llvm-commits at lists.llvm.org

More information about the llvm-commits mailing list