This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: powerpc-linux-as rejects legitimate addressing. (OK with .equ)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Erik Christiansen <erik at dd dot nec dot com dot au>
- Cc: gcc-bugs at gcc dot gnu dot org, binutils at sources dot redhat dot com
- Date: Fri, 28 Mar 2003 08:10:36 +1030
- Subject: Re: powerpc-linux-as rejects legitimate addressing. (OK with .equ)
- References: <20030327034956.GA787@dd.nec.com.au>
Please use binutils at sources dot redhat dot com or bug-binutils at gnu dot 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