public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Rafael Ávila de Espíndola" <respindola@mozilla.com>
To: binutils@sourceware.org
Cc: iant@google.com
Subject: Re: [5/6][PATCH] Perform second link stage and ignore now-obsolete linker -pass-through= option.
Date: Sat, 26 Feb 2011 04:03:00 -0000	[thread overview]
Message-ID: <4D687B6C.1030301@mozilla.com> (raw)
In-Reply-To: <4D684D69.7060907@gmail.com>

On 2011-02-25 19:46, Dave Korn wrote:
> 
>     Hi list,
> 
>   This is the second main functional change, and it's really the only way to
> resolve the problems caused by discrepancies between the initial set of
> symbols returned by the plugin based on the LTO symtabs in the IR files, and
> the actual set of symbols used and defined by the eventual object file(s)
> added to the link after LTRANS.  It's largely the same approach as HJ's
> 2-stage link, except that it closes and reopens the existing input BFDs in
> place, rather than adding a second set of input statements.  This results in
> some different behaviour between HJ's linker and this patched version.
> 
> 
> ld/ChangeLog:
> 
> 2011-02-20  Dave Korn  <...
> 
> 	PR ld/12365
> 	* ldcref.c (cref_hash_table_free): New function.
> 	* ld.h (cref_hash_table_free): Add prototype.
> 	* ldlang.c (lang_gc_sections): Dont de-exclude claimed file sections.
> 	(set_exclude): New function.
> 	(reopen_inputs): Likewise.  Walk list of input objects, excluding
> 	claimed (IR-only) files and archive members, then re-walk list, closing
> 	and re-opening and re-adding the symbols from objects and libs.
> 	(lang_process): After opening plugin-supplied objects and scanning
> 	their library dependencies, tear down existing link, cref and
> 	already-linked-section hashes, erase link_info input bfds list, finally
> 	call reopen_inputs.
> 	* plugin.c (plugin_opt_plugin_arg): Discard any instances of the
> 	now-obsolete "-pass-through=" option if found.
> 
>   I know Ian would rather avoid this approach, but I don't think that there's
> any other way to do LTO in LD without either rearchitecting BFD quite a bit.
> We can't do symbol resolution without adding symbols from the LTO symtabs into
> the linker hash table, but then after LTRANS we may have a different final set
> of symbols present.  There's no way to excise individual symbols from the
> linker hash table in BFD, so you have to achieve the same effect by tearing
> down the symbol table and rebuilding it without adding the unwanted symbols at
> all second time round.  That means you have to close and reopen all the BFDs,
> because BFD backends cache pointers to hash table entries in the bfd's private
> data, which are now stale once you've built a new symbol table.  I can't see
> any way around having to re-do at least this amount of work, but without it
> we'll get bogus symbols in our final outputs, which is a real correctness issue.

Ian,

Assuming this is ok for bfd, would a patch implementing the same logic
be ok for gold? It would be bad to have different interfaces in bfd ld
and gold.

>     cheers,
>       DaveK
> 

Cheers,
Rafael

  parent reply	other threads:[~2011-02-26  4:03 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26  0:44 [PATCH,trunk+2.20] Fix issues in ld.bfd plugin interface [0/6] Dave Korn
2011-02-26  0:45 ` [PATCH,trunk+2.21] " Dave Korn
2011-02-26  0:45   ` [1/6][PATCH] Fix PE-COFF bug in orphan section alignment handling Dave Korn
2011-02-26  9:14     ` Alan Modra
2011-02-26  0:46   ` [5/6][PATCH] Perform second link stage and ignore now-obsolete linker -pass-through= option Dave Korn
2011-02-26  0:48     ` Dave Korn
2011-02-26  4:03     ` Rafael Ávila de Espíndola [this message]
2011-02-27 18:54       ` Ian Lance Taylor
2011-02-27 19:11         ` Rafael Ávila de Espíndola
2011-02-27 19:22           ` Ian Lance Taylor
2011-02-27 19:37             ` Rafael Ávila de Espíndola
2011-02-26  9:05     ` Alan Modra
2011-02-26  0:46   ` [4/6][PATCH] Fix issue from GCC PR47527: no ELF flags, EABI attribs, etc. in dummy IR BFD Dave Korn
2011-02-26  0:48     ` Dave Korn
2011-02-26  9:16       ` Alan Modra
2011-02-26  0:46   ` [3/6][PATCH] Revise linker plugin API to better preserve link order Dave Korn
2011-02-26  9:15     ` Alan Modra
2011-02-26  0:46   ` [2/6][PATCH] Do not use dummy bfd suffix for recognition, make it human-readable instead Dave Korn
2011-02-26  0:47   ` [6/6][PATCH] Respect symbol wrappers when computing symbol resolutions Dave Korn
2011-02-26  0:49     ` Dave Korn
2011-02-26  4:50     ` H.J. Lu
2011-02-26  9:28     ` Alan Modra
2011-02-26  0:47   ` [x/6][PATCH] Portability tweaks for LTO tests Dave Korn
2011-02-26  0:49     ` Dave Korn
2011-02-26  3:50     ` H.J. Lu
2011-02-26  5:33       ` H.J. Lu
2011-02-26  2:14 ` [PATCH,trunk+2.20] Fix issues in ld.bfd plugin interface [0/6] H.J. Lu
2011-02-26  3:37   ` Dave Korn
2011-02-26  3:48     ` H.J. Lu
2011-03-10 10:43 ` 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=4D687B6C.1030301@mozilla.com \
    --to=respindola@mozilla.com \
    --cc=binutils@sourceware.org \
    --cc=iant@google.com \
    /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).