public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/98125] [11 Regression] New test case g++.dg/pr93195a.C in r11-5656 has excess errors
Date: Tue, 30 Mar 2021 14:10:27 +0000	[thread overview]
Message-ID: <bug-98125-4-pt6s8NRZjM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98125-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Another more targeted partial reversion:
2021-03-30  Jakub Jelinek  <jakub@redhat.com>

        * targhooks.h (default_print_patchable_function_entry_1): Declare.
        * targhooks.c (default_print_patchable_function_entry_1): New function,
        copied from default_print_patchable_function_entry with an added flags
        argument.
        (default_print_patchable_function_entry): Rewritten into a small
        wrapper around default_print_patchable_function_entry_1.
        * config/rs6000/rs6000.c (TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY):
        Redefine.
        (rs6000_print_patchable_function_entry): New function.

--- gcc/targhooks.h.jj  2021-01-04 10:25:39.665224403 +0100
+++ gcc/targhooks.h     2021-03-30 15:48:42.826706369 +0200
@@ -230,6 +230,9 @@ extern bool default_use_by_pieces_infras
                                                    bool);
 extern int default_compare_by_pieces_branch_ratio (machine_mode);

+extern void default_print_patchable_function_entry_1 (FILE *,
+                                                     unsigned HOST_WIDE_INT,
+                                                     bool, unsigned int);
 extern void default_print_patchable_function_entry (FILE *,
                                                    unsigned HOST_WIDE_INT,
                                                    bool);
--- gcc/targhooks.c.jj  2021-01-04 10:25:38.974232228 +0100
+++ gcc/targhooks.c     2021-03-30 15:51:22.924932795 +0200
@@ -1832,17 +1832,15 @@ default_compare_by_pieces_branch_ratio (
   return 1;
 }

-/* Write PATCH_AREA_SIZE NOPs into the asm outfile FILE around a function
-   entry.  If RECORD_P is true and the target supports named sections,
-   the location of the NOPs will be recorded in a special object section
-   called "__patchable_function_entries".  This routine may be called
-   twice per function to put NOPs before and after the function
-   entry.  */
+/* Helper for default_print_patchable_function_entry and other
+   print_patchable_function_entry hook implementations.  */

 void
