2 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
3 // RUN: ld.lld %t.o -o %t
4 // RUN: llvm-readobj -s -dyn-relocations %t | FileCheck --check-prefix=SEC %s
5 // RUN: llvm-objdump -d -triple=armv7a-linux-gnueabi %t | FileCheck %s
7 // Test the handling of the local exec TLS model. TLS can be resolved
8 // statically for an application. The code sequences assume a thread pointer
15 .type _start,%function
18 // Generate R_ARM_TLS_LE32 relocations. These resolve statically to the offset
19 // of the variable from the thread pointer
24 // __thread int x = 10
26 // __thread int z __attribute((visibility("hidden")))
33 .section .tbss,"awT",%nobits
42 .section .tdata,"awT",%progbits
49 // SEC-NEXT: Type: SHT_PROGBITS
51 // SEC-NEXT: SHF_ALLOC
53 // SEC-NEXT: SHF_WRITE
55 // SEC-NEXT: Address: 0x12000
58 // SEC-NEXT: Type: SHT_NOBITS
60 // SEC-NEXT: SHF_ALLOC
62 // SEC-NEXT: SHF_WRITE
64 // SEC-NEXT: Address: 0x12004
67 // SEC: Dynamic Relocations {
70 // CHECK: Disassembly of section .text:
71 // CHECK-NEXT: _start:
72 // offset of x from Thread pointer = (TcbSize + 0x0 = 0x8)
73 // CHECK-NEXT: 11000: 08 00 00 00
74 // offset of z from Thread pointer = (TcbSize + 0x8 = 0x10)
75 // CHECK-NEXT: 11004: 10 00 00 00
76 // offset of y from Thread pointer = (TcbSize + 0x4 = 0xc)
77 // CHECK-NEXT: 11008: 0c 00 00 00