aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2013-09-04 12:28:11 +0000
committerTristan Gingold <gingold@adacore.com>2013-09-04 12:28:11 +0000
commitac21e7da5d0f378e2855df802d096a18ab41ac41 (patch)
treef18fdad2ee252b4c70a2891ab69b159c8e750926 /gas/config
parent74db7efbe3a09c00e5f4f5b99862f173258938f6 (diff)
downloadgdb-ac21e7da5d0f378e2855df802d096a18ab41ac41.zip
gdb-ac21e7da5d0f378e2855df802d096a18ab41ac41.tar.gz
gdb-ac21e7da5d0f378e2855df802d096a18ab41ac41.tar.bz2
gas/
* config/tc-ppc.c (md_apply_fix): Handle defined after use toc symbols. gas/testsuite/ * gas/ppc/aix.exp: Run xcoff-toc-1 test. * gas/ppc/xcoff-toc-1.s, gas/ppc/xcoff-toc-1.d: New test.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-ppc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 1631fb7..6b54f5a 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -3146,6 +3146,7 @@ md_assemble (char *str)
&& (operand->bitm & 0xfff0) == 0xfff0
&& operand->shift == 0)
{
+ /* Note: the symbol may be not yet defined. */
if (ppc_is_toc_sym (ex.X_add_symbol))
{
reloc = BFD_RELOC_PPC_TOC16;
@@ -6363,6 +6364,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
value = fixP->fx_offset;
fixP->fx_done = 1;
}
+
+ /* During parsing of instructions, a TOC16 reloc is generated for
+ instructions such as 'lwz RT,SYM(RB)' if SYM is a symbol defined
+ in the toc. But at parse time, SYM may be not yet defined, so
+ check again here. */
+ if (fixP->fx_r_type == BFD_RELOC_16
+ && fixP->fx_addsy != NULL
+ && ppc_is_toc_sym (fixP->fx_addsy))
+ fixP->fx_r_type = BFD_RELOC_PPC_TOC16;
#endif
}
@@ -6873,6 +6883,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_addnumber =
- bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixP->fx_addsy))
- S_GET_VALUE (ppc_toc_csect);
+ /* Set *valP to avoid errors. */
+ *valP = value;
#endif
}
#endif