public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/99113] SHF_GNU_RETAIN doesn't work with Linux kernel
Date: Thu, 18 Feb 2021 21:27:59 +0000	[thread overview]
Message-ID: <bug-99113-4-F0TWNRuA2i@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99113-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99113

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

https://gcc.gnu.org/g:6347f4a0904fce17eedf5c071be6f3c118680290

commit r11-7284-g6347f4a0904fce17eedf5c071be6f3c118680290
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 15 11:31:12 2021 -0800

    Add retain attribute to place symbols in SHF_GNU_RETAIN section

    When building Linux kernel, ld in bninutils 2.36 with GCC 11 generates
    thousands of

    ld: warning: orphan section `.data.event_initcall_finish' from
`init/main.o' being placed in section `.data.event_initcall_finish'
    ld: warning: orphan section `.data.event_initcall_start' from `init/main.o'
being placed in section `.data.event_initcall_start'
    ld: warning: orphan section `.data.event_initcall_level' from `init/main.o'
being placed in section `.data.event_initcall_level'

    Since these sections are marked with SHF_GNU_RETAIN, they are placed in
    separate sections.  They become orphan sections since they aren't expected
    in the Linux kernel linker script. But orphan sections normally don't work
    well with the Linux kernel linker script and the resulting kernel crashed.

    Add the "retain" attribute to place symbols in separate SHF_GNU_RETAIN
    sections.  Issue a warning if the configured assembler/linker doesn't
    support SHF_GNU_RETAIN.

    gcc/

            PR target/99113
            * varasm.c (get_section): Replace SUPPORTS_SHF_GNU_RETAIN with
            looking up the retain attribute.
            (resolve_unique_section): Likewise.
            (get_variable_section): Likewise.
            (switch_to_section): Likewise.  Warn when a symbol without the
            retain attribute and a symbol with the retain attribute are
            placed in the section with the same name, instead of the used
            attribute.
            * doc/extend.texi: Document the "retain" attribute.

    gcc/c-family/

            PR target/99113
            * c-attribs.c (c_common_attribute_table): Add the "retain"
            attribute.
            (handle_retain_attribute): New function.

    gcc/testsuite/

            PR target/99113
            * c-c++-common/attr-retain-1.c: New test.
            * c-c++-common/attr-retain-2.c: Likewise.
            * c-c++-common/attr-retain-3.c: Likewise.
            * c-c++-common/attr-retain-4.c: Likewise.
            * c-c++-common/attr-retain-5.c: Likewise.
            * c-c++-common/attr-retain-6.c: Likewise.
            * c-c++-common/attr-retain-7.c: Likewise.
            * c-c++-common/attr-retain-8.c: Likewise.
            * c-c++-common/attr-retain-9.c: Likewise.
            * c-c++-common/pr99113.c: Likewise.
            * gcc.c-torture/compile/attr-retain-1.c: Likewise.
            * gcc.c-torture/compile/attr-retain-2.c: Likewise.
            * c-c++-common/attr-used.c: Don't expect SHF_GNU_RETAIN section.
            * c-c++-common/attr-used-2.c: Likewise.
            * c-c++-common/attr-used-3.c: Likewise.
            * c-c++-common/attr-used-4.c: Likewise.
            * c-c++-common/attr-used-9.c: Likewise.
            * gcc.c-torture/compile/attr-used-retain-1.c: Likewise.
            * gcc.c-torture/compile/attr-used-retain-2.c: Likewise.
            * c-c++-common/attr-used-5.c: Don't expect warning for the used
            attribute nor SHF_GNU_RETAIN section.
            * c-c++-common/attr-used-6.c: Likewise.
            * c-c++-common/attr-used-7.c: Likewise.
            * c-c++-common/attr-used-8.c: Likewise.

  parent reply	other threads:[~2021-02-18 21:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 18:32 [Bug target/99113] New: " hjl.tools at gmail dot com
2021-02-15 18:34 ` [Bug target/99113] " hjl.tools at gmail dot com
2021-02-15 18:54 ` slyfox at gcc dot gnu.org
2021-02-15 19:12 ` hjl.tools at gmail dot com
2021-02-15 19:31 ` slyfox at gcc dot gnu.org
2021-02-15 20:33 ` hjl.tools at gmail dot com
2021-02-15 20:34 ` hjl.tools at gmail dot com
2021-02-15 22:36 ` hjl.tools at gmail dot com
2021-02-16  7:28 ` rguenth at gcc dot gnu.org
2021-02-18 21:27 ` cvs-commit at gcc dot gnu.org [this message]
2021-02-18 21:29 ` hjl.tools at gmail dot com

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-99113-4-F0TWNRuA2i@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).