public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: "Rafael Espíndola" <rafael.espindola@gmail.com>,
	"Renato Golin" <renato.golin@linaro.org>,
	"Jan Hubicka" <hubicka@ucw.cz>, gcc <gcc@gcc.gnu.org>
Subject: Re: Fwd: LLVM collaboration?
Date: Tue, 11 Feb 2014 20:52:00 -0000	[thread overview]
Message-ID: <20140211205247.GA28709@kam.mff.cuni.cz> (raw)
In-Reply-To: <20140211185135.GA286@x4>

> On 2014.02.11 at 13:02 -0500, Rafael EspĂ­ndola wrote:
> > On 11 February 2014 12:28, Renato Golin <renato.golin@linaro.org> wrote:
> > > Now copying Rafael, which can give us some more insight on the LLVM LTO side.
> > 
> > Thanks.
> > 
> > > On 11 February 2014 09:55, Renato Golin <renato.golin@linaro.org> wrote:
> > >> Hi Jan,
> > >>
> > >> I think this is a very good example where we could all collaborate
> > >> (including binutils).
> > 
> > It is. Both LTO models (LLVM and GCC) were considered form the start
> > of the API design and I think we got a better plugin model as a
> > result.
> > 
> > >> If I got it right, LTO today:
> > >>
> > >> - needs the drivers to explicitly declare the plugin
> > >> - needs the library available somewhere
> > 
> > True.
> > 
> > >> - may have to change the library loading semantics (via LD_PRELOAD)
> > 
> > That depends on the library being loaded. RPATH works just fine too.
> > 
> > >> Since both toolchains do the magic, binutils has no incentive to
> > >> create any automatic detection of objects.
> > 
> > It is mostly a historical decision. At the time the design was for the
> > plugin to be matched to the compiler, and so the compiler could pass
> > that information down to the linker.
> > 
> > > The trouble however is that one needs to pass explicit --plugin argument
> > > specifying the particular plugin to load and so GCC ships with its own wrappers
> > > (gcc-nm/gcc-ld/gcc-ar and the gcc driver itself) while LLVM does similar thing.
> > 
> > These wrappers should not be necessary. While the linker currently
> > requires a command line option, bfd has support for searching for a
> > plugin. It will search <inst>/lib/bfd-plugin. See for example the
> > instructions at http://llvm.org/docs/GoldPlugin.html.
> 
> Please note that this automatic loading of the plugin only happens for
> non-ELF files. So the LLVM GoldPlugin gets loaded fine, but automatic
> loading of gcc's liblto_plugin.so doesn't work at the moment.

Hmm, something that ought to be fixed.  Binutils can probably know about GCC's
LTO symbols it uses as a distniguisher.  Is there a PR about this?
> 
> A basic implementation to support both plugins seamlessly should be
> pretty straightforward, because LLVM's bitstream file format (non-ELF)
> is easily distinguishable from gcc's output (standard ELF with special
> sections).

I think it is easy even with two plugins for same file format - all ld need is
to load the plugins and then do the file claiming for each of them.
GCC plugin then should not claim files from LLVM or incompatible GCC version
and vice versa.

Honza
> 
> -- 
> Markus

  reply	other threads:[~2014-02-11 20:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMSE1kdfpeLp6NEc+jnEWqi0KWV-+=Q701UsiLhgcn13X6fYcA@mail.gmail.com>
2014-02-07 21:34 ` Renato Golin
2014-02-07 21:53   ` Diego Novillo
2014-02-07 22:07     ` Renato Golin
2014-02-07 22:33       ` Andrew Pinski
2014-02-07 22:35         ` Renato Golin
2014-02-10 14:48       ` Diego Novillo
2014-02-07 22:28     ` Andrew Pinski
2014-02-07 22:23   ` Andrew Pinski
2014-02-07 22:42   ` Jonathan Wakely
2014-02-07 23:12     ` Renato Golin
2014-02-07 23:30   ` Fwd: " Joseph S. Myers
2014-02-07 23:59     ` Renato Golin
2014-02-11  2:29   ` Jan Hubicka
2014-02-11  9:55     ` Renato Golin
2014-02-11 10:03       ` Uday Khedker
2014-02-11 16:00         ` Jan Hubicka
2014-02-11 16:07           ` Uday Khedker
2014-02-11 16:18           ` Renato Golin
2014-02-11 17:29       ` Renato Golin
2014-02-11 18:02         ` Rafael Espíndola
2014-02-11 18:51           ` Markus Trippelsdorf
2014-02-11 20:52             ` Jan Hubicka [this message]
2014-02-11 21:20           ` Jan Hubicka
2014-02-11 21:38             ` Rafael Espíndola
2014-02-11 22:36               ` Hal Finkel
2014-09-17 21:41                 ` Hal Finkel
2014-02-12 11:10             ` Fwd: " Richard Biener
2014-02-12 13:15               ` Rafael Espíndola
2014-02-12 16:19               ` Joseph S. Myers
2014-02-12 16:23                 ` Jan Hubicka
2014-02-13  9:06                   ` Richard Biener

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=20140211205247.GA28709@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc@gcc.gnu.org \
    --cc=markus@trippelsdorf.de \
    --cc=rafael.espindola@gmail.com \
    --cc=renato.golin@linaro.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).