llvm-project/lld/test/ELF/version-script-locals.s
George Rimar bb6c01e7c3 [ELF] - Add support for locals list in version script.
Previously we did not support anything except "local: *", patch changes that.

Actually GNU rules of proccessing wildcards are more complex than that (http://www.airs.com/blog/archives/300):
There are 2 iteration for wildcards, at first iteration "*" wildcards are ignored and handled at second iteration.

Since we previously decided not to implement such complex rules,
I suggest solution that is implemented in this patch. So for "local: *" case nothing changes,
but if we have wildcarded locals,
they are processed before wildcarded globals. 

This should fix several FreeBSD ports, one of them is jpeg-turbo-1.5.1 and
currently blocks about 5k of ports.

Differential revision: https://reviews.llvm.org/D26395

llvm-svn: 286713
2016-11-12 07:04:15 +00:00

51 lines
1.3 KiB
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "VERSION_1.0 { local: foo1; };" > %t.script
# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=EXACT %s
# EXACT: DynamicSymbols [
# EXACT: _start
# EXACT-NOT: foo1
# EXACT: foo2
# EXACT: foo3
# RUN: echo "VERSION_1.0 { local: foo*; };" > %t.script
# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=WC %s
# WC: DynamicSymbols [
# WC: _start
# WC-NOT: foo1
# WC-NOT: foo2
# WC-NOT: foo3
# RUN: echo "VERSION_1.0 { global: *; local: foo*; };" > %t.script
# RUN: ld.lld --version-script %t.script -shared %t.o -o %t.so
# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck --check-prefix=MIX %s
# MIX: DynamicSymbols [
# MIX: _start@@VERSION_1.0
# MIX-NOT: foo1
# MIX-NOT: foo2
# MIX-NOT: foo3
# RUN: echo "VERSION_1.0 { global: *; local: extern \"C++\" { foo*; } };" > %t.script
# RUN: not ld.lld --version-script %t.script -shared %t.o -o %t.so 2>&1 \
# RUN: | FileCheck --check-prefix=EXTERNERR %s
# EXTERNERR: ; expected, but got "C++"
.globl foo1
foo1:
ret
.globl foo2
foo2:
ret
.globl foo3
foo3:
ret
.globl _start
_start:
ret