Removing dependency to libgcc_s.so

Rob Landley rob at landley.net
Wed Jul 26 07:34:36 PDT 2006


On Tuesday 25 July 2006 9:45 pm, David Daney wrote:
> Rob Landley wrote:
> > On Tuesday 25 July 2006 9:04 pm, David Daney wrote:
> > 
> >>Something like this should do it:
> >>
> >>gcc -o hello-world -static-libgcc hello-world.c
> > 
> > 
> > Alas, busybox doesn't build the obvious way.  Our makefile is a strange, 
> > intricate contraption that calls $(CROSS_COMPILE)ld directly, and 
> > neither --static-libgcc nor -static-libgcc are options recognized by that 
> > sucker.  (collect2 yes, ld no.)
> > 
> 
> -static-libgcc is an option to the gcc driver program.  If you run ld 
> directly then you have to (should) emulate what gcc does (which can seen 
> by passing -v to gcc)
> 
> I'll take it on faith that there is a good reason to directly invoke ld, 
> instead of letting the compiler dirver do it for you.

I didn't write the makefile.  I intermittently spend a few days reading the 
make manual in an attempt to understand our makefiles, but I'm only up to 
about chapter 4.

When I do strange things like build standalone apps, I write a bash script to 
invoke the compiler.

> > Depends on how your toolchain got built.  If you have a shared libgcc_s.so 
> > there's always the danger that the stupid compiler will try to use it.
> >  
> > 
> 
> This seems to be a contradiction to what you say above.  If you are 
> invoking ld directly, then the compiler is not involved at all.

Looking more closely at it, we don't actually seem to be invoking ld directly 
to build the busybox executable.  I don't know why it's in Rules.mak, perhaps 
it's there to build the (currently still totally pointless) shared library.  
I know we don't specify libc directly (or if we do, I can't find it).

> It is  
> *you* that has to take care not to link in garbage.  But if you are 
> smarter than the compiler that should not be a problem.

I don't know what the default library search path is, what the C library is 
called on this particular system, whether we need crt0 or crt1...  Not going 
there.

> Note that that is a generic 'you' not you personally Rob.

I didn't write our makefiles.  One of my many, many background tasks is to 
learn enough make-fu to simplify our makefiles, which could use it.

I actually despise make on a conceptual level, because a language should be 
declarative or imperative and it should PICK ONE.

> David Daney.

Rob
-- 
Never bet against the cheap plastic solution.


More information about the busybox mailing list