[ELDK] Compilation problems with ppc_85xx- of ELDK42 tool chain

Wolfgang Denk wd at denx.de
Thu Jul 14 12:39:33 CEST 2011

Dear krish,

In message <CAH57MOfPz-_hq4m=+o7puj1UdbBv7_vKyFuj6soS-Sv-WB9p=Q at mail.gmail.com> you wrote:
> When i tried to compile below program, i am getting following errors.
> Tool chain: ELDK42 (PowerPC, ppc_85xx)
> Error Message:
> (.text+0x20): relocation truncated to fit: R_PPC_REL24 against symbol
> //#define MAX_DATA_SEG    0x1Fbf728 /* The max value compilation success */
> #define MAX_DATA_SEG    0x2000000
> char gIntA[MAX_DATA_SEG] = {1};

Your data segment has become too big. This is a limitation of the
Power Architecture.  Don't put any such big data objects into the
(initialized) data segment, instead either allocate it through
malloc() or put it on the bss segment.  The folowing code is
equivalent to yours and builds fine:

	#include <stdio.h>

	#define MAX_DATA_SEG    0x2000000
	char gIntA[MAX_DATA_SEG];

	int main(int argc, char *argv[])
		gIntA[0] = 1;

		return 0;

Best regards,

Wolfgang Denk

DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There was no difference between  the  behavior  of  a  god  and  the
operations of pure chance..."   - Thomas Pynchon, _Gravity's Rainbow_

More information about the eldk mailing list