+2013-09-04 Tristan Gingold <gingold@adacore.com>
+
+ * config/tc-ppc.c (md_apply_fix): Handle defined after use toc
+ symbols.
+
2013-09-04 Roland McGrath <mcgrathr@google.com>
PR gas/15914
&& (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;
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
}
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
+2013-09-04 Tristan Gingold <gingold@adacore.com>
+
+ * gas/ppc/aix.exp: Run xcoff-toc-1 test.
+ * gas/ppc/xcoff-toc-1.s, gas/ppc/xcoff-toc-1.d: New test.
+
2013-09-04 Roland McGrath <mcgrathr@google.com>
PR gas/15914
run_dump_test "xcoff-branch-1-64"
run_dump_test "xcoff-br16-1"
run_dump_test "xcoff-br16-2"
+ run_dump_test "xcoff-toc-1"
run_list_test "xcoff-ref-1"
--- /dev/null
+#as: -a32
+#source: xcoff-toc-1.s
+#objdump: -dr
+#name: XCOFF TOC reloc test 1
+
+.*
+Disassembly of section \.text:
+
+00000000 <\.foo>:
+ 0: 80 22 00 00 l r1,0\(r2\)
+ 2: R_TOC data-0x10010
+ 4: 4e 80 00 20 br