public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@wasabisystems.com>
To: "J. Grant" <jg-lists@jguk.org>
Cc: binutils <binutils@sourceware.org>
Subject: Re: ld resulting long command line arguments when calling collect2 workaround
Date: Wed, 07 Apr 2004 23:20:00 -0000	[thread overview]
Message-ID: <m3n05nqste.fsf@gossamer.airs.com> (raw)
In-Reply-To: <40748BE6.5090701@jguk.org>

"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

  reply	other threads:[~2004-04-07 23:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-07 23:13 J. Grant
2004-04-07 23:20 ` Ian Lance Taylor [this message]
2004-04-08 13:09   ` Dave Korn
2004-04-08 17:46     ` Dave Korn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3n05nqste.fsf@gossamer.airs.com \
    --to=ian@wasabisystems.com \
    --cc=binutils@sourceware.org \
    --cc=jg-lists@jguk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).