summaryrefslogtreecommitdiff
path: root/test/elf/initfini-options.test-2.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/elf/initfini-options.test-2.test')
-rw-r--r--test/elf/initfini-options.test-2.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/elf/initfini-options.test-2.test b/test/elf/initfini-options.test-2.test
new file mode 100644
index 0000000000000..4742084c513bf
--- /dev/null
+++ b/test/elf/initfini-options.test-2.test
@@ -0,0 +1,47 @@
+# Check that if _init/_fini symbols are defined the linker emits
+# DT_INIT/DT_FINI tags point to these symbols.
+
+# RUN: yaml2obj -format=elf %s > %t.o
+# RUN: lld -flavor gnu -target x86_64 -shared -o %t.so %t.o
+# RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s
+
+# CHECK: Name: _init (8)
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
+# CHECK: Name: _fini (14)
+# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
+#
+# CHECK: 0x000000000000000C INIT {{[0x0-9a-f]+}}
+# CHECK: 0x000000000000000D FINI {{[0x0-9a-f]+}}
+
+---
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x04
+ Size: 0x18
+
+Symbols:
+ Global:
+ - Name: _start
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x0
+ Size: 0x8
+ - Name: _init
+ Type: STT_FUNC
+ Section: .text
+ Value: 0x8
+ Size: 0x8
+ - Name: _fini
+ Type: STT_FUNC
+ Section: .text
+ Value: 0xF
+ Size: 0x8
+...