public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: V4 [PATCH 3/3] Require .init_array/.fini_array support for SHF_GNU_RETAIN
Date: Tue, 15 Dec 2020 17:45:01 -0700	[thread overview]
Message-ID: <2cdf13b6-05ca-ef7e-7104-a1827b4d75b0@redhat.com> (raw)
In-Reply-To: <20201215173031.3242097-4-hjl.tools@gmail.com>



On 12/15/20 10:30 AM, H.J. Lu wrote:
> Since SHF_GNU_RETAIN support doesn't work for crtstuff.c which switches
> the output section directly with asm statement:
>
> ---
> static void __attribute__((used))
> __do_global_dtors_aux (void)
> {
>   static _Bool completed;
>
>   if (__builtin_expect (completed, 0))
>     return;
>   completed = 1;
> }
>
> static void __attribute__((__used__))
> call___do_global_dtors_aux (void)
> {
>   asm ("\t.section\t.fini");
>   __do_global_dtors_aux ();
>   asm ("\t.section\t.text");
> }
> ---
>
> use SHF_GNU_RETAIN only if .init_array/.fini_array section is supported.
>
> gcc/
>
> 	PR target/98146
> 	* defaults.h (SUPPORTS_SHF_GNU_RETAIN): New.
> 	* varasm.c (get_section): Replace HAVE_GAS_SHF_GNU_RETAIN with
> 	SUPPORTS_SHF_GNU_RETAIN.
> 	(resolve_unique_section): Likewise.
> 	(get_variable_section): Likewise.
> 	(switch_to_section): Likewise.
>
> gcc/testsuite/
>
> 	PR target/98146
> 	* lib/target-supports.exp
> 	(check_effective_target_R_flag_in_section): Also check
> 	HAVE_INITFINI_ARRAY_SUPPORT != 0.
Ah.  I didn't realize that you added this to the V4 patch.  OK.

jeff


      reply	other threads:[~2020-12-16  0:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 17:30 V4 [PATCH 0/3] Switch to a new section if the SECTION_RETAIN bit doesn't match H.J. Lu
2020-12-15 17:30 ` V4 [PATCH 1/3] " H.J. Lu
2020-12-16  0:44   ` Jeff Law
2020-12-16 13:01     ` H.J. Lu
2020-12-15 17:30 ` V4 [PATCH 2/3] Warn used and not used symbols in section with the same name H.J. Lu
2020-12-16  0:44   ` Jeff Law
2020-12-15 17:30 ` V4 [PATCH 3/3] Require .init_array/.fini_array support for SHF_GNU_RETAIN H.J. Lu
2020-12-16  0:45   ` Jeff Law [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=2cdf13b6-05ca-ef7e-7104-a1827b4d75b0@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.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).