-default_print_patchable_function_entry (FILE *file,
-                                       unsigned HOST_WIDE_INT patch_area_size,
-                                       bool record_p)
+default_print_patchable_function_entry_1 (FILE *file,
+                                         unsigned HOST_WIDE_INT
+                                         patch_area_size,
+                                         bool record_p,
+                                         unsigned int flags)
 {
   const char *nop_templ = 0;
   int code_num;
@@ -1864,9 +1862,6 @@ default_print_patchable_function_entry (
       patch_area_number++;
       ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", patch_area_number);

-      unsigned int flags = SECTION_WRITE | SECTION_RELRO;
-      if (HAVE_GAS_SECTION_LINK_ORDER)
-       flags |= SECTION_LINK_ORDER;
       switch_to_section (get_section ("__patchable_function_entries",
                                      flags, current_function_decl));
       assemble_align (POINTER_SIZE);
@@ -1883,6 +1878,25 @@ default_print_patchable_function_entry (
     output_asm_insn (nop_templ, NULL);
 }

+/* Write PATCH_AREA_SIZE NOPs into the asm outfile FILE around a function
+   entry.  If RECORD_P is true and the target supports named sections,
+   the location of the NOPs will be recorded in a special object section
+   called "__patchable_function_entries".  This routine may be called
+   twice per function to put NOPs before and after the function
+   entry.  */
+
+void
+default_print_patchable_function_entry (FILE *file,
+                                       unsigned HOST_WIDE_INT patch_area_size,
+                                       bool record_p)
+{
+  unsigned int flags = SECTION_WRITE | SECTION_RELRO;
+  if (HAVE_GAS_SECTION_LINK_ORDER)
+    flags |= SECTION_LINK_ORDER;
+  default_print_patchable_function_entry_1 (file, patch_area_size, record_p,
+                                           flags);
+}
+
 bool
 default_profile_before_prologue (void)
 {
--- gcc/config/rs6000/rs6000.c.jj       2021-03-29 11:15:49.942202792 +0200
+++ gcc/config/rs6000/rs6000.c  2021-03-30 15:59:10.299755166 +0200
@@ -1341,6 +1341,9 @@ static const struct attribute_spec rs600
 #define TARGET_ASM_ASSEMBLE_VISIBILITY rs6000_assemble_visibility
 #endif

+#undef TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY
+#define TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY
rs6000_print_patchable_function_entry
+
 #undef TARGET_SET_UP_BY_PROLOGUE
 #define TARGET_SET_UP_BY_PROLOGUE rs6000_set_up_by_prologue

@@ -14642,6 +14645,30 @@ rs6000_assemble_visibility (tree decl, i
 }
 #endif


+/* Write PATCH_AREA_SIZE NOPs into the asm outfile FILE around a function
+   entry.  If RECORD_P is true and the target supports named sections,
+   the location of the NOPs will be recorded in a special object section
+   called "__patchable_function_entries".  This routine may be called
+   twice per function to put NOPs before and after the function
+   entry.  */
+
+void
+rs6000_print_patchable_function_entry (FILE *file,
+                                      unsigned HOST_WIDE_INT patch_area_size,
+                                      bool record_p)
+{
+  unsigned int flags = SECTION_WRITE | SECTION_RELRO;
+  /* When .opd section is emitted, the function symbol
+     default_print_patchable_function_entry_1 is emitted into the .opd section
+     while the patchable area is emitted into the function section.
+     Don't use SECTION_LINK_ORDER in that case.  */
+  if (!(TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2)
+      && HAVE_GAS_SECTION_LINK_ORDER)
+    flags |= SECTION_LINK_ORDER;
+  default_print_patchable_function_entry_1 (file, patch_area_size, record_p,
+                                           flags);
+}
+

 enum rtx_code
 rs6000_reverse_condition (machine_mode mode, enum rtx_code code)
 {

This will keep using SHF_LINK_ORDER for e.g. powerpc64-linux -m32 where it
seems to work fine,
doesn't touch powerpc64le-linux which seems to be broken for other reasons and
not a regression,
but will essentially (temporarily) disable SECTION_LINK_ORDER for the case that
regressed,
i.e. when rs6000_elf_declare_function_name emits .opd section and the function
symbol in it.
This would mean that for GCC11 powerpc64-linux -fpatchable-function-entry*
would keep working as before,
which means as long as --gc-sections isn't in effect.
What exactly should be emitted for .opd and "awo" as the symbol is something
I'd defer to Alan and H.J.,
but with this patch it could be handled for GCC12.

  parent reply	other threads:[~2021-03-30 14:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 16:31 [Bug testsuite/98125] New: " seurer at gcc dot gnu.org
2020-12-03 16:36 ` [Bug testsuite/98125] " hjl.tools at gmail dot com
2020-12-03 16:56 ` seurer at gcc dot gnu.org
2020-12-03 18:20 ` hjl.tools at gmail dot com
2020-12-03 20:18 ` hjl.tools at gmail dot com
2020-12-04  6:09 ` amodra at gmail dot com
2020-12-04  7:11 ` [Bug testsuite/98125] [11 Regression] " rguenth at gcc dot gnu.org
2020-12-04 12:00 ` amodra at gmail dot com
2020-12-07 21:45 ` amodra at gmail dot com
2021-01-14 11:01 ` rguenth at gcc dot gnu.org
2021-01-22 15:16 ` jakub at gcc dot gnu.org
2021-01-22 21:05 ` seurer at gcc dot gnu.org
2021-01-22 22:13 ` amodra at gmail dot com
2021-01-22 22:18 ` amodra at gmail dot com
2021-02-12 15:13 ` jakub at gcc dot gnu.org
2021-02-16  1:07 ` amodra at gmail dot com
2021-02-23 15:29 ` jakub at gcc dot gnu.org
2021-02-23 15:32 ` jakub at gcc dot gnu.org
2021-03-30 13:02 ` jakub at gcc dot gnu.org
2021-03-30 14:10 ` jakub at gcc dot gnu.org [this message]
2021-04-03  8:04 ` cvs-commit at gcc dot gnu.org
2021-04-03  8:16 ` jakub at gcc dot gnu.org

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-98125-4-pt6s8NRZjM@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).