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

Alan Modra amodra at bigpond.net.au
Tue Aug 2 13:13:45 EST 2005


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.

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;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Linuxppc64-dev mailing list