public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld resulting long command line arguments when calling collect2 workaround
@ 2004-04-07 23:13 J. Grant
  2004-04-07 23:20 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: J. Grant @ 2004-04-07 23:13 UTC (permalink / raw)
  To: binutils

Hello,

I think this is a binutils query, as it relates to ld calling collect2.
collect2 is part of gcc I noticed, so if this is a query for gcc please
let me know.

I am using an old ld v2.12 compiled on cygwin/ms-windows.  When
linking my c++ app, with g++, I have many objects.  I put all the
objects in a file and then use @make.objects to get them in-to the link
command.  If i specify them on the g++ command line when linking it
complains about a too long command line.

However, the problem is that ld/g++ seems to "expand" the @make.objects
file and pass all the filenames to the objects again on the command line
to collect2 (which appears to do the final linking and creation of elf
etc).  collect2 has the same problem with command line argument limit

Could someone tell me if there is a workaround to get ld/gcc/collect2 to
receive the make.objects file containing the list of objects please?

The other idea I had was to put all the objects in several smaller libs,
and then link those resulting libs.  However this is causing link
problems (some code seems to go missing, so I wanted to try linking all
the objects at the same time).

Any help appreciated.

Kind regards

JG


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld resulting long command line arguments when calling collect2 workaround
  2004-04-07 23:13 ld resulting long command line arguments when calling collect2 workaround J. Grant
@ 2004-04-07 23:20 ` Ian Lance Taylor
  2004-04-08 13:09   ` Dave Korn
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Lance Taylor @ 2004-04-07 23:20 UTC (permalink / raw)
  To: J. Grant; +Cc: binutils

"J. Grant" <jg-lists@jguk.org> writes:

> I think this is a binutils query, as it relates to ld calling collect2.
> collect2 is part of gcc I noticed, so if this is a query for gcc please
> let me know.

Note that it's the other way around.  gcc calls collect2 (which is
actually installed under the name ld) which then calls ld (the real
ld).  You can see this by using -Wl,-debug when you run gcc.

> However, the problem is that ld/g++ seems to "expand" the @make.objects
> file and pass all the filenames to the objects again on the command line
> to collect2 (which appears to do the final linking and creation of elf
> etc).  collect2 has the same problem with command line argument limit

I don't know what expands the @make.objects argument.  I very much
doubt that there is any code in gcc or collect2 or ld which expands
that argument.  If you are using cygwin, then perhaps the cygwin shell
expands it.

Presumably you run gcc with @make.objects.  gcc will then run
collect2.  My guess is that when gcc calls collect2, it passes all the
objects on the command line.  My guess is that that fails.  Since gcc
and collect2 are both part of gcc, I think that in order to change
this behaviour you will need to patch gcc.  I don't think that this is
a binutils issue, since I don't think there is anything you can change
in the binutils which will help.

> The other idea I had was to put all the objects in several smaller libs,
> and then link those resulting libs.  However this is causing link
> problems (some code seems to go missing, so I wanted to try linking all
> the objects at the same time).

Using --whole-archive might help when using archives.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: ld resulting long command line arguments when calling collect2 workaround
  2004-04-07 23:20 ` Ian Lance Taylor
@ 2004-04-08 13:09   ` Dave Korn
  2004-04-08 17:46     ` Dave Korn
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Korn @ 2004-04-08 13:09 UTC (permalink / raw)
  To: 'binutils'

> -----Original Message-----
> From: binutils-owner On Behalf Of Ian Lance Taylor
> Sent: 08 April 2004 00:20

> "J. Grant" writes:
 
> > However, the problem is that ld/g++ seems to "expand" the 
> @make.objects
> > file and pass all the filenames to the objects again on the 
> command line
> > to collect2 (which appears to do the final linking and 
> creation of elf
> > etc).  collect2 has the same problem with command line 
> argument limit
> 
> I don't know what expands the @make.objects argument.  I very much
> doubt that there is any code in gcc or collect2 or ld which expands
> that argument.  If you are using cygwin, then perhaps the cygwin shell
> expands it.

  WRS' cygwin-x-vxworks toolchain implements that feature.  It may have been
ported into the cygwin native tools as well, I'm not sure.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: ld resulting long command line arguments when calling collect2 workaround
  2004-04-08 13:09   ` Dave Korn
@ 2004-04-08 17:46     ` Dave Korn
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Korn @ 2004-04-08 17:46 UTC (permalink / raw)
  To: 'binutils'

> -----Original Message-----
> From: binutils-owner On Behalf Of Dave Korn
> Sent: 08 April 2004 14:08
> > -----Original Message-----
> > From: binutils-owner On Behalf Of Ian Lance Taylor
> > Sent: 08 April 2004 00:20
> 
> > "J. Grant" writes:
>  
> > > However, the problem is that ld/g++ seems to "expand" the 
> > @make.objects
> > > file and pass all the filenames to the objects again on the 
> > command line
> > > to collect2 (which appears to do the final linking and 
> > creation of elf
> > > etc).  collect2 has the same problem with command line 
> > argument limit
> > 
> > I don't know what expands the @make.objects argument.  I very much
> > doubt that there is any code in gcc or collect2 or ld which expands
> > that argument.  If you are using cygwin, then perhaps the 
> cygwin shell
> > expands it.
> 
>   WRS' cygwin-x-vxworks toolchain implements that feature.  
> It may have been
> ported into the cygwin native tools as well, I'm not sure.


BTW, the exact same discussion has come up just now on the cygwin list: see 

http://www.cygwin.com/ml/cygwin/2004-04/msg00285.html

and followups, in particular the one that recommends a solution at

http://cygwin.com/ml/cygwin/2004-03/msg01300.html

If JG wants more help, it would be appropriate to join the cygwin list,
since ISTM this is cyg-specific rather than binutils-specific.

http://www.cygwin.com/cygwin/lists.html


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-08 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-07 23:13 ld resulting long command line arguments when calling collect2 workaround J. Grant
2004-04-07 23:20 ` Ian Lance Taylor
2004-04-08 13:09   ` Dave Korn
2004-04-08 17:46     ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).