information about ld invocation and defaults ?

Andrew Haley
Mon Nov 24 12:27:00 GMT 2008

Dave Nadler wrote:
> At 04:11 PM 11/23/2008, Brian Dessent wrote:
>> Dave Nadler wrote:
>> > 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 ?
>> You can use -Wl,--verbose.
> I'll try that, Thanks !
>> > Sure, but where did it get the requirement ? In this case the gcc -v
>> option
>> > shows me, but for more complex link steps...
>> crt0.o comes from the libc, so if it is not being found then your C
>> library is not installed properly.  "properly" means that it should be
>> in $sysroot/lib if you configured gcc with a sysroot, otherwise
>> $prefix/$target/lib.  If you want to see where gcc thinks a file is
>> supposed to be located, you can use "gcc -print-file-name=crt0.o".
> I know the details of crt0 (too well), but I'm struggling a bit
> with the cross-compile. The GGC I built is not looking
> where I expect; hence the question. The -v option on GCC
> really helps here, but its not the whole story... I read:
> but I didn't quite follow the sysroot bit, Thanks !

The sysroot is supposed to contain a pre-installed root filesystem
when you configure gcc.  At a minimum, this is libc and its headers,
and a few kernel headers that libc needs.

>> > 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...
>> For these kind of things it's not about linker behavior.  gcc is the
>> component that knows where things like crt0.o are supposed to be
>> located, and passes the corresponding search directories to the linker.
>> So if it's not found, that means either the file isn't in the right
>> place or gcc wasn't configured to know the right place.
> Exactly; I'm trying to understand how I have managed to
> improperly configure GCC...

It would help a great deal if you told us how you configured gcc,
and the output of gcc -v.


More information about the Gcc-help mailing list