1// REQUIRES: arm 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 --dyn-relocations %t.so | FileCheck --check-prefix=SEC %s 5// RUN: llvm-objdump -d --triple=armv7a-linux-gnueabi %t.so | FileCheck %s 6// RUN: ld.lld %t.o -o %t 7// RUN: llvm-objdump -d --triple=armv7a-linux-gnueabi %t | FileCheck --check-prefix=CHECK-EXE %s 8 9/// Test the handling of the local-dynamic TLS model. Dynamic loader finds 10/// module index R_ARM_TLS_DTPMOD32. The offset in the next GOT slot is 0 11/// The R_ARM_TLS_LDO is the offset of the variable within the TLS block. 12 .global __tls_get_addr 13 .text 14 .p2align 2 15 .global _start 16 .syntax unified 17 .arm 18 .type _start, %function 19_start: 20.L0: 21 nop 22 23 .word x(tlsldm) + (. - .L0 - 8) 24 .word x(tlsldo) 25 .word y(tlsldo) 26 27 .section .tbss,"awT",%nobits 28 .p2align 2 29 .type y, %object 30y: 31 .space 4 32 .section .tdata,"awT",%progbits 33 .p2align 2 34 .type x, %object 35x: 36 .word 10 37 38// SEC: Name: .tdata 39// SEC-NEXT: Type: SHT_PROGBITS 40// SEC-NEXT: Flags [ 41// SEC-NEXT: SHF_ALLOC 42// SEC-NEXT: SHF_TLS 43// SEC-NEXT: SHF_WRITE 44// SEC-NEXT: ] 45// SEC-NEXT: Address: 0x201D0 46// SEC: Size: 4 47// SEC: Name: .tbss 48// SEC-NEXT: Type: SHT_NOBITS (0x8) 49// SEC-NEXT: Flags [ 50// SEC-NEXT: SHF_ALLOC 51// SEC-NEXT: SHF_TLS 52// SEC-NEXT: SHF_WRITE 53// SEC-NEXT: ] 54// SEC-NEXT: Address: 0x201D4 55// SEC: Size: 4 56 57// SEC: Dynamic Relocations { 58// SEC-NEXT: 0x20224 R_ARM_TLS_DTPMOD32 - 59 60// CHECK: Disassembly of section .text: 61// CHECK-EMPTY: 62// CHECK-NEXT: <_start>: 63// CHECK-NEXT: 101c0: 00 f0 20 e3 nop 64 65/// (0x20224 - 0x101c4) + (0x101c4 - 0x101c0 - 8) = 0x1005c 66// CHECK: 101c4: 5c 00 01 00 67// CHECK-NEXT: 101c8: 00 00 00 00 68// CHECK-NEXT: 101cc: 04 00 00 00 69 70// CHECK-EXE: <_start>: 71// CHECK-EXE-NEXT: 20114: 00 f0 20 e3 nop 72// CHECK-EXE: 20118: 0c 00 01 00 73// CHECK-EXE-NEXT: 2011c: 00 00 00 00 74// CHECK-EXE-NEXT: 20120: 04 00 00 00 75