From a1cb3768b1740a9473b292ff4410c2a2ed24f6177b5d4b1d6a977eed00fcad38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Tue, 8 Apr 2025 11:15:10 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main gcc13 revision 7e9c7d7c8233446811b1bcfb4c1d783b --- cross-aarch64-gcc13-bootstrap.spec | 2 +- cross-aarch64-gcc13.spec | 2 +- cross-amdgcn-gcc13.spec | 2 +- cross-arm-gcc13.spec | 2 +- cross-arm-none-gcc13-bootstrap.spec | 2 +- cross-arm-none-gcc13.spec | 2 +- cross-avr-gcc13-bootstrap.spec | 2 +- cross-avr-gcc13.spec | 2 +- cross-bpf-gcc13.spec | 2 +- cross-hppa-gcc13-bootstrap.spec | 2 +- cross-hppa-gcc13.spec | 2 +- cross-m68k-gcc13.spec | 2 +- cross-mips-gcc13.spec | 2 +- cross-nvptx-gcc13.spec | 2 +- cross-ppc64-gcc13.spec | 2 +- cross-ppc64le-gcc13-bootstrap.spec | 2 +- cross-ppc64le-gcc13.spec | 2 +- cross-pru-gcc13-bootstrap.spec | 2 +- cross-pru-gcc13.spec | 2 +- cross-riscv64-elf-gcc13-bootstrap.spec | 2 +- cross-riscv64-elf-gcc13.spec | 2 +- cross-riscv64-gcc13-bootstrap.spec | 2 +- cross-riscv64-gcc13.spec | 2 +- cross-rx-gcc13-bootstrap.spec | 2 +- cross-rx-gcc13.spec | 2 +- cross-s390x-gcc13-bootstrap.spec | 2 +- cross-s390x-gcc13.spec | 2 +- cross-sparc-gcc13.spec | 2 +- cross-sparc64-gcc13.spec | 2 +- cross-x86_64-gcc13.spec | 2 +- gcc.spec.in | 2 +- ...000-Adjust-fpatchable-function-entry.patch | 265 ------------------ gcc13-rs6000-msplit-patch-nops.patch | 201 +++++++++++++ gcc13-testresults.spec | 2 +- gcc13.changes | 8 + gcc13.spec | 2 +- 36 files changed, 242 insertions(+), 298 deletions(-) delete mode 100644 gcc13-rs6000-Adjust-fpatchable-function-entry.patch create mode 100644 gcc13-rs6000-msplit-patch-nops.patch diff --git a/cross-aarch64-gcc13-bootstrap.spec b/cross-aarch64-gcc13-bootstrap.spec index 45fea82..85bdf71 100644 --- a/cross-aarch64-gcc13-bootstrap.spec +++ b/cross-aarch64-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-aarch64-gcc13.spec b/cross-aarch64-gcc13.spec index 7147731..2d7e100 100644 --- a/cross-aarch64-gcc13.spec +++ b/cross-aarch64-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-amdgcn-gcc13.spec b/cross-amdgcn-gcc13.spec index b50f025..c7b0c62 100644 --- a/cross-amdgcn-gcc13.spec +++ b/cross-amdgcn-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-arm-gcc13.spec b/cross-arm-gcc13.spec index 6d527dc..89c697b 100644 --- a/cross-arm-gcc13.spec +++ b/cross-arm-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-arm-none-gcc13-bootstrap.spec b/cross-arm-none-gcc13-bootstrap.spec index 945b5d6..020b1cf 100644 --- a/cross-arm-none-gcc13-bootstrap.spec +++ b/cross-arm-none-gcc13-bootstrap.spec @@ -147,7 +147,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-arm-none-gcc13.spec b/cross-arm-none-gcc13.spec index 823b874..d7d38f1 100644 --- a/cross-arm-none-gcc13.spec +++ b/cross-arm-none-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-avr-gcc13-bootstrap.spec b/cross-avr-gcc13-bootstrap.spec index c4f5425..6a70048 100644 --- a/cross-avr-gcc13-bootstrap.spec +++ b/cross-avr-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-avr-gcc13.spec b/cross-avr-gcc13.spec index efbc602..97f8f42 100644 --- a/cross-avr-gcc13.spec +++ b/cross-avr-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-bpf-gcc13.spec b/cross-bpf-gcc13.spec index 7440679..09fc295 100644 --- a/cross-bpf-gcc13.spec +++ b/cross-bpf-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-hppa-gcc13-bootstrap.spec b/cross-hppa-gcc13-bootstrap.spec index 0009f32..aab57b2 100644 --- a/cross-hppa-gcc13-bootstrap.spec +++ b/cross-hppa-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-hppa-gcc13.spec b/cross-hppa-gcc13.spec index 3a08a7e..7404778 100644 --- a/cross-hppa-gcc13.spec +++ b/cross-hppa-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-m68k-gcc13.spec b/cross-m68k-gcc13.spec index 60a79d9..2e74bab 100644 --- a/cross-m68k-gcc13.spec +++ b/cross-m68k-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-mips-gcc13.spec b/cross-mips-gcc13.spec index a01aec1..79e6e00 100644 --- a/cross-mips-gcc13.spec +++ b/cross-mips-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-nvptx-gcc13.spec b/cross-nvptx-gcc13.spec index c474b03..153e3a1 100644 --- a/cross-nvptx-gcc13.spec +++ b/cross-nvptx-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-ppc64-gcc13.spec b/cross-ppc64-gcc13.spec index b09f78d..947ec6c 100644 --- a/cross-ppc64-gcc13.spec +++ b/cross-ppc64-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-ppc64le-gcc13-bootstrap.spec b/cross-ppc64le-gcc13-bootstrap.spec index edb7007..92a7f6c 100644 --- a/cross-ppc64le-gcc13-bootstrap.spec +++ b/cross-ppc64le-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-ppc64le-gcc13.spec b/cross-ppc64le-gcc13.spec index 1ee87d5..f53ca42 100644 --- a/cross-ppc64le-gcc13.spec +++ b/cross-ppc64le-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-pru-gcc13-bootstrap.spec b/cross-pru-gcc13-bootstrap.spec index 115e8f8..5fd22d2 100644 --- a/cross-pru-gcc13-bootstrap.spec +++ b/cross-pru-gcc13-bootstrap.spec @@ -147,7 +147,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-pru-gcc13.spec b/cross-pru-gcc13.spec index 0e0ead7..b4d62ef 100644 --- a/cross-pru-gcc13.spec +++ b/cross-pru-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-riscv64-elf-gcc13-bootstrap.spec b/cross-riscv64-elf-gcc13-bootstrap.spec index 89a193b..c2236eb 100644 --- a/cross-riscv64-elf-gcc13-bootstrap.spec +++ b/cross-riscv64-elf-gcc13-bootstrap.spec @@ -147,7 +147,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-riscv64-elf-gcc13.spec b/cross-riscv64-elf-gcc13.spec index e67c583..57ed8ec 100644 --- a/cross-riscv64-elf-gcc13.spec +++ b/cross-riscv64-elf-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-riscv64-gcc13-bootstrap.spec b/cross-riscv64-gcc13-bootstrap.spec index 598c7c7..099cfd3 100644 --- a/cross-riscv64-gcc13-bootstrap.spec +++ b/cross-riscv64-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-riscv64-gcc13.spec b/cross-riscv64-gcc13.spec index 2278e81..f79dcec 100644 --- a/cross-riscv64-gcc13.spec +++ b/cross-riscv64-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-rx-gcc13-bootstrap.spec b/cross-rx-gcc13-bootstrap.spec index 2885836..cd2cbaf 100644 --- a/cross-rx-gcc13-bootstrap.spec +++ b/cross-rx-gcc13-bootstrap.spec @@ -147,7 +147,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-rx-gcc13.spec b/cross-rx-gcc13.spec index 6e3a2b9..f8e9c61 100644 --- a/cross-rx-gcc13.spec +++ b/cross-rx-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-s390x-gcc13-bootstrap.spec b/cross-s390x-gcc13-bootstrap.spec index 9007699..aaa9c84 100644 --- a/cross-s390x-gcc13-bootstrap.spec +++ b/cross-s390x-gcc13-bootstrap.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-s390x-gcc13.spec b/cross-s390x-gcc13.spec index 88e5282..286cb62 100644 --- a/cross-s390x-gcc13.spec +++ b/cross-s390x-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-sparc-gcc13.spec b/cross-sparc-gcc13.spec index 5b59607..90f4d45 100644 --- a/cross-sparc-gcc13.spec +++ b/cross-sparc-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-sparc64-gcc13.spec b/cross-sparc64-gcc13.spec index ba80f2a..88ccb4a 100644 --- a/cross-sparc64-gcc13.spec +++ b/cross-sparc64-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/cross-x86_64-gcc13.spec b/cross-x86_64-gcc13.spec index 3d55661..e26760f 100644 --- a/cross-x86_64-gcc13.spec +++ b/cross-x86_64-gcc13.spec @@ -146,7 +146,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # Define the canonical target and host architecture # %%gcc_target_arch is supposed to be the full target triple diff --git a/gcc.spec.in b/gcc.spec.in index 355b4a4..996347b 100644 --- a/gcc.spec.in +++ b/gcc.spec.in @@ -403,7 +403,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch # GCC-TESTSUITE-DELETE-BEGIN # SRC-COMMON-END diff --git a/gcc13-rs6000-Adjust-fpatchable-function-entry.patch b/gcc13-rs6000-Adjust-fpatchable-function-entry.patch deleted file mode 100644 index fc4af5d..0000000 --- a/gcc13-rs6000-Adjust-fpatchable-function-entry.patch +++ /dev/null @@ -1,265 +0,0 @@ -From 8926dc1cbe8fa3b9ae35bf03ec503bbc40f9cf37 Mon Sep 17 00:00:00 2001 -From: Giuliano Belinassi -Date: Thu, 25 Jul 2024 11:54:22 -0300 -Subject: [PATCH] Backport rs6000: Adjust -fpatchable-function-entry* support - for dual entry - -Original message: -As the discussion in PR112980, although the current -implementation for -fpatchable-function-entry* conforms -with the documentation (making N NOPs be consecutive), -it's inefficient for both kernel and userspace livepatching -(see comments in PR for the details). - -So this patch is to change the current implementation by -emitting the "before" NOPs before global entry point and -the "after" NOPs after local entry point. The new behavior -would not keep NOPs to be consecutive, so the documentation -is updated to emphasize this - -Backport to gcc-13 - -Authored-by: Kewen Lin -Backported-by: Giuliano Belinassi - - PR target/112980 - -gcc/ChangeLog: - - * config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue): - Adjust the handling on patch area emitting with dual entry, remove - the restriction on "before" NOPs count, not emit "before" NOPs any - more but only emit "after" NOPs. - * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry): - Adjust by respecting cfun->machine->stop_patch_area_print. - (rs6000_elf_declare_function_name): For ELFv2 with dual entry, set - cfun->machine->stop_patch_area_print as true. - * config/rs6000/rs6000.h (struct machine_function): Remove member - global_entry_emitted, add new member stop_patch_area_print. - * doc/invoke.texi (option -fpatchable-function-entry): Adjust the - documentation for PowerPC ELFv2 dual entry. - -gcc/testsuite/ChangeLog: - - * c-c++-common/patchable_function_entry-default.c: Adjust. - * gcc.target/powerpc/pr99888-4.c: Likewise. - * gcc.target/powerpc/pr99888-5.c: Likewise. - * gcc.target/powerpc/pr99888-6.c: Likewise. - -Signed-off-by: Giuliano Belinassi ---- - gcc/config/rs6000/rs6000-logue.cc | 40 +++++-------------- - gcc/config/rs6000/rs6000.cc | 15 +++++-- - gcc/config/rs6000/rs6000.h | 10 +++-- - gcc/doc/invoke.texi | 8 ++-- - .../patchable_function_entry-default.c | 3 -- - gcc/testsuite/gcc.target/powerpc/pr99888-4.c | 4 +- - gcc/testsuite/gcc.target/powerpc/pr99888-5.c | 4 +- - gcc/testsuite/gcc.target/powerpc/pr99888-6.c | 4 +- - 8 files changed, 33 insertions(+), 55 deletions(-) - -diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc -index 208404e6864..3835bc943ad 100644 ---- a/gcc/config/rs6000/rs6000-logue.cc -+++ b/gcc/config/rs6000/rs6000-logue.cc -@@ -4001,43 +4001,21 @@ rs6000_output_function_prologue (FILE *file) - fprintf (file, "\tadd 2,2,12\n"); - } - -- unsigned short patch_area_size = crtl->patch_area_size; -- unsigned short patch_area_entry = crtl->patch_area_entry; -- /* Need to emit the patching area. */ -- if (patch_area_size > 0) -- { -- cfun->machine->global_entry_emitted = true; -- /* As ELFv2 ABI shows, the allowable bytes between the global -- and local entry points are 0, 4, 8, 16, 32 and 64 when -- there is a local entry point. Considering there are two -- non-prefixed instructions for global entry point prologue -- (8 bytes), the count for patchable nops before local entry -- point would be 2, 6 and 14. It's possible to support those -- other counts of nops by not making a local entry point, but -- we don't have clear use cases for them, so leave them -- unsupported for now. */ -- if (patch_area_entry > 0) -- { -- if (patch_area_entry != 2 -- && patch_area_entry != 6 -- && patch_area_entry != 14) -- error ("unsupported number of nops before function entry (%u)", -- patch_area_entry); -- rs6000_print_patchable_function_entry (file, patch_area_entry, -- true); -- patch_area_size -= patch_area_entry; -- } -- } -- - fputs ("\t.localentry\t", file); - assemble_name (file, name); - fputs (",.-", file); - assemble_name (file, name); - fputs ("\n", file); - /* Emit the nops after local entry. */ -- if (patch_area_size > 0) -- rs6000_print_patchable_function_entry (file, patch_area_size, -- patch_area_entry == 0); -+ unsigned short patch_area_size = crtl->patch_area_size; -+ unsigned short patch_area_entry = crtl->patch_area_entry; -+ if (patch_area_size > patch_area_entry) -+ { -+ cfun->machine->stop_patch_area_print = false; -+ patch_area_size -= patch_area_entry; -+ rs6000_print_patchable_function_entry (file, patch_area_size, -+ patch_area_entry == 0); -+ } - } - - else if (rs6000_pcrel_p ()) -diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc -index 2b876c90e6f..a08ed7466dd 100644 ---- a/gcc/config/rs6000/rs6000.cc -+++ b/gcc/config/rs6000/rs6000.cc -@@ -14936,12 +14936,14 @@ rs6000_print_patchable_function_entry (FILE *file, - bool record_p) - { - bool global_entry_needed_p = rs6000_global_entry_point_prologue_needed_p (); -- /* For a function which needs global entry point, we will emit the -- patchable area before and after local entry point under the control of -- cfun->machine->global_entry_emitted, see the handling in function -+ /* For a function which needs global entry point, we will only emit the -+ patchable area after local entry point under the control of -+ !cfun->machine->stop_patch_area_print, see the handling in functions - rs6000_output_function_prologue. */ -- if (!global_entry_needed_p || cfun->machine->global_entry_emitted) -+ if (!cfun->machine->stop_patch_area_print) - default_print_patchable_function_entry (file, patch_area_size, record_p); -+ else -+ gcc_assert (global_entry_needed_p); - } - - enum rtx_code -@@ -21115,6 +21117,11 @@ rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) - fprintf (file, "\t.previous\n"); - } - ASM_OUTPUT_LABEL (file, name); -+ /* At this time, the "before" NOPs have been already emitted, -+ let's stop generic code from printing the "after" NOPs and -+ emit just after local entry later. */ -+ if (rs6000_global_entry_point_prologue_needed_p ()) -+ cfun->machine->stop_patch_area_print = true; - } - - static void rs6000_elf_file_end (void) ATTRIBUTE_UNUSED; -diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h -index 9f02025b0c8..ebe97beb182 100644 ---- a/gcc/config/rs6000/rs6000.h -+++ b/gcc/config/rs6000/rs6000.h -@@ -2437,10 +2437,12 @@ typedef struct GTY(()) machine_function - bool lr_is_wrapped_separately; - bool toc_is_wrapped_separately; - bool mma_return_type_error; -- /* Indicate global entry is emitted, only useful when the function requires -- global entry. It helps to control the patchable area before and after -- local entry. */ -- bool global_entry_emitted; -+ /* With ELFv2 ABI dual entry points being adopted, generic framework -+ targetm.asm_out.print_patchable_function_entry would generate "after" -+ NOPs before local entry, it is wrong. This flag is to stop it from -+ printing patch area before local entry, it is only useful when the -+ function requires dual entry points. */ -+ bool stop_patch_area_print; - } machine_function; - #endif - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index b17d0cf9341..0cdc5ac8c61 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -17449,11 +17449,11 @@ If @code{N=0}, no pad location is recorded. - The NOP instructions are inserted at---and maybe before, depending on - @var{M}---the function entry address, even before the prologue. On - PowerPC with the ELFv2 ABI, for a function with dual entry points, --the local entry point is this function entry address. -+@var{M} NOP instructions are inserted before the global entry point and -+@var{N} - @var{M} NOP instructions are inserted after the local entry -+point, which means the NOP instructions may not be consecutive. - --The maximum value of @var{N} and @var{M} is 65535. On PowerPC with the --ELFv2 ABI, for a function with dual entry points, the supported values --for @var{M} are 0, 2, 6 and 14. -+The maximum value of @var{N} and @var{M} is 65535. - @end table - - -diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-default.c b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c -index 3ccbafc87db..899938b4aa3 100644 ---- a/gcc/testsuite/c-c++-common/patchable_function_entry-default.c -+++ b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c -@@ -1,9 +1,6 @@ - /* { dg-do compile { target { ! { nvptx*-*-* visium-*-* } } } } */ - /* { dg-options "-O2 -fpatchable-function-entry=3,1" } */ - /* { dg-additional-options "-fno-pie" { target sparc*-*-* } } */ --/* See PR99888, one single preceding nop isn't allowed on powerpc_elfv2, -- so overriding with two preceding nops to make it pass there. */ --/* { dg-additional-options "-fpatchable-function-entry=3,2" { target powerpc_elfv2 } } */ - /* { dg-final { scan-assembler-times "nop|NOP|SWYM" 3 { target { ! { alpha*-*-* riscv*-*-* } } } } } */ - /* { dg-final { scan-assembler-times "bis" 3 { target alpha*-*-* } } } */ - /* { dg-final { scan-assembler-times "nop\n" 3 { target riscv*-*-* } } } */ -diff --git a/gcc/testsuite/gcc.target/powerpc/pr99888-4.c b/gcc/testsuite/gcc.target/powerpc/pr99888-4.c -index 00a8d4d316e..6f23f2bb939 100644 ---- a/gcc/testsuite/gcc.target/powerpc/pr99888-4.c -+++ b/gcc/testsuite/gcc.target/powerpc/pr99888-4.c -@@ -2,12 +2,10 @@ - /* There is no global entry point prologue with pcrel. */ - /* { dg-options "-mno-pcrel -fpatchable-function-entry=1,1" } */ - --/* Verify one error emitted for unexpected 1 nop before local -- entry. */ -+/* Verify there is no error with 1 nop before local entry. */ - - extern int a; - - int test (int b) { - return a + b; - } --/* { dg-error "unsupported number of nops before function entry \\(1\\)" "" { target *-*-* } .-1 } */ -diff --git a/gcc/testsuite/gcc.target/powerpc/pr99888-5.c b/gcc/testsuite/gcc.target/powerpc/pr99888-5.c -index 39d3b4465f1..13f192ebd20 100644 ---- a/gcc/testsuite/gcc.target/powerpc/pr99888-5.c -+++ b/gcc/testsuite/gcc.target/powerpc/pr99888-5.c -@@ -2,12 +2,10 @@ - /* There is no global entry point prologue with pcrel. */ - /* { dg-options "-mno-pcrel -fpatchable-function-entry=7,3" } */ - --/* Verify one error emitted for unexpected 3 nops before local -- entry. */ -+/* Verify no error emitted for 3 nops before local entry. */ - - extern int a; - - int test (int b) { - return a + b; - } --/* { dg-error "unsupported number of nops before function entry \\(3\\)" "" { target *-*-* } .-1 } */ -diff --git a/gcc/testsuite/gcc.target/powerpc/pr99888-6.c b/gcc/testsuite/gcc.target/powerpc/pr99888-6.c -index c6c18dcc7ac..431c69cae9a 100644 ---- a/gcc/testsuite/gcc.target/powerpc/pr99888-6.c -+++ b/gcc/testsuite/gcc.target/powerpc/pr99888-6.c -@@ -2,8 +2,7 @@ - /* There is no global entry point prologue with pcrel. */ - /* { dg-options "-mno-pcrel" } */ - --/* Verify one error emitted for unexpected 4 nops before local -- entry. */ -+/* Verify no error emitted for 4 nops before local entry. */ - - extern int a; - -@@ -11,4 +10,3 @@ __attribute__ ((patchable_function_entry (20, 4))) - int test (int b) { - return a + b; - } --/* { dg-error "unsupported number of nops before function entry \\(4\\)" "" { target *-*-* } .-1 } */ --- -2.45.2 - diff --git a/gcc13-rs6000-msplit-patch-nops.patch b/gcc13-rs6000-msplit-patch-nops.patch new file mode 100644 index 0000000..ff2dd73 --- /dev/null +++ b/gcc13-rs6000-msplit-patch-nops.patch @@ -0,0 +1,201 @@ +From 1807ab6f3a5028ef0b7b30a37e947ea2c9d2bb18 Mon Sep 17 00:00:00 2001 +From: Richard Biener +Date: Wed, 13 Nov 2024 16:04:06 +0100 +Subject: [PATCH] rs6000: Add -msplit-patch-nops (PR112980) +To: gcc-patches@gcc.gnu.org + +From: Michael Matz + +as the bug report details some uses of -fpatchable-function-entry +aren't happy with the "before" NOPs being inserted between global and +local entry point on powerpc. We want the before NOPs be in front +of the global entry point. That means that the patching NOPs aren't +consecutive for dual entry point functions, but for these usecases +that's not the problem. But let us support both under the control +of a new target option: -msplit-patch-nops. + + gcc/ + + PR target/112980 + * config/rs6000/rs6000.opt (msplit-patch-nops): New option. + * doc/invoke.texi (RS/6000 and PowerPC Options): Document it. + * config/rs6000/rs6000.h (machine_function.stop_patch_area_print): + New member. + * config/rs6000/rs6000.cc (rs6000_print_patchable_function_entry): + Emit split nops under control of that one. + * config/rs6000/rs6000-logue.cc (rs6000_output_function_prologue): + Add handling of split patch nops. +--- + gcc/config/rs6000/rs6000-logue.cc | 15 +++++++++------ + gcc/config/rs6000/rs6000.cc | 27 +++++++++++++++++++++++---- + gcc/config/rs6000/rs6000.h | 6 ++++++ + gcc/config/rs6000/rs6000.opt | 4 ++++ + gcc/doc/invoke.texi | 17 +++++++++++++++-- + 5 files changed, 57 insertions(+), 12 deletions(-) + +diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc +index 208404e6864..0c3425fdd9a 100644 +--- a/gcc/config/rs6000/rs6000-logue.cc ++++ b/gcc/config/rs6000/rs6000-logue.cc +@@ -4003,8 +4003,8 @@ rs6000_output_function_prologue (FILE *file) + + unsigned short patch_area_size = crtl->patch_area_size; + unsigned short patch_area_entry = crtl->patch_area_entry; +- /* Need to emit the patching area. */ +- if (patch_area_size > 0) ++ /* Emit non-split patching area now. */ ++ if (!TARGET_SPLIT_PATCH_NOPS && patch_area_size > 0) + { + cfun->machine->global_entry_emitted = true; + /* As ELFv2 ABI shows, the allowable bytes between the global +@@ -4025,7 +4025,6 @@ rs6000_output_function_prologue (FILE *file) + patch_area_entry); + rs6000_print_patchable_function_entry (file, patch_area_entry, + true); +- patch_area_size -= patch_area_entry; + } + } + +@@ -4035,9 +4034,13 @@ rs6000_output_function_prologue (FILE *file) + assemble_name (file, name); + fputs ("\n", file); + /* Emit the nops after local entry. */ +- if (patch_area_size > 0) +- rs6000_print_patchable_function_entry (file, patch_area_size, +- patch_area_entry == 0); ++ if (patch_area_size > patch_area_entry) ++ { ++ patch_area_size -= patch_area_entry; ++ cfun->machine->stop_patch_area_print = false; ++ rs6000_print_patchable_function_entry (file, patch_area_size, ++ patch_area_entry == 0); ++ } + } + + else if (rs6000_pcrel_p ()) +diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc +index 2b876c90e6f..e6fbfe76e19 100644 +--- a/gcc/config/rs6000/rs6000.cc ++++ b/gcc/config/rs6000/rs6000.cc +@@ -14937,11 +14937,25 @@ rs6000_print_patchable_function_entry (FILE *file, + { + bool global_entry_needed_p = rs6000_global_entry_point_prologue_needed_p (); + /* For a function which needs global entry point, we will emit the +- patchable area before and after local entry point under the control of +- cfun->machine->global_entry_emitted, see the handling in function +- rs6000_output_function_prologue. */ +- if (!global_entry_needed_p || cfun->machine->global_entry_emitted) ++ patchable area when it isn't split before and after local entry point ++ under the control of cfun->machine->global_entry_emitted, see the ++ handling in function rs6000_output_function_prologue. */ ++ if (!TARGET_SPLIT_PATCH_NOPS ++ && (!global_entry_needed_p || cfun->machine->global_entry_emitted)) + default_print_patchable_function_entry (file, patch_area_size, record_p); ++ ++ /* For split patch nops we emit the before nops (from generic code) ++ in front of the global entry point and after the local entry point, ++ under the control of cfun->machine->stop_patch_area_print, see ++ rs6000_output_function_prologue and rs6000_elf_declare_function_name. */ ++ if (TARGET_SPLIT_PATCH_NOPS) ++ { ++ if (!cfun->machine->stop_patch_area_print) ++ default_print_patchable_function_entry (file, patch_area_size, ++ record_p); ++ else ++ gcc_assert (global_entry_needed_p); ++ } + } + + enum rtx_code +@@ -21115,6 +21129,11 @@ rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) + fprintf (file, "\t.previous\n"); + } + ASM_OUTPUT_LABEL (file, name); ++ /* At this time, the "before" NOPs have been already emitted. ++ For split nops stop generic code from printing the "after" NOPs and ++ emit them just after local entry ourself later. */ ++ if (rs6000_global_entry_point_prologue_needed_p ()) ++ cfun->machine->stop_patch_area_print = true; + } + + static void rs6000_elf_file_end (void) ATTRIBUTE_UNUSED; +diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h +index b8edba43d53..b5dae276420 100644 +--- a/gcc/config/rs6000/rs6000.h ++++ b/gcc/config/rs6000/rs6000.h +@@ -2443,6 +2443,12 @@ typedef struct GTY(()) machine_function + global entry. It helps to control the patchable area before and after + local entry. */ + bool global_entry_emitted; ++ /* With ELFv2 ABI dual entry points being adopted, generic framework ++ targetm.asm_out.print_patchable_function_entry would generate "after" ++ NOPs before local entry, which is wrong. This flag is to stop it from ++ printing patch area before local entry, it is only useful when the ++ function requires dual entry points. */ ++ bool stop_patch_area_print; + } machine_function; + #endif + +diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt +index 52507956a4d..6acd8c3c5ff 100644 +--- a/gcc/config/rs6000/rs6000.opt ++++ b/gcc/config/rs6000/rs6000.opt +@@ -300,6 +300,10 @@ mfull-toc + Target + Put everything in the regular TOC. + ++msplit-patch-nops ++Target Var(TARGET_SPLIT_PATCH_NOPS) Init(0) ++Emit NOPs before global and after local entry point for -fpatchable-function-entry. ++ + mvrsave + Target Var(TARGET_ALTIVEC_VRSAVE) Save + Generate VRSAVE instructions when generating AltiVec code. +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 89d4b24dd74..1b0cd6c8e26 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -1265,6 +1265,7 @@ See RS/6000 and PowerPC Options. + -mtraceback=@var{traceback_type} + -maix-struct-return -msvr4-struct-return + -mabi=@var{abi-type} -msecure-plt -mbss-plt ++-msplit-patch-nops + -mlongcall -mno-longcall -mpltseq -mno-pltseq + -mblock-move-inline-limit=@var{num} + -mblock-compare-inline-limit=@var{num} +@@ -17449,11 +17450,12 @@ If @code{N=0}, no pad location is recorded. + The NOP instructions are inserted at---and maybe before, depending on + @var{M}---the function entry address, even before the prologue. On + PowerPC with the ELFv2 ABI, for a function with dual entry points, +-the local entry point is this function entry address. ++the local entry point is this function entry address by default. See ++the @option{-msplit-patch-nops} option to change this. + + The maximum value of @var{N} and @var{M} is 65535. On PowerPC with the + ELFv2 ABI, for a function with dual entry points, the supported values +-for @var{M} are 0, 2, 6 and 14. ++for @var{M} are 0, 2, 6 and 14 when not using @option{-msplit-patch-nops}. + @end table + + +@@ -29486,6 +29488,17 @@ requires @code{.plt} and @code{.got} + sections that are both writable and executable. + This is a PowerPC 32-bit SYSV ABI option. + ++@opindex msplit-patch-nops ++@item -msplit-patch-nops ++When adding NOPs for a patchable area via the ++@option{-fpatchable-function-entry} option emit the ``before'' NOPs in front ++of the global entry point and the ``after'' NOPs after the local entry point. ++This makes the sequence of NOPs not consecutive when a global entry point ++is generated. Without this option the NOPs are emitted directly before and ++after the local entry point, making them consecutive but moving global and ++local entry point further apart. If only a single entry point is generated ++this option has no effect. ++ + @opindex misel + @opindex mno-isel + @item -misel +-- +2.43.0 + diff --git a/gcc13-testresults.spec b/gcc13-testresults.spec index 9a1dd5e..3da5a02 100644 --- a/gcc13-testresults.spec +++ b/gcc13-testresults.spec @@ -419,7 +419,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch Summary: Testsuite results License: SUSE-Public-Domain diff --git a/gcc13.changes b/gcc13.changes index e47ca2e..e605497 100644 --- a/gcc13.changes +++ b/gcc13.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Mar 27 10:05:46 UTC 2025 - Richard Biener + +- Replace gcc13-rs6000-Adjust-fpatchable-function-entry.patch with + a backport of the now upstream -msplit-patch-nops in + gcc13-rs6000-msplit-patch-nops.patch requried for user-space + livepatching on powerpc. + ------------------------------------------------------------------- Thu Mar 13 08:22:15 UTC 2025 - Richard Biener diff --git a/gcc13.spec b/gcc13.spec index f75dc1a..07aa187 100644 --- a/gcc13.spec +++ b/gcc13.spec @@ -398,7 +398,7 @@ Patch60: gcc44-textdomain.patch Patch61: gcc44-rename-info-files.patch # Feature backports Patch100: gcc13-pr88345-min-func-alignment.diff -Patch101: gcc13-rs6000-Adjust-fpatchable-function-entry.patch +Patch101: gcc13-rs6000-msplit-patch-nops.patch License: GPL-3.0-or-later Summary: The GNU C Compiler and Support Files