# Check for initial executable TLS access across different modules. For # this case compiler will emit R_AARCH64_TLSLD_ADR_PAGE21 and # R_AARCH64_TLSLD_ADD_LO12_NC static relocations and linker should create # a R_AARCH64_TLS_TPREL64 dynamic relocation for variable access. # The test case was generated from following code snippet: # # t1.c (initial-exec-tls-1.yaml) # # __thread int e0; # __thread int e1; # __thread int e2; # __thread int e3; # # t0.c (initial-exec-tls-0.test) # # extern __thread int e0; # extern __thread int e1; # extern __thread int e2; # extern __thread int e3; # # int main () # { # e0 = 1; # e1 = 2; # e1 = 3; # e1 = 4; # } #RUN: yaml2obj -format=elf %p/Inputs/initial-exec-tls-1.yaml -o=%t-t1.o #RUN: yaml2obj -format=elf %s -o %t-t0.o #RUN: lld -flavor old-gnu -target arm64 --noinhibit-exec -o %t.exe %t-t0.o %t-t1.o #RUN: llvm-readobj -relocations %t.exe | FileCheck %s -check-prefix=CHECKRELOCATION #RUN: llvm-objdump -s -t %t.exe | FileCheck %s #CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e0 0x0 #CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e1 0x0 #CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e2 0x0 #CHECKRELOCATION: R_AARCH64_TLS_TPREL64 e3 0x0 #CHECK: Contents of section .text: #CHECK-NEXT: 4002c0 ff4300d1 e8031f2a e9031e32 0a0000b0 .C.....*...2.... # \_ adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) #CHECK-NEXT: 4002d0 4a4940f9 4bd03bd5 ec030032 6c692ab8 JI@.K.;....2li*. # \_ ldr x10, [x10,#144] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) #CHECK-NEXT: 4002e0 0a0000b0 4a4d40f9 ec031f32 6c692ab8 ....JM@....2li*. # \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) # \_ ldr x10, [x10,#152] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) #CHECK-NEXT: 4002f0 0a0000b0 4a5140f9 ec070032 6c692ab8 ....JQ@....2li*. # \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) # \_ ldr x10, [x10,#160] (R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC) #CHECK-NEXT: 400300 0a0000b0 4a5540f9 ec031e32 6c692ab8 ....JU@....2li*. # \_ | adrp x10, 401000 (R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21) # \_ ldr x10, [x10,#168] (R_AARCH64_TLSIE_LD64_GOTTPREL_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: FF4300D1E8031F2AE9031E320A0000904A0140F94BD03BD5EC0300326C692AB80A0000904A0140F9EC031F326C692AB80A0000904A0140F9EC0700326C692AB80A0000904A0140F9EC031E326C692AB8E003082AE90F00B9FF430091C0035FD6 - Name: .rela.text Type: SHT_RELA Link: .symtab AddressAlign: 0x0000000000000008 Info: .text Relocations: - Offset: 0x000000000000000C Symbol: e0 Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - Offset: 0x0000000000000010 Symbol: e0 Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - Offset: 0x0000000000000020 Symbol: e1 Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - Offset: 0x0000000000000024 Symbol: e1 Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - Offset: 0x0000000000000030 Symbol: e2 Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - Offset: 0x0000000000000034 Symbol: e2 Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - Offset: 0x0000000000000040 Symbol: e3 Type: R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 - Offset: 0x0000000000000044 Symbol: e3 Type: R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC - 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: .comment Type: SHT_PROGBITS Flags: [ SHF_MERGE, SHF_STRINGS ] AddressAlign: 0x0000000000000001 Content: 00636C616E672076657273696F6E20332E372E302028687474703A2F2F6C6C766D2E6F72672F6769742F636C616E672E6769742065653461393664373236383264353237636635353336313135366235656531383662303964363138292028687474703A2F2F6C6C766D2E6F72672F6769742F6C6C766D2E67697420623065376165623639343236646331346637376466626535343533333536366664363866396466632900 - Name: .note.GNU-stack Type: SHT_PROGBITS AddressAlign: 0x0000000000000001 Content: '' Symbols: Local: - Name: '$d.1' Section: .comment - Name: '$x.0' Section: .text - Type: STT_SECTION Section: .text - Type: STT_SECTION Section: .data - Type: STT_SECTION Section: .bss - Type: STT_SECTION Section: .comment - Type: STT_SECTION Section: .note.GNU-stack Global: - Name: e0 Type: STT_TLS - Name: e1 Type: STT_TLS - Name: e2 Type: STT_TLS - Name: e3 Type: STT_TLS - Name: main Type: STT_FUNC Section: .text Size: 0x0000000000000060 ...