This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error: value of 4000000000002080 too large for field of 4 bytes


On Tue, Aug 02, 2005 at 12:43:45PM +0930, Alan Modra wrote:
> On Mon, Aug 01, 2005 at 05:10:50PM +1000, David Gibson wrote:
> > gcc4 can't be the problem; that's an assembler error.  I am using:
> 
> Yes, it is an assembler bug, present in current sources and all older
> versions I checked.  PowerPC gas prior to 2005-03-02 didn't tickle the
> bug because it didn't reduce "lparMapPhys" to "xLparMap+0x400...00000"
> and from there to ".data+0x4000...02080".  So with older gas, you
> had a reloc against lparMapPhys with offset 0, and an entry in the
> symbol table, section .data, value 0x4000...02080.  With newer gas,
> you (try to) have a reloc against .data with offset 0x4000...02080.
> It's this offset that gas is complaining about, because ppc gas writes
> the value into the section contents.  Of course, since ppc uses RELA
> type relocs (addend stored separately from the section contents), the
> section contents are immaterial;  ld will overwrite them with the
> relocated value.
> 
> 	* config/tc-ppc.c (md_apply_fix <ELF>): Don't warn on overflow
> 	if emitting a reloc.

Ah!  Does this mean with the fix below, I shouldn't need the
indirection of defining lparMapPhys, and could simply do:
	.long	xLparMap - KERNELBASE

Thanks Alan, have you pushed this fix upstream yet?

> Index: gas/config/tc-ppc.c
> ===================================================================
> RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
> retrieving revision 1.101
> diff -u -p -r1.101 tc-ppc.c
> --- gas/config/tc-ppc.c	5 Jul 2005 13:25:52 -0000	1.101
> +++ gas/config/tc-ppc.c	2 Aug 2005 03:06:18 -0000
> @@ -6014,6 +6014,13 @@ md_apply_fix (fixP, valP, seg)
>  
>  #ifdef OBJ_ELF
>    fixP->fx_addnumber = value;
> +
> +  /* PowerPC uses RELA relocs, ie. the reloc addend is stored separately
> +     from the section contents.  If we are going to be emitting a reloc
> +     then the section contents are immaterial, so don't warn if they
> +     happen to overflow.  Leave such warnings to ld.  */
> +  if (!fixP->fx_done)
> +    fixP->fx_no_overflow = 1;
>  #else
>    if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16)
>      fixP->fx_addnumber = 0;
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/people/dgibson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]