public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Dave Korn <dave.korn.cygwin@googlemail.com>
Cc: Steven Bosscher <stevenb.gcc@gmail.com>,
	Toon Moene <toon@moene.org>, 	gcc mailing list <gcc@gcc.gnu.org>,
	Bingfeng Mei <bmei@broadcom.com>
Subject: Re: LTO vs static library archives [was Re: lto1: internal compiler 	error: in lto_symtab_merge_decls_1, at lto-symtab.c:549]
Date: Thu, 29 Apr 2010 09:13:00 -0000	[thread overview]
Message-ID: <x2m84fc9c001004290157pd7187861g10595b75628fca20@mail.gmail.com> (raw)
In-Reply-To: <4BD906D5.1010408@gmail.com>

On Thu, Apr 29, 2010 at 6:11 AM, Dave Korn
<dave.korn.cygwin@googlemail.com> wrote:
> On 26/04/2010 10:46, Richard Guenther wrote:
>> On Mon, Apr 26, 2010 at 4:25 AM, Dave Korn wrote:
>
>>>  If I understand correctly, what we farm out to gold/lto-plugin is the task
>>> of identifying a) which archive members are required to be pulled into the
>>> final link depending on the undefined references found in the existing object
>>> files and b) what offsets those members begin at.
>
>> That's correct.  Now I delayed hacking this all into collect2
>> (because I don't think that's the correct place to do it).  I first
>> wanted to cleanup the driver <-> lto1 interface so we do _not_
>> rely on collect2 to identify LTO objects but instead have lto1
>> do that work and communicate final link objects to the driver
>> back via a response file (same for -fwhopr WPA / LTRANS
>> stage - do not exec lto1 from lto1 but rather tell the driver
>> the set of LTRANS files).
>>
>> That's also the only easy way to get rid of the .comm __gnu_lto_v2
>> marker and simply check the availability of one of the always
>> present LTO sections.  For ar archieves it is easy to iterate
>> through them and we need to re-write them anyway if we want
>> to support partly LTO / non-LTO objects inside an archive.
>>
>> Now of course if ar support ends up to look easy and sane in
>> the collect2 framework then we can choose to not wait for
>> somebody doing the above suggested cleanups ...
>
>  Actually, I'm about to argue that that's the correct place to do it, anyway.

Correct (I'll be working on that soon).

>  Isn't there going to be a problem that if we teach lto1 to look inside
> archives and extract members, it doesn't have the knowledge that the linker
> would have (cf. gold plugin) of which archive members will actually be needed
> in the final link, and that therefore it would have to assume any of the
> member objects might be needed and effectively recompile the entire library
> every link time?

Well, we'd then need to re-architect the symbol merging and
LTO unit read-in to properly honor linking semantics (drop
a LTO unit from an archive if it doesn't resolve any unresolved
symbols).  I don't know how easy that will be, but it shouldn't
be impossible at least.

>  I'm sketching a plan where collect2 invokes 'ld' as if to do an ordinary
> non-LTO link, but passes it a flag like "--lto-assist" which causes it to
> output a list of just the archive members that it actually needs to complete
> the link, in response file "filename.a@offset" format.  ISTM that this is the
> simplest method to avoid recompiling entire archives (sort of building a
> linker into the compiler!), and I guess I should also make it check for an LTO
> marker (whether symbol or section) and only output those members that actually
> contain any LTO data.

Yes - that would be basically a linker plugin without plugin support.
And I'd go even further and have LD provide a complete symbol
resolution set like we get from the gold linker-plugin.

That wouldn't help for old or non-gnu LDs of course.

>  Making lto1 understand archives seems logical at first, but I don't think
> it's much use without knowing which archive members we want in advance, and in
> that case the existing code that reads a single archive member by pretending
> it's an ordinary object file with a constant offset from the start of file
> marker already does all we need, or so it seems to me.

I think we should try without lto1 understanding archives first
(or we are basically re-implementing a linker in lto1).

Richard.

>    cheers,
>      DaveK
>
>

  parent reply	other threads:[~2010-04-29  8:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-24 13:48 lto1: internal compiler error: in lto_symtab_merge_decls_1, at lto-symtab.c:549 Toon Moene
2010-04-24 18:11 ` Richard Guenther
2010-04-25 11:28   ` Toon Moene
2010-04-25 19:34     ` Richard Guenther
2010-04-25 19:49       ` Steven Bosscher
2010-04-25 21:01         ` Richard Guenther
2010-04-25 22:16           ` Dave Korn
2010-04-25 22:21             ` Steven Bosscher
2010-04-26  2:13               ` Dave Korn
2010-04-26 10:00                 ` Richard Guenther
     [not found]                   ` <4BD906D5.1010408@gmail.com>
2010-04-29  9:13                     ` Richard Guenther [this message]
2010-04-29  9:21                       ` LTO vs static library archives [was Re: lto1: internal compiler error: in lto_symtab_merge_decls_1, at lto-symtab.c:549] Steven Bosscher
2010-04-29 13:03                         ` Richard Guenther
2010-04-29 14:08                       ` Jan Hubicka
2010-04-29 15:24                         ` Richard Guenther
2010-04-29 16:09                           ` Jan Hubicka
2010-04-29 14:27                       ` Ian Lance Taylor
2010-05-14 13:34     ` lto1: internal compiler error: in lto_symtab_merge_decls_1, at lto-symtab.c:549 Toon Moene
2010-05-14 13:40       ` Richard Guenther
2010-05-15  9:47         ` Toon Moene

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=x2m84fc9c001004290157pd7187861g10595b75628fca20@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=bmei@broadcom.com \
    --cc=dave.korn.cygwin@googlemail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=stevenb.gcc@gmail.com \
    --cc=toon@moene.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).