diff options
author | Christophe Lyon <christophe.lyon@st.com> | 2010-02-09 14:44:50 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@st.com> | 2010-02-09 14:44:50 +0000 |
commit | 486499d044bfca617c7f3f7a0b0f6ae70ca98ef3 (patch) | |
tree | f04806ccf09966f408e30a3203b669b59254d8c9 /gas/config/tc-arm.c | |
parent | 1523fa24f7d51fecc82338e65a567346b9cef317 (diff) | |
download | gdb-486499d044bfca617c7f3f7a0b0f6ae70ca98ef3.zip gdb-486499d044bfca617c7f3f7a0b0f6ae70ca98ef3.tar.gz gdb-486499d044bfca617c7f3f7a0b0f6ae70ca98ef3.tar.bz2 |
2010-02-08 Christophe Lyon <christophe.lyon@st.com>
gas/
* config/tc-arm.c (md_pcrel_from_section): Keep base to zero for
non-local branches (BFD_RELOC_THUMB_PCREL_BRANCH23,
BFD_RELOC_THUMB_PCREL_BLX, BFD_RELOC_ARM_PCREL_BLX,
BFD_RELOC_ARM_PCREL_CALL)
gas/testsuite/
* gas/arm/branch-reloc.s, gas/arm/branch-reloc.d,
gas/arm/branch-reloc.l: New tests and expected results with all
variants of call: ARM/Thumb, local/global, inter/intra-section,
using BL/BLX.
Diffstat (limited to 'gas/config/tc-arm.c')
-rw-r--r-- | gas/config/tc-arm.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 7bf5416..2add801 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -19240,7 +19240,9 @@ md_pcrel_from_section (fixS * fixP, segT seg) return base + 4; case BFD_RELOC_THUMB_PCREL_BRANCH23: - if (fixP->fx_addsy + if (fixP->fx_addsy + && (S_GET_SEGMENT (fixP->fx_addsy) == seg) + && (!S_IS_EXTERNAL (fixP->fx_addsy)) && ARM_IS_FUNC (fixP->fx_addsy) && ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)) base = fixP->fx_where + fixP->fx_frag->fr_address; @@ -19248,8 +19250,10 @@ md_pcrel_from_section (fixS * fixP, segT seg) /* BLX is like branches above, but forces the low two bits of PC to zero. */ - case BFD_RELOC_THUMB_PCREL_BLX: - if (fixP->fx_addsy + case BFD_RELOC_THUMB_PCREL_BLX: + if (fixP->fx_addsy + && (S_GET_SEGMENT (fixP->fx_addsy) == seg) + && (!S_IS_EXTERNAL (fixP->fx_addsy)) && THUMB_IS_FUNC (fixP->fx_addsy) && ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)) base = fixP->fx_where + fixP->fx_frag->fr_address; @@ -19258,18 +19262,22 @@ md_pcrel_from_section (fixS * fixP, segT seg) /* ARM mode branches are offset by +8. However, the Windows CE loader expects the relocation not to take this into account. */ case BFD_RELOC_ARM_PCREL_BLX: - if (fixP->fx_addsy + if (fixP->fx_addsy + && (S_GET_SEGMENT (fixP->fx_addsy) == seg) + && (!S_IS_EXTERNAL (fixP->fx_addsy)) && ARM_IS_FUNC (fixP->fx_addsy) && ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)) base = fixP->fx_where + fixP->fx_frag->fr_address; - return base + 8; + return base + 8; - case BFD_RELOC_ARM_PCREL_CALL: - if (fixP->fx_addsy + case BFD_RELOC_ARM_PCREL_CALL: + if (fixP->fx_addsy + && (S_GET_SEGMENT (fixP->fx_addsy) == seg) + && (!S_IS_EXTERNAL (fixP->fx_addsy)) && THUMB_IS_FUNC (fixP->fx_addsy) && ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v5t)) base = fixP->fx_where + fixP->fx_frag->fr_address; - return base + 8; + return base + 8; case BFD_RELOC_ARM_PCREL_BRANCH: case BFD_RELOC_ARM_PCREL_JUMP: |