public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "i at maskray dot me" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/27492] Make static linking friendly with {ld.bfd,ld.lld} -z start-stop-gc: removing unused section '__libc_atexit'
Date: Sat, 17 Apr 2021 03:09:11 +0000	[thread overview]
Message-ID: <bug-27492-131-XNxTg4uudL@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27492-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27492

Fangrui Song <i at maskray dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |2.33
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Fangrui Song <i at maskray dot me> ---
Fixed by
https://sourceware.org/git/?p=glibc.git;a=commit;h=cd6ae7ea5431c2b8f16201fb0e2c413bf8d2df06

commit cd6ae7ea5431c2b8f16201fb0e2c413bf8d2df06
Author: Fangrui Song <maskray@google.com>
Date:   Fri Apr 16 11:26:39 2021

    Set the retain attribute on _elf_set_element if CC supports [BZ #27492]

    So that text_set_element/data_set_element/bss_set_element defined
    variables will be retained by the linker.

    Note: 'used' and 'retain' are orthogonal: 'used' makes sure the variable
    will not be optimized out; 'retain' prevents section garbage collection
    if the linker support SHF_GNU_RETAIN.

    GNU ld 2.37 and LLD 13 will support -z start-stop-gc which allow C
    identifier name sections to be GCed even if there are live
    __start_/__stop_ references.

    Without the change, there are some static linking problems, e.g.
    _IO_cleanup (libio/genops.c) may be discarded by ld --gc-sections, so
    stdout is not flushed on exit.

    Note: GCC may warning 'retain' attribute ignored while
__has_attribute(retain)
    is 1 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99587).

    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2021-04-17  3:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  8:37 [Bug libc/27492] New: " i at maskray dot me
2021-03-01 13:54 ` [Bug libc/27492] " fweimer at redhat dot com
2021-03-02  5:16 ` i at maskray dot me
2021-04-17  3:09 ` i at maskray dot me [this message]

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=bug-27492-131-XNxTg4uudL@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).