llvm-project/lld/test/elf/start-stop-sym.test

109 lines
2.6 KiB
Plaintext

# Check __start_XXX and __stop_XXX symbols handling where XXX
# is a section name which can be represented as a C identifier.
# RUN: yaml2obj -format=elf -docnum 1 %s > %t1.o
# RUN: yaml2obj -format=elf -docnum 2 %s > %t2.o
# RUN: lld -flavor gnu -target mipsel -static -e T0 -o %t.exe %t1.o %t2.o
# RUN: llvm-objdump -s -t %t.exe | FileCheck %s
# CHECK: Contents of section .text:
# CHECK-NEXT: 400080 a0004000 b4004000 00000000 00000000
# ^ start of _csec section
# ^ end of _csec section
# CHECK-NEXT: 400090 a0004000 b4004000
# CHECK-NEXT: Contents of section _csec:
# CHECK-NEXT: 4000a0 00000000 00000000 00000000 00000000
# CHECK-NEXT: 4000b0 00000000
# CHECK: 004000a0 g *ABS* 00000000 __start__csec
# CHECK: 004000b4 g *ABS* 00000000 __stop__csec
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 16
Size: 8
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 0
Symbol: __start__csec
Type: R_MIPS_32
- Offset: 4
Symbol: __stop__csec
Type: R_MIPS_32
- Name: _csec
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 16
Size: 4
Symbols:
Weak:
- Name: __start__csec
- Name: __stop__csec
Global:
- Name: T0
Type: STT_FUNC
Section: .text
Size: 8
---
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Flags: [EF_MIPS_CPIC, EF_MIPS_ABI_O32, EF_MIPS_ARCH_32]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 16
Size: 8
- Name: .rel.text
Type: SHT_REL
Link: .symtab
AddressAlign: 4
Info: .text
Relocations:
- Offset: 0
Symbol: __start__csec
Type: R_MIPS_32
- Offset: 4
Symbol: __stop__csec
Type: R_MIPS_32
- Name: _csec
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
AddressAlign: 16
Size: 4
Symbols:
Weak:
- Name: __start__csec
- Name: __stop__csec
Global:
- Name: T1
Type: STT_FUNC
Section: .text
Size: 8
...