[git commit] help: Document CROSS=

Rich Felker dalias at aerifal.cx
Thu May 10 02:07:15 UTC 2012


On Wed, May 09, 2012 at 05:19:48PM -0400, Mike Frysinger wrote:
> On Wednesday 09 May 2012 12:29:57 Rich Felker wrote:
> > Would it be possible to head in the direction of not neeting
> > CROSS_COMPILE/CROSS? That is, make it so the build system just works
> > with cross compiling as long as CC is set to the right compiler? I can
> > think of a few potential issues like the way stripping is performed
> > that might need a cross-specific tool other than CC
> 
> the current system uses ar and nm and ld directly.  the first two could be 
> moved to partial linking so there's only ld and cc, but i don't know if you 
> can do partial linking with gcc easily.  obviously stripping would still need 
> to be sep, but i think stripping isn't done by default, so that isn't a big 
> deal.

Partial linking can't replace ar because it won't avoid pulling in .o
files that aren't actually used. However, except for obscure
platforms, ar is platform independent; the utility works without any
regard for the target arch of the .o files being included. I suspect
nm is the same if you're using GNU binutils (at least as long as the
target and host are both ELF based) but I'm not sure. In other words,
I suspect the state of things is such that just invoking the host
utilities for these will work except in obscure use cases, and folks
with those use cases can handle setting CROSS_COMPILE or whatever.

As for stripping, it is done by default: the build system builds
busybox_unstripped with -g then uses strip to produce the plain
busybox binary. This is purely for the sake of aiding developers (and
it's very convenient!), but actually does not do what's desired
anymore due to changes in gcc and the toolchain. Ever since GCC
switched to using DWARF2 for debugging, gcc puts .eh_frame in the
output binary, and this is NOT removed by strip. Moreover, if you use
"strip -R .eh_frame", you'll corrupt your binary; see this bug report:

http://sourceware.org/bugzilla/show_bug.cgi?id=14037

So the only way to get a real, clean-stripped binary without ~100k of
useless debug/unwind info tacked onto it is by doing the original
build without -g and with -fno-asynchronous-unwind-tables
-fno-unwind-tables.

Rich


More information about the uClibc mailing list