|
| 1 | +# REQUIRES: ppc |
| 2 | + |
| 3 | +# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o |
| 4 | +# RUN: llvm-objdump -d -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s |
| 5 | +# RUN: ld.lld --defsym __tls_get_addr=0x1001000 %t.o -o %t |
| 6 | +# RUN: llvm-objdump -d %t | FileCheck --check-prefix=CHECK-DIS %s |
| 7 | +# RUN: llvm-readelf -relocations %t | FileCheck --check-prefix=DYN-RELOCS %s |
| 8 | + |
| 9 | +# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o |
| 10 | +# RUN: llvm-objdump -d -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s |
| 11 | +# RUN: ld.lld --defsym __tls_get_addr=0x1001000 %t.o -o %t |
| 12 | +# RUN: llvm-objdump -d %t | FileCheck --check-prefix=CHECK-DIS %s |
| 13 | +# RUN: llvm-readelf -relocations %t | FileCheck --check-prefix=DYN-RELOCS %s |
| 14 | + |
| 15 | +# Test checks the relaxation of a 'small' general-dynamic tls access into a |
| 16 | +# local-exec tls access. |
| 17 | + |
| 18 | + .text |
| 19 | + .abiversion 2 |
| 20 | + |
| 21 | + .global test |
| 22 | + .p2align 4 |
| 23 | + .type test, @function |
| 24 | + |
| 25 | +test: |
| 26 | +.Lgep: |
| 27 | + addis 2, 12, .TOC.-.Lgep@ha |
| 28 | + addi 2, 2, .TOC.-.Lgep@l |
| 29 | + .localentry test, .-test |
| 30 | + mflr 0 |
| 31 | + std 0, 16(1) |
| 32 | + stdu 1, -32(1) |
| 33 | + addi 3, 2, a@got@tlsgd |
| 34 | + bl __tls_get_addr(a@tlsgd) |
| 35 | + nop |
| 36 | + lwz 3, 0(3) |
| 37 | + addi 1, 1, 32 |
| 38 | + ld 0, 16(1) |
| 39 | + mtlr 0 |
| 40 | + blr |
| 41 | + |
| 42 | + .type a, @object |
| 43 | + .section .tdata,"awT",@progbits |
| 44 | + .global a |
| 45 | + .p2align 2 |
| 46 | +a: |
| 47 | + .long 55 |
| 48 | + .size a, 4 |
| 49 | + |
| 50 | +# CHECK-INPUT: addi 3, 2, 0 |
| 51 | +# CHECK-INPUT-NEXT: R_PPC64_GOT_TLSGD16 a |
| 52 | +# CHECK-INPUT-NEXT: bl .+0 |
| 53 | +# CHECK-INPUT-NEXT: R_PPC64_TLSGD a |
| 54 | +# CHECK-INPUT-NEXT: R_PPC64_REL24 __tls_get_addr |
| 55 | + |
| 56 | +# CHECK-DIS: addis 3, 13, 0 |
| 57 | +# CHECK-DIS-NEXT: nop |
| 58 | +# CHECK-DIS-NEXT: addi 3, 3, -28672 |
| 59 | +# CHECK-DIS-NEXT: lwz 3, 0(3) |
| 60 | + |
| 61 | +# DYN-RELOCS: There are no relocations in this file |
0 commit comments