aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:16:31 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:16:31 +0000
commit9f0eb2327b9c019347ecede4da1185ad21cca8af (patch)
treeb6cfcb643f37b1f5de13d277b7061874cdf0b301 /gas/config/tc-ppc.c
parent12b2cce9148e4cfdc9f135cfa1a21485be51dc5b (diff)
downloadgdb-9f0eb2327b9c019347ecede4da1185ad21cca8af.zip
gdb-9f0eb2327b9c019347ecede4da1185ad21cca8af.tar.gz
gdb-9f0eb2327b9c019347ecede4da1185ad21cca8af.tar.bz2
gas/
* config/tc-ppc.c (md_apply_fix): On COFF targets, always reread "value" from fx_offset. Manually resubtract md_pcrel_from_section where necessary. gas/testsuite/ * gas/ppc/xcoff-branch-1.s, gas/ppc/xcoff-branch-1-32.d, gas/ppc/xcoff-branch-1-64.d: New tests. * gas/ppc/aix.exp: Run them.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 691d943..c3803b3 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5741,18 +5741,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
going to use the symbol value. That means that if the reloc is
fully resolved we want to use *valP since bfd_install_relocation is
not being used.
- However, if the reloc is not fully resolved we do not want to use
- *valP, and must use fx_offset instead. However, if the reloc
- is PC relative, we do want to use *valP since it includes the
- result of md_pcrel_from. This is confusing. */
+ However, if the reloc is not fully resolved we do not want to
+ use *valP, and must use fx_offset instead. If the relocation
+ is PC-relative, we then need to re-apply md_pcrel_from_section
+ to this new relocation value. */
if (fixP->fx_addsy == (symbolS *) NULL)
fixP->fx_done = 1;
- else if (fixP->fx_pcrel)
- ;
-
else
- value = fixP->fx_offset;
+ {
+ value = fixP->fx_offset;
+ if (fixP->fx_pcrel)
+ value -= md_pcrel_from_section (fixP, seg);
+ }
#endif
if (fixP->fx_subsy != (symbolS *) NULL)