Gcc/ld and long command lines (> 32k)

Johan Holmberg holmberg@iar.se
Fri Apr 9 10:05:00 GMT 2004


Ross Ridge wrote:
>
> You can try using an implicit linker script.  Create a file, call it
> something like "my-ld-script", with lines like the following:
>
>         INPUT(obj1.o obj2.o obj3.o)
>         INPUT(obj4.o, obj5.o, obj6.o)
>         INPUT(obj7.o)
>
> And then instead of linking with a command that looks something like this:
>
>         gcc -o foo.exe obj1.o obj2.o ... obj7.o -lbar -lbaz
>
> Use something like this:
>
>         gcc -o foo.exe my-ld-script -lbar -lbaz
>
>                                                 Ross Ridge

Many thanks !
This was just the kind of thing I was looking for.

By tweaking my build tool, it will be an easy thing to switch to this
kind of command line automatically when the command line gets too long
(and generating a linker script "on the fly").

I actually printed out the LD manual ("Using ld") yesterday.
But I missed the way "linker scripts" could be specified, when I first
looked through the text.

Just to test it, I will probably also try the @filename feature to
gcc.exe together with the "mount -X" to make gcc.exe communicate with
collect2/ld via the cygwin-specific way of passing arc/argv.

Thanks a lot for all the helpful answers.

/Johan Holmberg


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list