Compiling kernel with -g option.

Jerry Van Baren vanbaren_gerald at
Thu Nov 8 00:56:12 EST 2001

Relocation truncated to fit errors are typically caused by your executable
exceeding 16Mbytes (24 bits) in size (assuming it isn't caused by missing
modules and thus unresolved references).  It looks to me like more
aggressive optimizing (O2) is sufficient to get you below the 16Mbyte
mark.  Can you leave some things (less necessary or already debugged
things) out of your kernel or modularize them so that they don't have to be
linked in?

You might try making the code not relocatable to avoid the 24 bit address
limitation on position independent code, but I don't have any experience
with that option and it may cause all sorts of things to break.

 From the gcc manual, "IBM RS/6000 and PowerPC Options"

On embedded PowerPC systems generate code that allows (does not allow) the
program to be relocated to a different address at runtime. If you use
`-mrelocatable' on any module, all objects linked together must be compiled
with `-mrelocatable' or `-mrelocatable-lib'.


At 04:12 PM 11/6/01 -0800, Subodh Nijsure wrote:

>Sorry if this is "basic" question but I looked through mailing and couldn't
>find a solution.
>When I compile kernel and some of my own modules together I get tons
>of error like --
>relocation truncated to fit: R_PPC_REL24 copy_to_user
>However if I compile everything with -O2 options everything works fine,
>any way I can fix this so I can debug things....

** Sent via the linuxppc-embedded mail list. See

More information about the Linuxppc-embedded mailing list