On 11/18/20 7:00 AM, H.J. Lu wrote:
> On Sat, Nov 7, 2020 at 7:47 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>> On Sat, Oct 31, 2020 at 5:01 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>>> On Fri, Oct 23, 2020 at 5:41 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>>>> On Fri, Oct 2, 2020 at 6:00 AM H.J. Lu <hjl.to...@gmail.com> wrote:
>>>>> On Thu, Feb 6, 2020 at 6:57 PM H.J. Lu <hjl.to...@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 via email to