public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Fangrui Song via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Makerules: Remove no-op -Wl,-d when linking libc_pic.os
Date: Sun, 26 Jun 2022 23:14:05 +0200	[thread overview]
Message-ID: <87tu87nn4y.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <20220626184025.553459-1-maskray@google.com> (Fangrui Song via Libc-alpha's message of "Sun, 26 Jun 2022 11:40:25 -0700")

* Fangrui Song via Libc-alpha:

> In GNU ld, -d assigns space to common symbols for -r (i.e. change common
> symbols to STB_GLOBAL definitions).  This option was added in commit
> da2d1bc5adf49352232ad0514e79fbd5dcae08e8 (1998) likely because ld at
> that time had a bug that common symbols did not override shared object
> definitions.  -d has been long unneeded and more so since -fno-common
> was added to +cflags.
> ---
>  Makerules | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/Makerules b/Makerules
> index dfe89e9e39..d1e139d03c 100644
> --- a/Makerules
> +++ b/Makerules
> @@ -633,14 +633,10 @@ LDFLAGS-c.so = -nostdlib -nostartfiles
>  LDLIBS-c.so += $(libc.so-gnulib)
>  # Give libc.so an entry point and make it directly runnable itself.
>  LDFLAGS-c.so += -e __libc_main
> -# Pre-link the objects of libc_pic.a so that we can locally resolve
> -# COMMON symbols before we link against ld.so.  This is because ld.so
> -# contains some of libc_pic.a already, which will prevent the COMMONs
> -# from being allocated in libc.so, which introduces evil dependencies
> -# between libc.so and ld.so, which can make it impossible to upgrade.
> +# Pre-link the objects of libc_pic.a for .gnu.glibc-stub.* processing.
>  $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
>  	$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
> -	$(LDFLAGS-c_pic.os) -Wl,-d $(whole-archive) $^ -o $@
> +	$(LDFLAGS-c_pic.os) $(whole-archive) $^ -o $@
>  
>  ifeq (,$(strip $(shlib-lds-flags)))
>  # Generate a list of -R options to excise .gnu.glibc-stub.* sections.

This looks okay to me, thanks.

Do you know what the .gnu.glibc-stub.* processing processing refers
to?

  reply	other threads:[~2022-06-26 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 18:40 Fangrui Song
2022-06-26 21:14 ` Florian Weimer [this message]
2022-06-26 22:29   ` Fangrui Song
2022-06-27  8:04     ` Florian Weimer
2022-06-27 19:56       ` 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=87tu87nn4y.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=libc-alpha@sourceware.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).