llvm-project/lld/test/elf/AArch64/local-tls.test

185 lines
7.7 KiB
Plaintext

# Check for correct offsets when handling relocations for local TLS
# access (R_AARCH64_TLSLE_ADD_TPREL_HI12, R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
# RUN: yaml2obj -format=elf %s > %t-obj
# RUN: lld -flavor gnu -target arm64 --noinhibit-exec -o %t-exe %t-obj
# RUN: llvm-objdump -s -t %t-exe | FileCheck %s
# CHECK: Contents of section .text:
# CHECK-NEXT: 4001dc 48d03bd5 08010091 08610091 090140b9 H.;......a....@.
# \_ | | <foo1>:
# \_ | add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12)
# \_ add x8, x8, #0x18 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
# CHECK-NEXT: 4001ec e003092a c0035fd6 48d03bd5 08010091 ...*.._.H.;.....
# \_ | <foo2>:
# \_ add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12)
# CHECK-NEXT: 4001fc 08710091 090140b9 e003092a c0035fd6 .q....@....*.._.
# \_ add x8, x8, #0x1c (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
# CHECK-NEXT: 40020c 48d03bd5 08010091 08410091 090140b9 H.;......A....@.
# \_ | | <foo3>:
# \_ | add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12)
# \_ add x8, x8, #0x10 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
# CHECK-NEXT: 40021c e003092a c0035fd6 48d03bd5 08010091 ...*.._.H.;.....
# \_ | <foo3>:
# \_ add x8, x8, #0x0 (R_AARCH64_TLSLE_ADD_TPREL_HI12)
# CHECK-NEXT: 40022c 08510091 090140b9 e003092a c0035fd6 .Q....@....*.._.
# \_ add x8, x8, #0x14 (R_AARCH64_TLSLE_ADD_TPREL_LO12_NC)
---
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
OSABI: ELFOSABI_GNU
Type: ET_REL
Machine: EM_AARCH64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000004
Content: 48D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD648D03BD50801009108010091090140B9E003092AC0035FD6FD7BBFA9FD030091FF8300D1BFC31FB8E4FFFF97A0831FB8E8FFFF97A0431FB8ECFFFF97E01300B9F0FFFF970800009008010091E00F00B9E00308AAA1835FB8A2435FB8E31340B9E40F40B900000094E1031F2AE00B00B9E003012ABF030091FD7BC1A8C0035FD6
- Name: .rela.text
Type: SHT_RELA
Link: .symtab
AddressAlign: 0x0000000000000008
Info: .text
Relocations:
- Offset: 0x0000000000000004
Symbol: v1
Type: R_AARCH64_TLSLE_ADD_TPREL_HI12
- Offset: 0x0000000000000008
Symbol: v1
Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
- Offset: 0x000000000000001C
Symbol: v2
Type: R_AARCH64_TLSLE_ADD_TPREL_HI12
- Offset: 0x0000000000000020
Symbol: v2
Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
- Offset: 0x0000000000000034
Symbol: v3
Type: R_AARCH64_TLSLE_ADD_TPREL_HI12
- Offset: 0x0000000000000038
Symbol: v3
Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
- Offset: 0x000000000000004C
Symbol: v4
Type: R_AARCH64_TLSLE_ADD_TPREL_HI12
- Offset: 0x0000000000000050
Symbol: v4
Type: R_AARCH64_TLSLE_ADD_TPREL_LO12_NC
- Offset: 0x000000000000008C
Symbol: .rodata.str1.1
Type: R_AARCH64_ADR_PREL_PG_HI21
- Offset: 0x0000000000000090
Symbol: .rodata.str1.1
Type: R_AARCH64_ADD_ABS_LO12_NC
- Offset: 0x00000000000000AC
Symbol: printf
Type: R_AARCH64_CALL26
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
Content: ''
- Name: .bss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
AddressAlign: 0x0000000000000004
- Name: .tdata
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
AddressAlign: 0x0000000000000004
Content: '0300000004000000'
- Name: .tbss
Type: SHT_NOBITS
Flags: [ SHF_WRITE, SHF_ALLOC, SHF_TLS ]
AddressAlign: 0x0000000000000004
Size: 8
- Name: .rodata.str1.1
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 25692025692025692025690A00
- Name: .note.GNU-stack
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Content: ''
Symbols:
Local:
- Name: '$d.1'
Type: STT_TLS
Section: .tdata
- Name: '$d.2'
Type: STT_TLS
Section: .tbss
- Name: '$d.3'
Section: .rodata.str1.1
- Name: '$x.0'
Section: .text
- Name: v2
Type: STT_TLS
Section: .tbss
Value: 0x0000000000000004
Size: 0x0000000000000004
- Name: v4
Type: STT_TLS
Section: .tdata
Value: 0x0000000000000004
Size: 0x0000000000000004
- Name: .text
Type: STT_SECTION
Section: .text
- Name: .data
Type: STT_SECTION
Section: .data
- Name: .bss
Type: STT_SECTION
Section: .bss
- Name: .tdata
Type: STT_SECTION
Section: .tdata
- Name: .tbss
Type: STT_SECTION
Section: .tbss
- Name: .rodata.str1.1
Type: STT_SECTION
Section: .rodata.str1.1
- Name: .note.GNU-stack
Type: STT_SECTION
Section: .note.GNU-stack
Global:
- Name: foo1
Type: STT_FUNC
Section: .text
Size: 0x0000000000000018
- Name: foo2
Type: STT_FUNC
Section: .text
Value: 0x0000000000000018
Size: 0x0000000000000018
- Name: foo3
Type: STT_FUNC
Section: .text
Value: 0x0000000000000030
Size: 0x0000000000000018
- Name: foo4
Type: STT_FUNC
Section: .text
Value: 0x0000000000000048
Size: 0x0000000000000018
- Name: main
Type: STT_FUNC
Section: .text
Value: 0x0000000000000060
Size: 0x0000000000000068
- Name: v1
Type: STT_TLS
Section: .tbss
Size: 0x0000000000000004
- Name: v3
Type: STT_TLS
Section: .tdata
Size: 0x0000000000000004
- Name: printf
...