powerpc-linux-as rejects legitimate addressing. (OK with .equ)
Alan Modra
amodra@bigpond.net.au
Thu Mar 27 23:24:00 GMT 2003
Please use binutils@sources.redhat.com or bug-binutils@gnu.org to
report assembler problems.
On Thu, Mar 27, 2003 at 02:49:56PM +1100, Erik Christiansen wrote:
> gas_test.s:11: Error: unsupported relocation against bargraph
>
> file: gas_test.s
> ========================================================================
> .align 2
>
> .=0x0130 # A)
> bargraph: # This should work, but as complains.
> .skip 4 #
>
> # B)
> # .equ bargraph , 0x130 # Assembles & runs OK, using this instead.
>
> bump_bargraph:
> lbz r7,bargraph(0) # Likes B), but not A).
Try this:
* config/tc-ppc.c (md_apply_fix3): Generate ADDR16 relocs.
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.66
diff -u -p -r1.66 tc-ppc.c
--- gas/config/tc-ppc.c 6 Feb 2003 01:24:17 -0000 1.66
+++ gas/config/tc-ppc.c 27 Mar 2003 14:23:11 -0000
@@ -5522,15 +5522,26 @@ md_apply_fix3 (fixP, valP, seg)
#if defined (OBJ_XCOFF) || defined (OBJ_ELF)
else if ((operand->flags & PPC_OPERAND_PARENS) != 0
&& operand->bits == 16
- && operand->shift == 0
- && ppc_is_toc_sym (fixP->fx_addsy))
+ && operand->shift == 0)
{
- fixP->fx_r_type = BFD_RELOC_PPC_TOC16;
+ if (ppc_is_toc_sym (fixP->fx_addsy))
+ {
+ fixP->fx_r_type = BFD_RELOC_PPC_TOC16;
#ifdef OBJ_ELF
- if (ppc_obj64
- && (operand->flags & PPC_OPERAND_DS) != 0)
- fixP->fx_r_type = BFD_RELOC_PPC64_TOC16_DS;
+ if (ppc_obj64
+ && (operand->flags & PPC_OPERAND_DS) != 0)
+ fixP->fx_r_type = BFD_RELOC_PPC64_TOC16_DS;
#endif
+ }
+ else
+ {
+ fixP->fx_r_type = BFD_RELOC_16;
+#ifdef OBJ_ELF
+ if (ppc_obj64
+ && (operand->flags & PPC_OPERAND_DS) != 0)
+ fixP->fx_r_type = BFD_RELOC_PPC64_ADDR16_DS;
+#endif
+ }
fixP->fx_size = 2;
if (target_big_endian)
fixP->fx_where += 2;
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Gcc-bugs
mailing list