old-cross-binutils/ld/testsuite/ld-aarch64/tls-relax-ld-le-small.s
Jiong Wang 259364adb8 [AArch64] Relax TLS local dynamic traditional into local executable
The linker relaxation logic will be:

Code sequence I (tiny):

    0x00 adr  x0, :tlsldm:x
    0x04 bl   __tls_get_addr
         |
         V
    0x00 mrs  x0, tpidr_el0
    0x04 add  x0, x0, TCB_SIZE

Code sequence II (small):

    0x00 adrp a0, :tlsldm:x
    0x04 add  a0, #:tlsldm_lo12:x
    0x08 bl   __tls_get_addr
         |
         V
    0x00 mrs  x0, tpidr_el0
    0x04 add  x0, x0, TCB_SIZE
    0x08 nop

2015-09-09  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (aarch64_tls_transition_without_check): Support
  three TLS local dynamic traditional relocations types.
  (elfNN_aarch64_tls_relax): Support TLS local dynamic traditional to
  local executable relaxation.

ld/testsuite/
  * ld-aarch64/tls-relax-ld-le-tiny.s: New testcase.
  * ld-aarch64/tls-relax-ld-le-small.s: Likewise.
  * ld-aarch64/tls-relax-ld-le-tiny.d: New expectation file.
  * ld-aarch64/tls-relax-ld-le-small.d: Likewise.
  * ld-aarch64/aarch64-elf.exp: Run new testcases.
2015-09-09 14:19:28 +01:00

27 lines
560 B
ArmAsm

.cpu generic+fp+simd
.section .text.startup,"ax",%progbits
.align 2
.p2align 3,,7
.global main
.type main, %function
main:
add x29, sp, 0
adrp x0, :tlsldm:global_a0
add x0, x0, #:tlsldm_lo12_nc:global_a0
bl __tls_get_addr
nop
add x1, x0, #:dtprel_hi12:global_a0, lsl #12
add x1, x1, #:dtprel_lo12_nc:global_a0
adrp x0, .LC0
ret
.size main, .-main
.section .rodata.str1.8,"aMS",%progbits,1
.align 3
.LC0:
.string "Hello world %d\n"
.section .tdata,"awT",%progbits
.align 2
.type global_a0, %object
.size global_a0, 4
global_a0:
.word 16