This is PR34053.
The implementation is a bit of a hack, given the precise location where IsPreemtible is set, it cannot be used from SymbolTable::handleAnonymousVersion.
I could add another method to SymbolTable if you think that would be better.
 Differential  D36499  
If --dynamic-list is given, only those symbols are preemptible Authored by • rafael on Aug 8 2017, 6:11 PM. 
Details This is PR34053. The implementation is a bit of a hack, given the precise location where IsPreemtible is set, it cannot be used from SymbolTable::handleAnonymousVersion. I could add another method to SymbolTable if you think that would be better. 
Diff Detail 
 Event TimelineComment Actions 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. # 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@PLT
	call	bar@PLT
 Comment Actions Fix iteration with version scripts. It is now possible to use version scripts to decide which symbols are globals and --dynamic-list to pick which of those are also preemptible. Comment Actions This was committed in r311468 and reverted in r311497 because it broke bots. I'm re-opening now that @rafael is back from vacation.  | ||||||