2016-04-14 02:51:11 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/shared.s -o %t2.o
|
2017-10-06 17:37:44 +08:00
|
|
|
# RUN: ld.lld --hash-style=sysv -shared %t2.o -soname shared -o %t2.so
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
|
2016-04-14 02:51:11 +08:00
|
|
|
|
|
|
|
## Check exporting only one symbol.
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: echo '{ foo1; };' > %t.list
|
|
|
|
# RUN: ld.lld --dynamic-list %t.list %t.o %t2.so -o %t
|
2019-09-07 06:51:46 +08:00
|
|
|
# RUN: llvm-nm -D %t | FileCheck %s --implicit-check-not=foo
|
2016-04-14 02:51:11 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
## And now using quoted strings (the output is the same since it does not
|
2016-04-14 02:51:11 +08:00
|
|
|
## use any wildcard character).
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: echo '{ "foo1"; };' > %t.list
|
|
|
|
# RUN: ld.lld --dynamic-list %t.list %t.o %t2.so -o %t2
|
|
|
|
# RUN: cmp %t %t2
|
2016-04-14 02:51:11 +08:00
|
|
|
|
2016-04-23 02:44:06 +08:00
|
|
|
## And now using --export-dynamic-symbol.
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: ld.lld --export-dynamic-symbol foo1 %t.o %t2.so -o %t2
|
|
|
|
# RUN: cmp %t %t2
|
|
|
|
# RUN: ld.lld --export-dynamic-symbol=foo1 %t.o %t2.so -o %t2
|
|
|
|
# RUN: cmp %t %t2
|
2016-04-14 02:51:11 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
# CHECK: foo1
|
2016-04-14 02:51:11 +08:00
|
|
|
|
|
|
|
## Now export all the foo1, foo2, and foo31 symbols
|
|
|
|
# RUN: echo "{ foo1; foo2; foo31; };" > %t.list
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: ld.lld --dynamic-list %t.list %t.o %t2.so -o %t
|
2019-09-07 06:51:46 +08:00
|
|
|
# RUN: llvm-nm -D %t | FileCheck --check-prefix=CHECK2 %s --implicit-check-not=foo
|
2017-02-14 02:31:12 +08:00
|
|
|
# RUN: echo "{ foo1; foo2; };" > %t1.list
|
|
|
|
# RUN: echo "{ foo31; };" > %t2.list
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: ld.lld --dynamic-list %t1.list --dynamic-list %t2.list %t.o %t2.so -o %t2
|
|
|
|
# RUN: cmp %t %t2
|
2016-04-14 02:51:11 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
# CHECK2: foo1
|
|
|
|
# CHECK2-NEXT: foo2
|
|
|
|
# CHECK2-NEXT: foo31
|
2017-04-12 06:37:54 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
## --export-dynamic is similar to --dynamic-list with '{ * }'
|
2017-04-12 06:37:54 +08:00
|
|
|
# RUN: echo "{ foo2; };" > %t.list
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: ld.lld --dynamic-list %t.list --export-dynamic %t.o %t2.so -o %t
|
2019-09-07 06:51:46 +08:00
|
|
|
# RUN: llvm-nm -D %t | FileCheck --check-prefix=CHECK3 %s --implicit-check-not=foo
|
2017-04-12 06:37:54 +08:00
|
|
|
|
|
|
|
## The same with --export-dynamic-symbol.
|
2019-09-06 23:10:31 +08:00
|
|
|
# RUN: ld.lld --export-dynamic-symbol=foo2 --export-dynamic %t.o %t2.so -o %t2
|
|
|
|
# RUN: cmp %t %t2
|
2017-04-12 06:37:54 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
# CHECK3: _start
|
|
|
|
# CHECK3-NEXT: foo1
|
|
|
|
# CHECK3-NEXT: foo2
|
|
|
|
# CHECK3-NEXT: foo31
|
2017-04-12 06:37:54 +08:00
|
|
|
|
2019-09-06 23:10:31 +08:00
|
|
|
.globl _start, foo1, foo2, foo31
|
2016-04-14 02:51:11 +08:00
|
|
|
foo1:
|
|
|
|
foo2:
|
|
|
|
foo31:
|
|
|
|
_start:
|