From 65351ec6c7451b552e20bc730d0798340fc66923 Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Mon, 30 Mar 2026 11:21:34 -0400 Subject: [PATCH] import CS gcc-11.5.0-14.el9 --- ...or-for-tests-relying-on-stack-offset.patch | 74 ++++++ .../gcc11-fix-failures-with-default-SSP.patch | 244 +++++++++++++++++ .../gcc11-gcov-show-branches-and-calls.patch | 52 ++++ SPECS/gcc.spec | 251 ++++++++++++++++-- 4 files changed, 601 insertions(+), 20 deletions(-) create mode 100644 SOURCES/gcc11-disable-stack-protector-for-tests-relying-on-stack-offset.patch create mode 100644 SOURCES/gcc11-fix-failures-with-default-SSP.patch create mode 100644 SOURCES/gcc11-gcov-show-branches-and-calls.patch diff --git a/SOURCES/gcc11-disable-stack-protector-for-tests-relying-on-stack-offset.patch b/SOURCES/gcc11-disable-stack-protector-for-tests-relying-on-stack-offset.patch new file mode 100644 index 0000000..97859f0 --- /dev/null +++ b/SOURCES/gcc11-disable-stack-protector-for-tests-relying-on-stack-offset.patch @@ -0,0 +1,74 @@ +From 59a72acbccf4c81a04b4d09760fc8b16992de106 Mon Sep 17 00:00:00 2001 +From: Xi Ruoyao +Date: Sat, 24 Sep 2022 15:16:57 +0800 +Subject: aarch64: testsuite: disable stack protector for tests relying on + stack offset + +Stack protector needs a guard value on the stack and change the stack +layout. So we need to disable it for those tests, to avoid test failure +with --enable-default-ssp. + +gcc/testsuite/ChangeLog: + + * gcc.target/aarch64/shrink_wrap_1.c (dg-options): Add + -fno-stack-protector. + * gcc.target/aarch64/stack-check-cfa-1.c (dg-options): Add + -fno-stack-protector. + * gcc.target/aarch64/stack-check-cfa-2.c (dg-options): Add + -fno-stack-protector. + * gcc.target/aarch64/test_frame_17.c (dg-options): Add + -fno-stack-protector. +--- + gcc/testsuite/gcc.target/aarch64/shrink_wrap_1.c | 2 +- + gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c | 2 +- + gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c | 2 +- + gcc/testsuite/gcc.target/aarch64/test_frame_17.c | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gcc/testsuite/gcc.target/aarch64/shrink_wrap_1.c b/gcc/testsuite/gcc.target/aarch64/shrink_wrap_1.c +index ab7cd74ec3b4..067220c04a08 100644 +--- a/gcc/testsuite/gcc.target/aarch64/shrink_wrap_1.c ++++ b/gcc/testsuite/gcc.target/aarch64/shrink_wrap_1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { aarch64*-*-* } } } */ +-/* { dg-options "-O2" } */ ++/* { dg-options "-O2 -fno-stack-protector" } */ + /* { dg-final { check-function-bodies "**" "" } } */ + + /* +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c b/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c +index 6885894a97e0..412a9ed1aab0 100644 +--- a/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ ++/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables -fno-stack-protector" } */ + /* { dg-require-effective-target supports_stack_clash_protection } */ + + #define SIZE 128*1024 +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c b/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c +index 5796a53be067..e440569a0785 100644 +--- a/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ ++/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables -fno-stack-protector" } */ + /* { dg-require-effective-target supports_stack_clash_protection } */ + + #define SIZE 1280*1024 + 512 +diff --git a/gcc/testsuite/gcc.target/aarch64/test_frame_17.c b/gcc/testsuite/gcc.target/aarch64/test_frame_17.c +index 44f132911286..5d432ad0854e 100644 +--- a/gcc/testsuite/gcc.target/aarch64/test_frame_17.c ++++ b/gcc/testsuite/gcc.target/aarch64/test_frame_17.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2" } */ ++/* { dg-options "-O2 -fno-stack-protector" } */ + + /* Test reuse of stack adjustment temporaries. */ + +-- +cgit + diff --git a/SOURCES/gcc11-fix-failures-with-default-SSP.patch b/SOURCES/gcc11-fix-failures-with-default-SSP.patch new file mode 100644 index 0000000..ed984ae --- /dev/null +++ b/SOURCES/gcc11-fix-failures-with-default-SSP.patch @@ -0,0 +1,244 @@ +From 90c31ff339015ddd89ac519656fbd23a36ee6271 Mon Sep 17 00:00:00 2001 +From: Allan McRae +Date: Fri, 28 Jan 2022 12:44:08 -0500 +Subject: testsuite/70230 - fix failures with default SSP\ + +Configuring with --enable-default-ssp triggers various testsuite +failures. These contain asm statements that are not compatible with +-fstack-protector. Adding -fno-stack-protector to dg-options to +work around this issue. + +Tested on x86_64-linux. + + PR testsuite/70230 + * gcc.dg/asan/use-after-scope-4.c (dg-options): Add + -fno-stack-protector. + * gcc.dg/stack-usage-1.c: Likewise + * gcc.dg/superblock.c: Likewise + * gcc.target/i386/avx-vzeroupper-17.c: Likewise + * gcc.target/i386/cleanup-1.c: Likewise + * gcc.target/i386/cleanup-2.c: Likewise + * gcc.target/i386/interrupt-redzone-1.c: Likewise + * gcc.target/i386/interrupt-redzone-2.c: Likewise + * gcc.target/i386/pr79793-1.c: Likewise + * gcc.target/i386/pr79793-2.c: Likewise + * gcc.target/i386/shrink_wrap_1.c: Likewise + * gcc.target/i386/stack-check-11.c: Likewise + * gcc.target/i386/stack-check-18.c: Likewise + * gcc.target/i386/stack-check-19.c: Likewise + * gcc.target/i386/stackalign/pr88483-1.c: Likewise + * gcc.target/i386/stackalign/pr88483-2.c: Likewise + * gcc.target/i386/sw-1.c: Likewise + +Backported to gcc 11 by dmalcolm@redhat.com + This was r12-6922-g90c31ff339015d, modifying the change to sw-1.c + to avoid the change from r12-2671-gdadbb1a886af95. + +--- + gcc/testsuite/gcc.dg/asan/use-after-scope-4.c | 1 + + gcc/testsuite/gcc.dg/stack-usage-1.c | 2 +- + gcc/testsuite/gcc.dg/superblock.c | 2 +- + gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c | 2 +- + gcc/testsuite/gcc.target/i386/cleanup-1.c | 2 +- + gcc/testsuite/gcc.target/i386/cleanup-2.c | 2 +- + gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c | 2 +- + gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c | 2 +- + gcc/testsuite/gcc.target/i386/pr79793-1.c | 2 +- + gcc/testsuite/gcc.target/i386/pr79793-2.c | 2 +- + gcc/testsuite/gcc.target/i386/shrink_wrap_1.c | 2 +- + gcc/testsuite/gcc.target/i386/stack-check-11.c | 2 +- + gcc/testsuite/gcc.target/i386/stack-check-18.c | 2 +- + gcc/testsuite/gcc.target/i386/stack-check-19.c | 2 +- + gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c | 2 +- + gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c | 2 +- + gcc/testsuite/gcc.target/i386/sw-1.c | 2 +- + 17 files changed, 17 insertions(+), 16 deletions(-) + +diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c +index 44dc79535d2a..e1486e75045f 100644 +--- a/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c ++++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c +@@ -1,4 +1,5 @@ + // { dg-do run } ++/* { dg-options "-fno-stack-protector" } */ + + #define FN(NAME) \ + NAME (void) \ +diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c +index 93cfe7c01639..1d7d1fee4351 100644 +--- a/gcc/testsuite/gcc.dg/stack-usage-1.c ++++ b/gcc/testsuite/gcc.dg/stack-usage-1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-fstack-usage" } */ ++/* { dg-options "-fstack-usage -fno-stack-protector" } */ + /* nvptx doesn't have a reg allocator, and hence no stack usage data. */ + /* { dg-skip-if "" { nvptx-*-* } } */ + +diff --git a/gcc/testsuite/gcc.dg/superblock.c b/gcc/testsuite/gcc.dg/superblock.c +index 2b2fa9e154fb..6b4419adaf59 100644 +--- a/gcc/testsuite/gcc.dg/superblock.c ++++ b/gcc/testsuite/gcc.dg/superblock.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro" } */ ++/* { dg-options "-O2 -fno-asynchronous-unwind-tables -fsched2-use-superblocks -fdump-rtl-sched2 -fdump-rtl-bbro -fno-stack-protector" } */ + /* { dg-require-effective-target scheduling } */ + + typedef int aligned __attribute__ ((aligned (64))); +diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c +index 6dc0dc053214..d677e6f10e01 100644 +--- a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c ++++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-17.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target lp64 } } */ +-/* { dg-options "-O2 -mavx -mabi=ms -dp" } */ ++/* { dg-options "-O2 -mavx -mabi=ms -dp -fno-stack-protector" } */ + + typedef float __m256 __attribute__ ((__vector_size__ (32), __may_alias__)); + +diff --git a/gcc/testsuite/gcc.target/i386/cleanup-1.c b/gcc/testsuite/gcc.target/i386/cleanup-1.c +index dcfcc4edb5fa..6e7544c6b7ac 100644 +--- a/gcc/testsuite/gcc.target/i386/cleanup-1.c ++++ b/gcc/testsuite/gcc.target/i386/cleanup-1.c +@@ -1,5 +1,5 @@ + /* { dg-do run { target *-*-linux* *-*-gnu* } } */ +-/* { dg-options "-fexceptions -fnon-call-exceptions -fasynchronous-unwind-tables -O2" } */ ++/* { dg-options "-fexceptions -fnon-call-exceptions -fasynchronous-unwind-tables -O2 -fno-stack-protector" } */ + /* Test complex CFA value expressions. */ + + #include +diff --git a/gcc/testsuite/gcc.target/i386/cleanup-2.c b/gcc/testsuite/gcc.target/i386/cleanup-2.c +index 7e60323373b8..a24daba73da2 100644 +--- a/gcc/testsuite/gcc.target/i386/cleanup-2.c ++++ b/gcc/testsuite/gcc.target/i386/cleanup-2.c +@@ -1,5 +1,5 @@ + /* { dg-do run { target { *-*-linux* && { ! ia32 } } } } */ +-/* { dg-options "-fexceptions -fnon-call-exceptions -fasynchronous-unwind-tables -O2" } */ ++/* { dg-options "-fexceptions -fnon-call-exceptions -fasynchronous-unwind-tables -O2 -fno-stack-protector" } */ + /* Test complex CFA value expressions. */ + + #include +diff --git a/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c b/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c +index 10098848c506..0c412db427e3 100644 +--- a/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c ++++ b/gcc/testsuite/gcc.target/i386/interrupt-redzone-1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { ! ia32 } } } */ +-/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mred-zone" } */ ++/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mred-zone -fno-stack-protector" } */ + + void + __attribute__((interrupt)) +diff --git a/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c +index 2577f43c9168..caea99665f23 100644 +--- a/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c ++++ b/gcc/testsuite/gcc.target/i386/interrupt-redzone-2.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { ! ia32 } } } */ +-/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mred-zone" } */ ++/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mred-zone -fno-stack-protector" } */ + + void + __attribute__((interrupt)) +diff --git a/gcc/testsuite/gcc.target/i386/pr79793-1.c b/gcc/testsuite/gcc.target/i386/pr79793-1.c +index 1cc67a83ba39..102d63afe8d9 100644 +--- a/gcc/testsuite/gcc.target/i386/pr79793-1.c ++++ b/gcc/testsuite/gcc.target/i386/pr79793-1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +-/* { dg-options "-O2 -mgeneral-regs-only -mtune=generic" } */ ++/* { dg-options "-O2 -mgeneral-regs-only -mtune=generic -fno-stack-protector" } */ + + void + __attribute__ ((interrupt)) +diff --git a/gcc/testsuite/gcc.target/i386/pr79793-2.c b/gcc/testsuite/gcc.target/i386/pr79793-2.c +index e1e6463e120a..30f22bea9884 100644 +--- a/gcc/testsuite/gcc.target/i386/pr79793-2.c ++++ b/gcc/testsuite/gcc.target/i386/pr79793-2.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +-/* { dg-options "-O2 -mgeneral-regs-only -mtune=generic" } */ ++/* { dg-options "-O2 -mgeneral-regs-only -mtune=generic -fno-stack-protector" } */ + + typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +diff --git a/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c b/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c +index 94dadd6cdbd8..4b286671e90b 100644 +--- a/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c ++++ b/gcc/testsuite/gcc.target/i386/shrink_wrap_1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile { target { ! ia32 } } } */ +-/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */ ++/* { dg-options "-O2 -fdump-rtl-pro_and_epilogue -fno-stack-protector" } */ + + enum machine_mode + { +diff --git a/gcc/testsuite/gcc.target/i386/stack-check-11.c b/gcc/testsuite/gcc.target/i386/stack-check-11.c +index 90ab6023b422..48341cedcd4b 100644 +--- a/gcc/testsuite/gcc.target/i386/stack-check-11.c ++++ b/gcc/testsuite/gcc.target/i386/stack-check-11.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fstack-clash-protection -mtune=generic" } */ ++/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fno-stack-protector" } */ + /* { dg-require-effective-target supports_stack_clash_protection } */ + + #include +diff --git a/gcc/testsuite/gcc.target/i386/stack-check-18.c b/gcc/testsuite/gcc.target/i386/stack-check-18.c +index 1cf4bbcfafb5..a0aab4a98238 100644 +--- a/gcc/testsuite/gcc.target/i386/stack-check-18.c ++++ b/gcc/testsuite/gcc.target/i386/stack-check-18.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */ ++/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand -fno-stack-protector" } */ + /* { dg-require-effective-target supports_stack_clash_protection } */ + /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ + +diff --git a/gcc/testsuite/gcc.target/i386/stack-check-19.c b/gcc/testsuite/gcc.target/i386/stack-check-19.c +index bf6af5ffc3e9..94c75dcb47ce 100644 +--- a/gcc/testsuite/gcc.target/i386/stack-check-19.c ++++ b/gcc/testsuite/gcc.target/i386/stack-check-19.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */ ++/* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand -fno-stack-protector" } */ + /* { dg-require-effective-target supports_stack_clash_protection } */ + /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ + +diff --git a/gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c b/gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c +index c8bb0832fe26..11ecdd52aa15 100644 +--- a/gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c ++++ b/gcc/testsuite/gcc.target/i386/stackalign/pr88483-1.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -mavx2" } */ ++/* { dg-options "-O2 -mavx2 -fno-stack-protector" } */ + + struct B + { +diff --git a/gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c b/gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c +index e94fa1d18fad..33174fa29dec 100644 +--- a/gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c ++++ b/gcc/testsuite/gcc.target/i386/stackalign/pr88483-2.c +@@ -1,5 +1,5 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -mavx512f" } */ ++/* { dg-options "-O2 -mavx512f -fno-stack-protector" } */ + + struct B + { +diff --git a/gcc/testsuite/gcc.target/i386/sw-1.c b/gcc/testsuite/gcc.target/i386/sw-1.c +index a9c89fca4ec4..b0432279644a 100644 +--- a/gcc/testsuite/gcc.target/i386/sw-1.c ++++ b/gcc/testsuite/gcc.target/i386/sw-1.c +@@ -1,4 +1,4 @@ + /* { dg-do compile } */ +-/* { dg-options "-O2 -mtune=generic -fshrink-wrap -fdump-rtl-pro_and_epilogue" } */ ++/* { dg-options "-O2 -mtune=generic -fshrink-wrap -fdump-rtl-pro_and_epilogue -fno-stack-protector" } */ + /* { dg-skip-if "No shrink-wrapping preformed" { x86_64-*-mingw* } } */ + +-- +cgit + diff --git a/SOURCES/gcc11-gcov-show-branches-and-calls.patch b/SOURCES/gcc11-gcov-show-branches-and-calls.patch new file mode 100644 index 0000000..d2fe4d4 --- /dev/null +++ b/SOURCES/gcc11-gcov-show-branches-and-calls.patch @@ -0,0 +1,52 @@ +diff --git a/gcc/gcov.c b/gcc/gcov.c +index cf0a49d8c30..e9cd2f5505d 100644 +--- a/gcc/gcov.c ++++ b/gcc/gcov.c +@@ -1497,11 +1497,16 @@ generate_results (const char *file_name) + memset (&coverage, 0, sizeof (coverage)); + coverage.name = fn->get_name (); + add_line_counts (flag_function_summary ? &coverage : NULL, fn); +- if (flag_function_summary) +- { +- function_summary (&coverage); +- fnotice (stdout, "\n"); +- } ++ ++ if (!flag_function_summary) ++ continue; ++ ++ for (const block_info& block : fn->blocks) ++ for (arc_info *arc = block.succ; arc; arc = arc->succ_next) ++ add_branch_counts (&coverage, arc); ++ ++ function_summary (&coverage); ++ fnotice (stdout, "\n"); + } + + name_map needle; +@@ -2480,6 +2485,25 @@ function_summary (const coverage_info *coverage) + { + fnotice (stdout, "%s '%s'\n", "Function", coverage->name); + executed_summary (coverage->lines, coverage->lines_executed); ++ ++ if (coverage->branches) ++ { ++ fnotice (stdout, "Branches executed:%s of %d\n", ++ format_gcov (coverage->branches_executed, coverage->branches, 2), ++ coverage->branches); ++ fnotice (stdout, "Taken at least once:%s of %d\n", ++ format_gcov (coverage->branches_taken, coverage->branches, 2), ++ coverage->branches); ++ } ++ else ++ fnotice (stdout, "No branches\n"); ++ ++ if (coverage->calls) ++ fnotice (stdout, "Calls executed:%s of %d\n", ++ format_gcov (coverage->calls_executed, coverage->calls, 2), ++ coverage->calls); ++ else ++ fnotice (stdout, "No calls\n"); + } + + /* Output summary info for a file. */ diff --git a/SPECS/gcc.spec b/SPECS/gcc.spec index f2a7930..e05a5f5 100644 --- a/SPECS/gcc.spec +++ b/SPECS/gcc.spec @@ -5,7 +5,7 @@ %global gcc_major 11 # Note, gcc_release must be integer, if you want to add suffixes to # %%{release}, append them after %%{gcc_release} on Release: line. -%global gcc_release 11 +%global gcc_release 14 %global nvptx_tools_gitrev 5f6f343a302d620b0868edab376c00b15741e39e %global newlib_cygwin_gitrev 50e2a63b04bdd018484605fbb954fd1bd5147fa0 %global _unpackaged_files_terminate_build 0 @@ -124,8 +124,7 @@ %dnl rhel != 9 %global build_cross 0 %endif -# TODO: Add ppc64le-redhat-linux s390x-redhat-linux later. -%global cross_targets aarch64-redhat-linux +%global cross_targets aarch64-redhat-linux ppc64le-redhat-linux s390x-redhat-linux Summary: Various compilers (C, C++, Objective-C, ...) Name: gcc Version: %{gcc_version} @@ -349,6 +348,11 @@ Patch1000: gcc11-libstdc++-prettyprinter-update-15.patch Patch1001: gcc11-libstdc++-prettyprinter-update-15-tests.patch Patch1002: gcc11-libstdc++-prettyprinter-update-15-tests-48362.patch +# Backports +Patch2000: gcc11-fix-failures-with-default-SSP.patch +Patch2001: gcc11-disable-stack-protector-for-tests-relying-on-stack-offset.patch +Patch2002: gcc11-gcov-show-branches-and-calls.patch + # On ARM EABI systems, we do want -gnueabi to be part of the # target triple. %ifnarch %{arm} @@ -899,6 +903,84 @@ production use, and output binary artifacts should not be used in production. Generated binary artifacts contain binary annotations that mark them as cross compiled. +%package -n cross-gcc-ppc64le +Summary: Cross targeted PPC64le gcc for developer use. Not intended for production. +Provides: cross-gcc-ppc64le = %{version}-%{release} +%if %{build_cross} +Requires: cross-binutils-ppc64le >= 2.35 +BuildRequires: sysroot-ppc64le-el9-glibc >= 2.34 +BuildRequires: cross-binutils-ppc64le >= 2.35 +%endif +# Don't provide e.g. liblto_plugin.so()(64bit). +AutoReqProv: no + +%description -n cross-gcc-ppc64le +This package contains a version of gcc that can compile code for PPC64le +(cross compiler). This cross compiler is intended for developers to use +during application development. This cross compiler is not intended for +production use, and output binary artifacts should not be used in +production. Generated binary artifacts contain binary annotations that +mark them as cross compiled. + +%package -n cross-gcc-c++-ppc64le +Summary: Cross targeted PPC64le gcc-c++ for developer use. Not intended for production. +Provides: cross-gcc-c++-ppc64le = %{version}-%{release} +%if %{build_cross} +Requires: cross-gcc-ppc64le = %{version}-%{release} +BuildRequires: sysroot-ppc64le-el9-glibc >= 2.34 +BuildRequires: cross-binutils-ppc64le >= 2.35 +%endif +# ??? Otherwise this subpackage couldn't be installed, depends on libm.so +# and libgcc_s.so +AutoReqProv: no + +%description -n cross-gcc-c++-ppc64le +This package contains a version of g++ that can compile code for PPC64le +(cross compiler). This cross compiler is intended for developers to use +during application development. This cross compiler is not intended for +production use, and output binary artifacts should not be used in +production. Generated binary artifacts contain binary annotations that +mark them as cross compiled. + +%package -n cross-gcc-s390x +Summary: Cross targeted S/390 gcc for developer use. Not intended for production. +Provides: cross-gcc-s390x = %{version}-%{release} +%if %{build_cross} +Requires: cross-binutils-s390x >= 2.35 +BuildRequires: sysroot-s390x-el9-glibc >= 2.34 +BuildRequires: cross-binutils-s390x >= 2.35 +%endif +# Don't provide e.g. liblto_plugin.so()(64bit). +AutoReqProv: no + +%description -n cross-gcc-s390x +This package contains a version of gcc that can compile code for S/390 +(cross compiler). This cross compiler is intended for developers to use +during application development. This cross compiler is not intended for +production use, and output binary artifacts should not be used in +production. Generated binary artifacts contain binary annotations that +mark them as cross compiled. + +%package -n cross-gcc-c++-s390x +Summary: Cross targeted S/390 gcc-c++ for developer use. Not intended for production. +Provides: cross-gcc-c++-s390x = %{version}-%{release} +%if %{build_cross} +Requires: cross-gcc-s390x = %{version}-%{release} +BuildRequires: sysroot-s390x-el9-glibc >= 2.34 +BuildRequires: cross-binutils-s390x >= 2.35 +%endif +# ??? Otherwise this subpackage couldn't be installed, depends on libm.so +# and libgcc_s.so +AutoReqProv: no + +%description -n cross-gcc-c++-s390x +This package contains a version of g++ that can compile code for S/390 +(cross compiler). This cross compiler is intended for developers to use +during application development. This cross compiler is not intended for +production use, and output binary artifacts should not be used in +production. Generated binary artifacts contain binary annotations that +mark them as cross compiled. + %prep %setup -q -n gcc-%{version}-%{DATE} -a 1 -a 2 -a 3 %patch0 -p0 -b .hack~ @@ -990,6 +1072,10 @@ mark them as cross compiled. %patch1001 -p1 -b .libstdc++-prettyprinter-update-15-tests %patch1002 -p1 -b .libstdc++-prettyprinter-update-15-tests-48362 +%patch2000 -p1 -b .fix-failures-with-default-SSP +%patch2001 -p1 -b .disable-stack-protector-for-tests-relying-on-stack-offset +%patch2002 -p1 -b .gcov-show-branches-and-calls + %ifarch %{arm} rm -f gcc/testsuite/go.test/test/fixedbugs/issue19182.go %endif @@ -1359,10 +1445,10 @@ for crossarch in %{cross_targets}; do CONFIGURE_OPTS_FOR_ARCH="" ;; s390x*) - CONFIGURE_OPTS_FOR_ARCH="" + CONFIGURE_OPTS_FOR_ARCH="--with-arch=z14 --with-tune=z15" ;; ppc64le*) - CONFIGURE_OPTS_FOR_ARCH="" + CONFIGURE_OPTS_FOR_ARCH="--with-cpu-32=power9 --with-tune-32=power9 --with-cpu-64=power9 --with-tune-64=power9" ;; *) echo >&2 "ERROR: unknown cross arch $crossarch" @@ -1661,21 +1747,37 @@ for crossarch in %{cross_targets}; do mv include-fixed/limits.h include/limits.h popd - echo '/* GNU ld script + case $crossarch in + aarch64*) + OUTPUT_FORMAT_FOR_ARCH="elf64-littleaarch64" + ;; + s390x*) + OUTPUT_FORMAT_FOR_ARCH="elf64-s390" + ;; + ppc64le*) + OUTPUT_FORMAT_FOR_ARCH="elf64-powerpcle" + ;; + *) + echo >&2 "ERROR: unknown cross arch $crossarch" + exit 1 + ;; + esac + + echo "/* GNU ld script Use the shared library, but some functions are only in the static library. */ -OUTPUT_FORMAT(elf64-littleaarch64) -GROUP ( =/lib64/libgcc_s.so.1 libgcc.a )' > $CROSS_LIBPATH/libgcc_s.so +OUTPUT_FORMAT($OUTPUT_FORMAT_FOR_ARCH) +GROUP ( =/lib64/libgcc_s.so.1 libgcc.a )" > $CROSS_LIBPATH/libgcc_s.so - echo '/* GNU ld script + echo "/* GNU ld script Use the shared library from sysroot. */ -OUTPUT_FORMAT(elf64-littleaarch64) -INPUT ( =%{_prefix}/lib64/libgomp.so.1 )' > $CROSS_LIBPATH/libgomp.so +OUTPUT_FORMAT($OUTPUT_FORMAT_FOR_ARCH) +INPUT ( =%{_prefix}/lib64/libgomp.so.1 )" > $CROSS_LIBPATH/libgomp.so - echo '/* GNU ld script + echo "/* GNU ld script Use the shared library from sysroot. */ -OUTPUT_FORMAT(elf64-littleaarch64) -INPUT ( =/%{_prefix}/lib64/libstdc++.so.6 )' > $CROSS_LIBPATH/libstdc++.so +OUTPUT_FORMAT($OUTPUT_FORMAT_FOR_ARCH) +INPUT ( =/%{_prefix}/lib64/libstdc++.so.6 )" > $CROSS_LIBPATH/libstdc++.so echo "/* GNU ld script Use the static library from sysroot. */ @@ -1685,19 +1787,19 @@ INPUT( =%{_prefix}/lib/gcc/$crossarch/%{gcc_major}/libstdc++.a )" > $CROSS_LIBPA Use the static library from sysroot. */ INPUT( =%{_prefix}/lib/gcc/$crossarch/%{gcc_major}/libsupc++.a )" > $CROSS_LIBPATH/libsupc++.a - echo '/* GNU ld script + echo "/* GNU ld script Use the shared library from sysroot. */ -OUTPUT_FORMAT(elf64-littleaarch64) -INPUT ( =%{_prefix}/lib64/libatomic.so.1 )' > $CROSS_LIBPATH/libatomic.so +OUTPUT_FORMAT($OUTPUT_FORMAT_FOR_ARCH) +INPUT ( =%{_prefix}/lib64/libatomic.so.1 )" > $CROSS_LIBPATH/libatomic.so echo "/* GNU ld script Use the static library from sysroot. */ INPUT( =%{_prefix}/lib/gcc/$crossarch/%{gcc_major}/libatomic.a )" > $CROSS_LIBPATH/libatomic.a - echo '/* GNU ld script + echo "/* GNU ld script Use the shared library from sysroot. */ -OUTPUT_FORMAT(elf64-littleaarch64) -INPUT ( =%{_prefix}/lib64/libitm.so.1 )' > $CROSS_LIBPATH/libitm.so +OUTPUT_FORMAT($OUTPUT_FORMAT_FOR_ARCH) +INPUT ( =%{_prefix}/lib64/libitm.so.1 )" > $CROSS_LIBPATH/libitm.so echo "/* GNU ld script Use the static library from sysroot. */ @@ -3668,10 +3770,119 @@ end %{_prefix}/lib/gcc/aarch64-redhat-linux/%{gcc_major}/libstdc++.so %{_prefix}/lib/gcc/aarch64-redhat-linux/%{gcc_major}/libstdc++.a %{_prefix}/lib/gcc/aarch64-redhat-linux/%{gcc_major}/libsupc++.a + +%files -n cross-gcc-ppc64le +%{_prefix}/bin/ppc64le-redhat-linux-cpp +%{_prefix}/bin/ppc64le-redhat-linux-gcc +%{_prefix}/bin/ppc64le-redhat-linux-gcc-%{gcc_major} +%{_prefix}/bin/ppc64le-redhat-linux-gcc-ar +%{_prefix}/bin/ppc64le-redhat-linux-gcc-nm +%{_prefix}/bin/ppc64le-redhat-linux-gcc-ranlib +%{_prefix}/bin/ppc64le-redhat-linux-gcov* +%{_prefix}/bin/ppc64le-redhat-linux-lto-dump +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/cc1 +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/collect2 +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/lto1 +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/lto-wrapper +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/liblto_plugin.so +%dir %{_prefix}/lib/gcc +%dir %{_prefix}/lib/gcc/ppc64le-redhat-linux +%dir %{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major} +%dir %{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/include +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/crt*.o +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgcc.a +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgcc_eh.a +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgcov.a +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/include/*.h +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/rpmver +# These are here for ld(1) purposes only. +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgcc_s.so +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgomp.so +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libgomp.spec +%if %{build_libatomic} +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libatomic.so +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libatomic.a +%endif +%if %{build_libitm} +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libitm.so +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libitm.a +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libitm.spec +%endif + +%files -n cross-gcc-c++-ppc64le +%{_prefix}/bin/ppc64le-redhat-linux-c++ +%{_prefix}/bin/ppc64le-redhat-linux-g++ +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/cc1plus +%{_prefix}/libexec/gcc/ppc64le-redhat-linux/%{gcc_major}/g++-mapper-server +# For ld(1) purposes only. +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libstdc++.so +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libstdc++.a +%{_prefix}/lib/gcc/ppc64le-redhat-linux/%{gcc_major}/libsupc++.a + +%files -n cross-gcc-s390x +%{_prefix}/bin/s390x-redhat-linux-cpp +%{_prefix}/bin/s390x-redhat-linux-gcc +%{_prefix}/bin/s390x-redhat-linux-gcc-%{gcc_major} +%{_prefix}/bin/s390x-redhat-linux-gcc-ar +%{_prefix}/bin/s390x-redhat-linux-gcc-nm +%{_prefix}/bin/s390x-redhat-linux-gcc-ranlib +%{_prefix}/bin/s390x-redhat-linux-gcov* +%{_prefix}/bin/s390x-redhat-linux-lto-dump +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/cc1 +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/collect2 +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/lto1 +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/lto-wrapper +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/liblto_plugin.so +%dir %{_prefix}/lib/gcc +%dir %{_prefix}/lib/gcc/s390x-redhat-linux +%dir %{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major} +%dir %{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/include +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/crt*.o +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgcc.a +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgcc_eh.a +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgcov.a +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/include/*.h +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/rpmver +# These are here for ld(1) purposes only. +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgcc_s.so +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgomp.so +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libgomp.spec +%if %{build_libatomic} +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libatomic.so +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libatomic.a +%endif +%if %{build_libitm} +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libitm.so +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libitm.a +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libitm.spec +%endif + +%files -n cross-gcc-c++-s390x +%{_prefix}/bin/s390x-redhat-linux-c++ +%{_prefix}/bin/s390x-redhat-linux-g++ +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/cc1plus +%{_prefix}/libexec/gcc/s390x-redhat-linux/%{gcc_major}/g++-mapper-server +# For ld(1) purposes only. +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libstdc++.so +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libstdc++.a +%{_prefix}/lib/gcc/s390x-redhat-linux/%{gcc_major}/libsupc++.a + %dnl build_cross %endif %changelog +* Thu Oct 30 2025 David Malcolm - 11.5.0-14 +- Add backport of upstream r15-8946-g580664d1b66a5d to gcc 11, adding + branches and calls to gcov output, but not conditions (RHEL-105416). + +* Tue Oct 14 2025 David Malcolm - 11.5.0-13 +- Fix testsuite failures when run with -fstack-protector* (PR testsuite/70230, + RHEL-116477) + +* Wed Sep 10 2025 Joseph Myers - 11.5.0-12 +- Add cross compilers for ppc64le and s390x for non-production uses + (RHEL-94764) + * Thu Jul 31 2025 Florian Weimer - 11.5.0-11 - Adjust glibc32 build dependency (RHEL-105072)