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
11 /// Reject local-exec TLS relocations for
-shared.
12 // RUN
: not ld.lld
-shared
%t.o
-o
/dev
/null
2>&1 | FileCheck
%s
--check-prefix
=ERR
--implicit-check-
not=error
:
14 // ERR
: error
: relocation R_ARM_TLS_LE32 against x cannot
be used with
-shared
15 // ERR
: error
: relocation R_ARM_TLS_LE32 against y cannot
be used with
-shared
16 // ERR
: error
: relocation R_ARM_TLS_LE32 against z cannot
be used with
-shared
22 .type _start,%function
25 /// Generate R_ARM_TLS_LE32 relocations. These resolve statically to the offset
26 /// of the variable from the thread pointer
31 /// __thread int x
= 10
33 /// __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
62 // SEC-NEXT
: Address
: 0x30120
65 // SEC-NEXT
: Type
: SHT_NOBITS
67 // SEC-NEXT
: SHF_ALLOC
69 // SEC-NEXT
: SHF_WRITE
71 // SEC-NEXT
: Address
: 0x30124
74 // SEC
: Dynamic Relocations
{
77 // CHECK
: Disassembly of section
.text:
79 // CHECK-NEXT
: <_start
>:
80 /// offset of x from Thread pointer
= (TcbSize
+ 0x0 = 0x8)
81 // CHECK-NEXT
: 20114: 00000008
82 /// offset of z from Thread pointer
= (TcbSize
+ 0x8 = 0x10)
83 // CHECK-NEXT
: 20118: 00000010
84 /// offset of y from Thread pointer
= (TcbSize
+ 0x4 = 0xc)
85 // CHECK-NEXT
: 2011c
: 0000000c