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-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
	Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: PING^5 [PATCH] Use the section flag 'o' for __patchable_function_entries
Date: Tue, 1 Dec 2020 22:23:10 -0700	[thread overview]
Message-ID: <8193889c-5f8a-62f9-b064-f28ab8aa030e@redhat.com> (raw)
In-Reply-To: <CAMe9rOrFxRwW8Q=05N8L-9S7iPZm_nJMwp7XN6PRK3jLn=UwTQ@mail.gmail.com>



On 11/18/20 7:00 AM, H.J. Lu wrote:
> On Sat, Nov 7, 2020 at 7:47 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Sat, Oct 31, 2020 at 5:01 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Fri, Oct 23, 2020 at 5:41 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Fri, Oct 2, 2020 at 6:00 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> On Thu, Feb 6, 2020 at 6:57 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>> This commit in GNU binutils 2.35:
>>>>>>
>>>>>> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=b7d072167715829eed0622616f6ae0182900de3e
>>>>>>
>>>>>> added the section flag 'o' to .section directive:
>>>>>>
>>>>>> .section __patchable_function_entries,"awo",@progbits,foo
>>>>>>
>>>>>> which specifies the symbol name which the section references.  Assembler
>>>>>> creates a unique __patchable_function_entries section with the section,
>>>>>> where foo is defined, as its linked-to section.  Linker keeps a section
>>>>>> if its linked-to section is kept during garbage collection.
>>>>>>
>>>>>> This patch checks assembler support for the section flag 'o' and uses
>>>>>> it to implement __patchable_function_entries section.  Since Solaris may
>>>>>> use GNU assembler with Solairs ld.  Even if GNU assembler supports the
>>>>>> section flag 'o', it doesn't mean that Solairs ld supports it.  This
>>>>>> feature is disabled for Solairs targets.
>>>>>>
>>>>>> gcc/
>>>>>>
>>>>>>         PR middle-end/93195
>>>>>>         PR middle-end/93197
>>>>>>         * configure.ac (HAVE_GAS_SECTION_LINK_ORDER): New.  Define if
>>>>>>         the assembler supports the section flag 'o' for specifying
>>>>>>         section with link-order.
>>>>>>         * dwarf2out.c (output_comdat_type_unit): Pass 0 as flags2
>>>>>>         to targetm.asm_out.named_section.
>>>>>>         * config/sol2.c (solaris_elf_asm_comdat_section): Likewise.
>>>>>>         * output.h (SECTION2_LINK_ORDER): New.
>>>>>>         (switch_to_section): Add an unsigned int argument.
>>>>>>         (default_no_named_section): Likewise.
>>>>>>         (default_elf_asm_named_section): Likewise.
>>>>>>         * target.def (asm_out.named_section): Likewise.
>>>>>>         * targhooks.c (default_print_patchable_function_entry): Pass
>>>>>>         current_function_decl to get_section and SECTION2_LINK_ORDER
>>>>>>         to switch_to_section.
>>>>>>         * varasm.c (default_no_named_section): Add an unsigned int
>>>>>>         argument.
>>>>>>         (default_elf_asm_named_section): Add an unsigned int argument,
>>>>>>         flags2.  Use 'o' flag for SECTION2_LINK_ORDER if assembler
>>>>>>         supports it.
>>>>>>         (switch_to_section): Add an unsigned int argument and pass it
>>>>>>         to targetm.asm_out.named_section.
>>>>>>         (handle_vtv_comdat_section): Pass 0 to
>>>>>>         targetm.asm_out.named_section.
>>>>>>         * config.in: Regenerated.
>>>>>>         * configure: Likewise.
>>>>>>         * doc/tm.texi: Likewise.
>>>>>>
>>>>>> gcc/testsuite/
>>>>>>
>>>>>>         PR middle-end/93195
>>>>>>         * g++.dg/pr93195a.C: New test.
>>>>>>         * g++.dg/pr93195b.C: Likewise.
>>>>>>         * lib/target-supports.exp
>>>>>>         (check_effective_target_o_flag_in_section): New proc.
>>>>> PING
>>>>>
>>>>> https://gcc.gnu.org/pipermail/gcc-patches/2020-February/539963.html
>>>> PING.
>>>>
>>> PING.
>>>
>> PING.
> Here is a simpler patch.  OK for master?
>
> This commit in GNU binutils 2.35:
>
> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=b7d072167715
> 829eed0622616f6ae0182900de3e
>
> added the section flag 'o' to .section directive:
>
> .section __patchable_function_entries,"awo",@progbits,foo
>
> which specifies the symbol name which the section references.  Assembler
> creates a unique __patchable_function_entries section with the section,
> where foo is defined, as its linked-to section.  Linker keeps a section
> if its linked-to section is kept during garbage collection.
>
> This patch checks assembler support for the section flag 'o' and uses
> it to implement __patchable_function_entries section.  Since Solaris may
> use GNU assembler with Solairs ld.  Even if GNU assembler supports the
> section flag 'o', it doesn't mean that Solairs ld supports it.  This
> feature is disabled for Solairs targets.
>
> gcc/
>
> PR middle-end/93195
> PR middle-end/93197
> * configure.ac (HAVE_GAS_SECTION_LINK_ORDER): New.  Define 1 if
> the assembler supports the section flag 'o' for specifying
> section with link-order.
> * output.h (SECTION_LINK_ORDER): New.  Defined to 0x4000000.
> (SECTION_MACH_DEP): Changed from 0x4000000 to 0x8000000.
> * targhooks.c (default_print_patchable_function_entry): Pass
> SECTION_LINK_ORDER to switch_to_section if the section flag 'o'
> works.  Pass current_function_decl to switch_to_section.
> * varasm.c (default_elf_asm_named_section): Use 'o' flag for
> SECTION_LINK_ORDER if assembler supports it.
> * config.in: Regenerated.
> * configure: Likewise.
>
> gcc/testsuite/
>
> PR middle-end/93195
> * g++.dg/pr93195a.C: New test.
> * g++.dg/pr93195b.C: Likewise.
> * lib/target-supports.exp
> (check_effective_target_o_flag_in_section): New proc.
So you need to document the new effective target test in
sourcebuild.texi.  I see new #if in targhooks.c.  If that could be made
a if (...) it'd be greatly appreciated.

OK with those changes.

jeff


  reply	other threads:[~2020-12-02  5:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07  2:57 H.J. Lu
2020-10-02 13:00 ` PING: " H.J. Lu
2020-10-23 12:41   ` PING^2 " H.J. Lu
2020-10-31 12:01     ` PING^3 " H.J. Lu
2020-11-07 15:47       ` PING^4 " H.J. Lu
2020-11-18 14:00         ` PING^5 " H.J. Lu
2020-12-02  5:23           ` Jeff Law [this message]
2020-12-02 13:15             ` V2 " H.J. Lu
2020-12-15 20:48               ` [PATCH] varasm: Fix up __patchable_function_entries handling Jakub Jelinek
2020-12-16 13:36                 ` H.J. Lu
2020-12-16 13:47                   ` Jakub Jelinek
2020-12-16 14:18                     ` Jeff Law

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=8193889c-5f8a-62f9-b064-f28ab8aa030e@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.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).