Browse Source
BFD_RELOC_AARCH64_TLSLE_ADD_LO12 is used to generate simplest one-instruction addressing for TLS LE model when tls size is smaller 4K. Linker need to make sure there is no TLS offset overflow. 2015-06-01 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (elfNN_aarch64_howto_table): Set overflow type to complain_overflow_unsigned for BFD_RELOC_AARCH64_TLSLE_ADD_LO12. * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Don't use PGOFF for BFD_RELOC_AARCH64_TLSLE_ADD_LO12, that will mask off all potential high overflowed bits. ld/testsuite/ * ld-aarch64/tprel_add_lo12_overflow.s: New testcase. * ld-aarch64/tprel_add_lo12_overflow.d: Nex expectation file. * ld-aarch64/aarch64-elf.exp: Run new testcase.gdb-7.10-branch
7 changed files with 48 additions and 2 deletions
@ -0,0 +1,6 @@ |
|||
#name: TLS offset out of range - TPREL_ADD_LO12 |
|||
#source: tprel_add_lo12_overflow.s |
|||
#as: |
|||
#ld: -e0 |
|||
#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLE_ADD_TPREL_LO12 against symbol `i' .* |
|||
|
|||
@ -0,0 +1,23 @@ |
|||
.cpu generic |
|||
.global ff |
|||
.section .tdata,"awT",%progbits |
|||
.align 2 |
|||
.type ff, %object |
|||
# Maximum 12bit - 16byte TCB header is the upper limit |
|||
# for tprel_add_lo12 |
|||
.size ff, 4096 - 16 |
|||
ff: |
|||
.zero 4096 - 16 |
|||
.global i |
|||
.type i, %object |
|||
.size i, 4 |
|||
i: |
|||
.zero 4 |
|||
.text |
|||
.align 2 |
|||
.global main |
|||
.type main, %function |
|||
main: |
|||
add x0, x0, #:tprel_lo12:i |
|||
ret |
|||
.size main, .-main |
|||
Loading…
Reference in new issue