public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] LTO: Ignore undefined symbols without relocation
Date: Thu, 30 Jul 2020 19:02:14 +0930	[thread overview]
Message-ID: <20200730093214.GT9601@bubble.grove.modra.org> (raw)
In-Reply-To: <20200729222258.3016925-1-hjl.tools@gmail.com>

On Wed, Jul 29, 2020 at 03:22:58PM -0700, H.J. Lu via Binutils wrote:
> Normally an undefined symbol is treated as a reference.  Linker will
> try to satisfy the reference.  This feature is used to bring a symbol
> definition into output without explicit relocation.  If there is no
> definition nor relocation, linker will remove undefined symbol from
> symbol table in output (PR ld/4317).  But GCC 10 LTO may generate
> separate debug info files which contain undefined symbols without
> relocations:

Surely this is just a gcc bug?  We search libraries again after
loading the LTO output, so one would expect that undefined symbols
satisfied by an archive (or as-needed shared library) would lead to
extra files being linked.

I'd like to better understand just how this problem occurs though.  As
it is, I suspect there might be something else going on here, for
example, ranlib being run without a plugin when building the archives.

> 	(sym_cache): Moved before elf_link_hash_table.
> 	(elf_link_hash_table): Add sym_cache.

Please commit the above and related backend changes as a separate
patch, preapproved.

> 	* elflink.c (_bfd_elf_merge_symbol): After all LTO IR symbols
> 	have been read, skip all undefined symbols without relocation.
> 	(elf_link_add_object_symbols): Set has_reloc_after_lto_all_symbols_read
> 	after all LTO IR symbols have been read.

But not this bit just yet.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2020-07-30  9:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 22:22 H.J. Lu
2020-07-30  9:32 ` Alan Modra [this message]
2020-07-30 10:39   ` [PATCH] elf: Add sym_cache to elf_link_hash_table H.J. Lu
2020-07-30 11:51   ` [PATCH] LTO: Ignore undefined symbols without relocation H.J. Lu
2020-07-31  8:12     ` Alan Modra
2020-07-31  9:51       ` Nick Clifton
2020-07-31 10:07       ` Nick Clifton
2020-07-31 11:02         ` Alan Modra
2020-07-31 11:43           ` H.J. Lu
2020-07-31 15:47             ` V2 " H.J. Lu
2020-08-03  7:26               ` Alan Modra

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=20200730093214.GT9601@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.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).