diff options
author | Nick Clifton <nickc@redhat.com> | 2021-04-06 13:27:50 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-04-06 13:27:50 +0100 |
commit | eac4eb8ecb2626ef7711d8f6bee9e870ae435604 (patch) | |
tree | fd02dab5fb608d6b4383540e03f36dcd295f9dd8 /gas/testsuite | |
parent | da0835aebea71232f6b4fb4dea3ee18bdef0c139 (diff) | |
download | binutils-eac4eb8ecb2626ef7711d8f6bee9e870ae435604.zip binutils-eac4eb8ecb2626ef7711d8f6bee9e870ae435604.tar.gz binutils-eac4eb8ecb2626ef7711d8f6bee9e870ae435604.tar.bz2 |
Fix a problem assembling AArch64 sources when a relocation is generated against a symbol that has a defined value.
PR 27217
* config/tc-aarch64.c (my_get_expression): Rename to
aarch64_get_expression. Add a fifth argument to enable deferring
of expression resolution.
(parse_typed_reg): Update calls to my_get_expression.
(parse_vector_reg_list): Likewise.
(parse_immediate_expression): Likewise.
(parse_big_immediate): Likewise.
(parse_shift): Likewise.
(parse_shifter_operand_imm): Likewise.
(parse_operands): Likewise.
(parse_shifter_operand_reloc): Update calls to my_get_expression
and call aarch64_force_reloc to determine the value of the new
fifth argument.
(parse_address_main): Likewise.
(parse_half): Likewise.
(parse_adrp): Likewise.
(aarch64_force_reloc): New function. Contains code extracted from...
(aarch64_force_relocation): ... here.
* testsuite/gas/aarch64/pr27217.s: New test case.
* testsuite/gas/aarch64/pr27217.d: New test driver.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/aarch64/pr27217.d | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/aarch64/pr27217.s | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gas/testsuite/gas/aarch64/pr27217.d b/gas/testsuite/gas/aarch64/pr27217.d new file mode 100644 index 0000000..4645ff5 --- /dev/null +++ b/gas/testsuite/gas/aarch64/pr27217.d @@ -0,0 +1,15 @@ +# Check that expressions that generate relocations work when the symbol is a constant. +#name: PR27212 +#objdump: -rd + +.*: file format .* + +Disassembly of section \.text: + +0+000 <.*>: +[ ]+0:[ ]+90000000[ ]+adrp[ ]+x0, 12345678[ ]+<bar> +[ ]+0:[ ]+R_AARCH64_ADR_PREL_PG_HI21[ ]+bar +[ ]+4:[ ]+91000000[ ]+add[ ]+x0, x0, #0x0 +[ ]+4:[ ]+R_AARCH64_ADD_ABS_LO12_NC[ ]+bar +[ ]+8:[ ]+d65f03c0[ ]+ret +#pass diff --git a/gas/testsuite/gas/aarch64/pr27217.s b/gas/testsuite/gas/aarch64/pr27217.s new file mode 100644 index 0000000..8cb9230 --- /dev/null +++ b/gas/testsuite/gas/aarch64/pr27217.s @@ -0,0 +1,16 @@ + .arch armv8-a + .file "set.c" + .text + // Start of user assembly + .set bar, 0x12345678 + // End of user assembly + .align 2 + .p2align 4,,11 + .global foo + .type foo, %function +foo: + adrp x0, bar + add x0, x0, :lo12:bar + ret + .size foo, .-foo + .ident "GCC: (GNU) 10.2.1 20201030 (RTEMS 6, RSB " |