brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · a454038 Raw
86 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc %s -o %t.o -filetype=obj -triple=armv7a-linux-gnueabi3// RUN: ld.lld %t.o -o %t4// RUN: llvm-readobj -S --dyn-relocations %t | FileCheck --check-prefix=SEC %s5// RUN: llvm-objdump -d --triple=armv7a-linux-gnueabi %t | FileCheck %s6 7/// Test the handling of the local exec TLS model. TLS can be resolved8/// statically for an application. The code sequences assume a thread pointer9/// in r910 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:13 14// ERR: error: relocation R_ARM_TLS_LE32 against x cannot be used with -shared15// ERR: error: relocation R_ARM_TLS_LE32 against y cannot be used with -shared16// ERR: error: relocation R_ARM_TLS_LE32 against z cannot be used with -shared17 18 .text19 .syntax unified20 .globl  _start21 .p2align        222 .type   _start,%function23_start:24 .p2align        225/// Generate R_ARM_TLS_LE32 relocations. These resolve statically to the offset26/// of the variable from the thread pointer27.Lt0: .word   x(TPOFF)28.Lt1: .word   y(TPOFF)29.Lt2: .word   z(TPOFF)30 31/// __thread int x = 1032/// __thread int y;33/// __thread int z __attribute((visibility("hidden")))34 35 .hidden z36 .globl  z37 .globl  y38 .globl  x39 40 .section       .tbss,"awT",%nobits41 .p2align  242.TLSSTART:43 .type  z, %object44z:45 .space 446 .type  y, %object47y:48 .space 449 .section       .tdata,"awT",%progbits50 .p2align 251 .type  x, %object52x:53 .word  1054 55// SEC:      Name: .tdata56// SEC-NEXT: Type: SHT_PROGBITS57// SEC-NEXT: Flags [58// SEC-NEXT:   SHF_ALLOC59// SEC-NEXT:   SHF_TLS60// SEC-NEXT:   SHF_WRITE61// SEC-NEXT:  ]62// SEC-NEXT: Address: 0x3012063// SEC:      Size: 464// SEC:      Name: .tbss65// SEC-NEXT: Type: SHT_NOBITS66// SEC-NEXT: Flags [67// SEC-NEXT:   SHF_ALLOC68// SEC-NEXT:   SHF_TLS69// SEC-NEXT:   SHF_WRITE70// SEC-NEXT: ]71// SEC-NEXT: Address: 0x3012472// SEC:      Size: 873 74// SEC: Dynamic Relocations {75// SEC-NEXT: }76 77// CHECK: Disassembly of section .text:78// CHECK-EMPTY: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   86