73 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t3// RUN: ld.lld %t -o %t24// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi5// RUN: llvm-objdump -s %t2 | FileCheck %s6// RUN: ld.lld %t --shared -o %t3.so7// RUN: llvm-objdump -s %t3.so | FileCheck --check-prefix=CHECK-SHARED %s8 9/// For an executable, we write the module index 1 and the offset into the TLS10/// directly into the GOT. For a shared library we can only write the offset11/// into the TLS directly if the symbol is non-preemptible12 13 .text14 .syntax unified15 .globl __tls_get_addr16 .type __tls_get_addr,%function17__tls_get_addr:18 bx lr19 20 .globl _start21 .p2align 222 .type _start,%function23func:24.L0:25 nop26.L1:27 nop28.L2:29 nop30.L3:31 nop32 .p2align 233/// Generate R_ARM_TLS_GD32 relocations34/// These can be resolved at static link time for executables as 1 is always the35/// module index and the offset into tls is known at static link time36.Lt0: .word x1(TLSGD) + (. - .L0 - 8)37.Lt1: .word x2(TLSGD) + (. - .L1 - 8)38.Lt2: .word x3(TLSGD) + (. - .L2 - 8)39.Lt3: .word x4(TLSGD) + (. - .L3 - 8)40 .hidden x141 .globl x142 .hidden x243 .globl x244 .globl x345 .globl x446 47 .section .tdata,"awT",%progbits48 .p2align 249.TLSSTART:50 .type x1, %object51x1:52 .word 1053 .type x2, %object54x2:55 .word 2056 57 .section .tbss,"awT",%nobits58 .p2align 259 .type x3, %object60x3:61 .space 462 .type x4, %object63x4:64 .space 465 66// CHECK: Contents of section .got:67// CHECK-NEXT: 30140 01000000 00000000 01000000 0400000068// CHECK-NEXT: 30150 01000000 08000000 01000000 0c00000069 70// CHECK-SHARED: Contents of section .got:71// CHECK-SHARED-NEXT: 202a8 00000000 00000000 00000000 0400000072// CHECK-SHARED-NEXT: 202b8 00000000 00000000 00000000 0000000073