2 // RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi
3 // RUN: ld.lld --hash-style=sysv %t.o -o %t.so -shared
4 // RUN: llvm-readobj -s -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 local-dynamic TLS model. Dynamic loader finds
8 // module index R_ARM_TLS_DTPMOD32. The offset in the next GOT slot is 0
9 // The R_ARM_TLS_LDO is the offset of the variable within the TLS block.
10 .global __tls_get_addr
16 .type _start, %function
21 .word x(tlsldm) + (. - .L0 - 8)
25 .section .tbss,"awT",%nobits
30 .section .tdata,"awT",%progbits
37 // SEC-NEXT: Type: SHT_PROGBITS
39 // SEC-NEXT: SHF_ALLOC
41 // SEC-NEXT: SHF_WRITE
43 // SEC-NEXT: Address: 0x2000
46 // SEC-NEXT: Type: SHT_NOBITS (0x8)
48 // SEC-NEXT: SHF_ALLOC
50 // SEC-NEXT: SHF_WRITE
52 // SEC-NEXT: Address: 0x2004
55 // SEC: Dynamic Relocations {
56 // SEC-NEXT: 0x204C R_ARM_TLS_DTPMOD32 - 0x0
58 // CHECK: Disassembly of section .text:
59 // CHECK-NEXT: _start:
60 // CHECK-NEXT: 1000: 00 f0 20 e3 nop
62 // (0x204c - 0x1004) + (0x1004 - 0x1000 - 8) = 0x1044
63 // CHECK: 1004: 44 10 00 00
64 // CHECK-NEXT: 1008: 00 00 00 00
65 // CHECK-NEXT: 100c: 04 00 00 00
67 // CHECK-EXE: Disassembly of section .text:
68 // CHECK-NEXT-EXE: _start:
69 // CHECK-NEXT-EXE: 11000: 00 f0 20 e3 nop
71 // CHECK-EXE: 11004: fc 0f 00 00
72 // CHECK-EXE: 11008: 00 00 00 00
73 // CHECK-EXE: 1100c: 04 00 00 00