diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index e7a2fe0..bd39071 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -4330,9 +4330,7 @@ process_movw_reloc_info (void) case BFD_RELOC_AARCH64_MOVW_G1_S: case BFD_RELOC_AARCH64_MOVW_G2_S: case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0: - case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC: case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1: - case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC: case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2: set_syntax_error (_("the specified relocation type is not allowed for MOVK")); @@ -4341,6 +4339,18 @@ process_movw_reloc_info (void) break; } + if (inst.base.opcode->op == OP_MOVN || inst.base.opcode->op == OP_MOVZ) + switch (inst.reloc.type) + { + case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC: + case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC: + set_syntax_error + (_("the specified relocation type is not allowed for MOV[NZ]")); + return FALSE; + default: + break; + } + switch (inst.reloc.type) { case BFD_RELOC_AARCH64_MOVW_G0: diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index e85d1db..d19372b 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -109,3 +109,5 @@ run_dump_test "tls-relax-gdesc-le-2" run_dump_test "tls-relax-ie-le-2" run_dump_test "tls-relax-ie-le-3" run_dump_test "tlsle-symbol-offset" +run_dump_test "tlsle-large-1" +run_dump_test "tlsle-large-2" diff --git a/ld/testsuite/ld-aarch64/tlsle-large-1.d b/ld/testsuite/ld-aarch64/tlsle-large-1.d index e69de29..029e52f 100644 --- a/ld/testsuite/ld-aarch64/tlsle-large-1.d +++ b/ld/testsuite/ld-aarch64/tlsle-large-1.d @@ -0,0 +1,12 @@ +#source: tlsle-large-1.s +#ld: -shared -T relocs.ld -e0 +#objdump: -dr +#... +Disassembly of section .text: + +0000000000010000 <.text>: + +10000: d53bd040 mrs x0, tpidr_el0 + +10004: d2a00021 movz x1, #0x1, lsl #16 + +10008: f2800801 movk x1, #0x40 + +1000c: 8b000021 add x1, x1, x0 + +10010: d65f03c0 ret diff --git a/ld/testsuite/ld-aarch64/tlsle-large-1.s b/ld/testsuite/ld-aarch64/tlsle-large-1.s index e69de29..55676f3 100644 --- a/ld/testsuite/ld-aarch64/tlsle-large-1.s +++ b/ld/testsuite/ld-aarch64/tlsle-large-1.s @@ -0,0 +1,22 @@ + .global p + .global a + .section .tbss,"awT",%nobits + +# p is a dummy variable of size 2^16 used to push the offset +# over 16 bits in the test instructions. + +p: + .zero 65536 +a: + .zero 52 + + .text + +# Compute the address of an integer within structure a, padded +# by an array of size 48 + + mrs x0, tpidr_el0 + movz x1, #:tprel_g1:a+48 + movk x1, #:tprel_g0_nc:a+48 + add x1, x1, x0 + ret diff --git a/ld/testsuite/ld-aarch64/tlsle-large-2.d b/ld/testsuite/ld-aarch64/tlsle-large-2.d index e69de29..79f103c 100644 --- a/ld/testsuite/ld-aarch64/tlsle-large-2.d +++ b/ld/testsuite/ld-aarch64/tlsle-large-2.d @@ -0,0 +1,13 @@ +#source: tlsle-large-2.s +#ld: -shared -T relocs.ld -e0 +#objdump: -dr +#... +Disassembly of section .text: + +0000000000010000 <.text>: + +10000: d53bd040 mrs x0, tpidr_el0 + +10004: d2c00021 movz x1, #0x1, lsl #32 + +10008: f2a00001 movk x1, #0x0, lsl #16 + +1000c: f2800801 movk x1, #0x40 + +10010: 8b000021 add x1, x1, x0 + +10014: d65f03c0 ret diff --git a/ld/testsuite/ld-aarch64/tlsle-large-2.s b/ld/testsuite/ld-aarch64/tlsle-large-2.s index e69de29..4be1218 100644 --- a/ld/testsuite/ld-aarch64/tlsle-large-2.s +++ b/ld/testsuite/ld-aarch64/tlsle-large-2.s @@ -0,0 +1,23 @@ + .global p + .global a + .section .tbss,"awT",%nobits + +# p is a dummy variable of size 2^32 used to push the offset +# over 32 bits in the test instructions. + +p: + .zero 4294967296 +a: + .zero 52 + + .text + +# Compute the address of an integer within structure a, padded +# by an array of size 48 + + mrs x0, tpidr_el0 + movz x1, #:tprel_g2:a+48 + movk x1, #:tprel_g1_nc:a+48 + movk x1, #:tprel_g0_nc:a+48 + add x1, x1, x0 + ret