diff options
author | Nick Clifton <nickc@redhat.com> | 2017-05-15 15:29:02 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2017-05-15 15:29:02 +0100 |
commit | 52a86f843b6dee1de9977293da9786649b146b05 (patch) | |
tree | 51bb23eaae6f8107c8256739bd57d25d050a7868 /gas/config | |
parent | b32465c97c12cc6049cefcde1beb3e2bfbfa232c (diff) | |
download | gdb-52a86f843b6dee1de9977293da9786649b146b05.zip gdb-52a86f843b6dee1de9977293da9786649b146b05.tar.gz gdb-52a86f843b6dee1de9977293da9786649b146b05.tar.bz2 |
Fix use of ARM ADR and ADRl pseudo-instructions with thumb function symbols.
PR gas/21458
* config/tc-arm.c (do_adr): If the ADR involves a thumb function
symbol, ensure that the T bit will be set.
(do_adrl): Likewise.
(do_t_adr): Likewise.
* testsuite/gas/arm/pr21458.s: New test.
* testsuite/gas/arm/pr21458.d: New test driver.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arm.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 7e35c34..08824b4 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -8351,6 +8351,12 @@ do_adr (void) inst.reloc.type = BFD_RELOC_ARM_IMMEDIATE; inst.reloc.pc_rel = 1; inst.reloc.exp.X_add_number -= 8; + + if (inst.reloc.exp.X_op == O_symbol + && inst.reloc.exp.X_add_symbol != NULL + && S_IS_DEFINED (inst.reloc.exp.X_add_symbol) + && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol)) + inst.reloc.exp.X_add_number += 1; } /* This is a pseudo-op of the form "adrl rd, label" to be converted @@ -8369,6 +8375,12 @@ do_adrl (void) inst.reloc.pc_rel = 1; inst.size = INSN_SIZE * 2; inst.reloc.exp.X_add_number -= 8; + + if (inst.reloc.exp.X_op == O_symbol + && inst.reloc.exp.X_add_symbol != NULL + && S_IS_DEFINED (inst.reloc.exp.X_add_symbol) + && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol)) + inst.reloc.exp.X_add_number += 1; } static void @@ -10734,9 +10746,14 @@ do_t_adr (void) inst.reloc.type = BFD_RELOC_ARM_THUMB_ADD; inst.reloc.exp.X_add_number -= 4; /* PC relative adjust. */ inst.reloc.pc_rel = 1; - inst.instruction |= Rd << 4; } + + if (inst.reloc.exp.X_op == O_symbol + && inst.reloc.exp.X_add_symbol != NULL + && S_IS_DEFINED (inst.reloc.exp.X_add_symbol) + && THUMB_IS_FUNC (inst.reloc.exp.X_add_symbol)) + inst.reloc.exp.X_add_number += 1; } /* Arithmetic instructions for which there is just one 16-bit |