public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Michael Matz <matz@suse.de>
Cc: Fangrui Song <maskray@google.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Binutils <binutils@sourceware.org>
Subject: Re: Suppress the fetch of an archive member via --defsym (glibc/elf/librtld.map.o)
Date: Sat, 11 Apr 2020 19:04:30 +0200	[thread overview]
Message-ID: <87a73i7y3l.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <alpine.LSU.2.21.2003161845540.30534@wotan.suse.de> (Michael Matz's message of "Mon, 16 Mar 2020 19:05:59 +0000 (UTC)")

* Michael Matz:

> On Mon, 16 Mar 2020, Fangrui Song via Binutils wrote:
>> I am concerned that the --defsym's order dependence with archive files is not
>> so obvious, given -u's behavior:
>> 
>> # -u inserts an undefined which fetches b.a(b.o)
>> ld.bfd -u foo b.a       # b.a(b.o) is fetched. free is present
>> # This can't be order dependent because b.a (not in a group) should have been
>> dropped when we saw -u
>> ld.bfd b.a -u foo       # b.a(b.o) is fetched. free is present
>> 
>> Some observations:
>> 
>> 
>> # GNU ld --defsym interacts with an archive
>> ld.bfd a.o b.a --defsym foo=0  # b.a(b.o) is fetched. free is present
>> ld.bfd --defsym foo=0 a.o b.a  # b.a(b.o) is not fetched. free is absent
>
> I consider this the correct linker behaviour.  In that sense I would 
> consider the inconsistency with -u and -T to be the problems of those, not 
> a problem of --defsym (but not necessarily problems we can fix anymore, as 
> people might rely on that).  (i.e. I think the second -u command above 
> should result in an 'undefined foo' output/error, not in b.a(b.o) being 
> fetched).

I agree, the ld.bfd behavior seems the most reasonable one to me.

  parent reply	other threads:[~2020-04-11 17:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16  4:58 Fangrui Song
2020-03-16  5:02 ` Fangrui Song
2020-03-16 11:27   ` H.J. Lu
2020-03-16 15:47     ` Fangrui Song
2020-03-16 16:01       ` H.J. Lu
2020-03-16 18:31       ` Fangrui Song
2020-03-16 19:05       ` Michael Matz
2020-03-21 16:39         ` Fangrui Song
2020-04-11 17:04         ` Florian Weimer [this message]
2020-04-11 18:16           ` Fangrui Song

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=87a73i7y3l.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=binutils@sourceware.org \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=matz@suse.de \
    /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).