Re: information about ld invocation and defaults ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave Nadler wrote:
> Thanks Andrew, comments and further notes below,
> Best Regards, Dave
> 
> At 10:49 AM 11/23/2008, Andrew Haley wrote:
>> Dave Nadler wrote:
>> > Hi All - I'm a newbie with GCC and having a bit of a flail with
>> > rebuilding and understanding GCC interaction with LD and "configured
>> > default path" in the tools.
> 
> Sorry, should have clarified, I'm building a cross-compiler using
> 3.4.4 on cygwin for both build environment and target
> compiler sources.

Ah, Windows.

>> > I'd like to see the exact parameters with which ld is invoked by GCC. I
>> > added -wl,-t to the GCC line, and while this provides a lot of helpful
>> > information, some info seems missing, in particular:
>> > - exactly what is passed into ld as it is invoked ?
>>
>> gcc -v ...
> 
> Bingo ! Thanks, that really helps.
> 
>> > - ld cannot find "crt0.o"; OK tell me where did it look ?
>>
>> strace -f -etrace=file ld ...
> 
> C:\cygwin\bin\strace.exe: unknown option -- e
> 
> Can't ld provide this information ? Seems like it is generally helpful
> to anyone trying to debug a link step ?

ld will generally look where you tell it to look, and gcc provides
all the paths that you'll usually need.

>> > - ld cannot find "crt0.o"; OK tell me where it was given the
>> requirement
>> > to load it ?
>>
>> crt0 is the C RunTime startup.  No crt, no C.
> 
> Sure, but where did it get the requirement ? In this case the gcc -v
> option shows me, but for more complex link steps...

You should always link with gcc, and it will do the Right Thing.  Linking
manually with ld is usually a bad idea.  Really not for anyone who
is a newbie with GCC.

>> > - what is the definition of "sysroot prefix" for this build of ld ?
>>
>> I'm not sure that this question makes any sense.  The sysroot is
>> usually used after binutils are built and installed, when gcc
>> is built.
> 
> Right, but I'd like to be clear exactly what ld is trying to do
> in the case of an existing build, and again after I builld it...
>
>> I take it you're trying to cross-compile.  Have you installed
>> a C library for your target?

Right, so you can tell from "gcc -v" where it's trying to load crt0.o
from.  That should be the place where you installed your target's
C library.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux