llvm-project/lld/test/elf/initfini-options.test-3.test

54 lines
1.4 KiB
Plaintext

# Check that -init/-fini command line options override default function names
# and the linker uses these name to search symbols and setup DT_INIT/DT_FINI.
# RUN: yaml2obj -format=elf %s > %t.o
# RUN: lld -flavor gnu -target x86_64 -shared -o %t.so %t.o \
# RUN: -init _init -init _start -fini _fini -fini _stop
# RUN: llvm-readobj -symbols -dynamic-table %t.so | FileCheck %s
# CHECK: Name: _start (1)
# CHECK-NEXT: Value: {{[0x0-9a-f]+}}
# CHECK: Name: _stop (8)
# 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: 0x20
Symbols:
Global:
- Name: _start
Type: STT_FUNC
Section: .text
Value: 0x0
Size: 0x8
- Name: _stop
Type: STT_FUNC
Section: .text
Value: 0x8
Size: 0x8
- Name: _init
Type: STT_FUNC
Section: .text
Value: 0xF
Size: 0x8
- Name: _fini
Type: STT_FUNC
Section: .text
Value: 0x18
Size: 0x8
...