[AArch64] Relax TLS local dynamic traditional into local executable
Jiong Wang
jiong.wang@arm.com
Tue Aug 25 13:05:00 GMT 2015
More information about the Binutils mailing list
Tue Aug 25 13:05:00 GMT 2015
- Previous message (by thread): Support PIE on Solaris 12
- Next message (by thread): [gold commit] PR 18866: Fix regression introduced by fix for PR 18703
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This patch add the linker relaxation from TLS local dynamic traditional
model into local executable on AArch64 tiny/small model.
After this relaxation, we don't need to invoke the runtime resolver.
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
For local dynamic model, the TLS instruction sequences is composed of
two parts, the first part calcuate module base address, the second part
add variable offset to get final address.
For linker relaxation, we only need to touch the first part. When relax
from local dynamic into local executable, we don't need to invoke
runtime resolver to get module base address. As for local executable,
the "module" should be initial TLS module, thus the module base address
can be calculated by "tp + TCB_SIZE" as tp points to start of initial
TLS module start, we need to skip the thread control block to point to
real module contents for variable.
After the relaxation, the relocation for the 'bl' instruction should be
removed also, as we don't need any relocation anymore.
ok for trunk?
2015-08-25 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.
--
Regards,
Jiong
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lerelax.patch
Type: text/x-diff
Size: 6271 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150825/b586af26/attachment.bin>
- Previous message (by thread): Support PIE on Solaris 12
- Next message (by thread): [gold commit] PR 18866: Fix regression introduced by fix for PR 18703
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list