2 // RUN
: llvm-mc
-filetype
=obj
-triple
=x86_64-unknown-linux
%s
-o
%t
4 // Should use
"_init" and "_fini" by default when fills dynamic table
5 // RUN
: ld.lld
-shared
%t -o
%t2
6 // RUN
: llvm-readobj
--dynamic-table
%t2 | FileCheck
--check-prefix
=BYDEF
%s
10 // -init
and -fini override symbols to use
11 // RUN
: ld.lld
-shared
%t -o
%t2
-init _foo
-fini _bar
12 // RUN
: llvm-readobj
--dynamic-table
%t2 | FileCheck
--check-prefix
=OVR
%s
16 // Check aliases as well
17 // RUN
: ld.lld
-shared
%t -o
%t2
-init
=_foo
-fini
=_bar
18 // RUN
: llvm-readobj
--dynamic-table
%t2 | FileCheck
--check-prefix
=OVR
%s
20 // Don
't add an entry for undef. The freebsd dynamic linker doesn't
21 // check if the value is null. If it is
, it will just call the
23 // RUN
: ld.lld
-shared
%t -o
%t2
-init
=_undef
-fini
=_undef
24 // RUN
: llvm-readobj
--dynamic-table
%t2 | FileCheck
--check-prefix
=UNDEF
%s
28 // Don
't add an entry for shared. For the same reason as undef.
29 // RUN: ld.lld -shared %t -o %t.so
31 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t2.o
32 // RUN: ld.lld -shared %t2.o %t.so -o %t2
33 // RUN: llvm-readobj --dynamic-table %t2 | FileCheck --check-prefix=SHARED %s
37 // Should not add new entries to the symbol table
38 // and should not require given symbols to be resolved
39 // RUN: ld.lld -shared %t -o %t2 -init=_unknown -fini=_unknown
40 // RUN: llvm-readobj --symbols --dynamic-table %t2 | FileCheck --check-prefix=NOENTRY %s
41 // NOENTRY: DynamicSection [
46 // NOENTRY-NOT: Name: _unknown
49 // Should not add entries for "_init" and "_fini" to the symbol table
50 // if the symbols are defined in non-fetched archive members.
52 // RUN: llvm-ar rcs %t.a %t
53 // RUN: ld.lld -shared -m elf_x86_64 -e _unknown %t.a -o %t.so
54 // RUN: llvm-nm %t.so | \
55 // RUN: FileCheck %s --implicit-check-not=_init --implicit-check-not=_fini
57 .global _start,_init,_fini,_foo,_bar,_undef