2 // RUN
: llvm-mc
%s
-o
%t.o
-filetype
=obj
-triple
=armv7a-linux-gnueabi
3 // RUN
: ld.lld
%t.o
-o
%t.so
-shared
4 // RUN
: llvm-readobj
-S
-d
--dyn-relocations
%t.so | FileCheck
--check-prefix
=SEC
%s
5 // RUN
: llvm-objdump
-d
--triple
=armv7a-linux-gnueabi
%t.so | FileCheck
%s
7 /// Test the handling of the initial-exec TLS model. Relative location within
8 /// static TLS is
a run-time constant computed by dynamic loader as
a result
9 /// of the R_ARM_TLS_TPOFF32 relocation.
25 /// Generate R_ARM_TLS_IE32 static relocations
26 /// Allocates
a GOT entry dynamically relocated by R_ARM_TLS_TPOFF32
27 /// literal contains the offset of the GOT entry from the place
28 .Lt0: .word x(gottpoff) + (. - .L0 - 8)
29 .Lt1: .word y(gottpoff) + (. - .L1 - 8)
30 .Lt2: .word .TLSSTART(gottpoff) + (. - .L2 - 8)
32 /// __thread int x
= 10
34 /// __thread int z __attribute
((visibility
("hidden")))
40 .section .tbss,"awT",%nobits
49 .section .tdata,"awT",%progbits
56 // SEC-NEXT
: Type
: SHT_PROGBITS
58 // SEC-NEXT
: SHF_ALLOC
60 // SEC-NEXT
: SHF_WRITE
63 // SEC-NEXT
: Type
: SHT_NOBITS
65 // SEC-NEXT
: SHF_ALLOC
67 // SEC-NEXT
: SHF_WRITE
71 // SEC-NEXT
: Type
: SHT_PROGBITS
73 // SEC-NEXT
: SHF_ALLOC
74 // SEC-NEXT
: SHF_WRITE
76 // SEC-NEXT
: Address
: 0x2025C
80 // SEC
: FLAGS STATIC_TLS
81 // SEC
: Dynamic Relocations
{
82 // SEC
: 0x20264 R_ARM_TLS_TPOFF32
83 // SEC
: 0x2025C R_ARM_TLS_TPOFF32 x
84 // SEC
: 0x20260 R_ARM_TLS_TPOFF32 y
86 // CHECK
: Disassembly of section
.text:
88 // CHECK-NEXT
: <func
>:
89 // CHECK-NEXT
: 101e8
: e320f000
nop
90 // CHECK-NEXT
: 101ec
: e320f000
nop
91 // CHECK-NEXT
: 101f0: e320f000
nop
93 /// (0x20264 - 0x101f4) + (0x101f4 - 0x101e8 - 8) = 0x1006c
94 // CHECK
: 101f4: 6c
00 01 00
95 /// (0x2025C - 0x101f8) + (0x101f8 - 0x101ec - 8) = 0x1006c
96 // CHECK-NEXT
: 101f8: 6c
00 01 00
97 /// (0x20260 - 0x101f8) + (0x101f8 - 0x101f0 - 8) = 0x1006c
98 // CHECK-NEXT
: 101fc
: 6c
00 01 00