From 9f0eb2327b9c019347ecede4da1185ad21cca8af Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 14 Mar 2009 09:16:31 +0000 Subject: 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. --- gas/config/tc-ppc.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gas/config') 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) -- cgit v1.1