From cebadbcf4ccb92119f6a0bef67abe519805a014a Mon Sep 17 00:00:00 2001 From: Arnav Singh Date: Fri, 2 Aug 2024 18:47:17 -0700 Subject: [PATCH] cross/gcc-*: upgrade to 14.2.0-r0 (MR 5455) [ci:skip-build] CI fails because of an issue with pmb fetching build deps on subsequent packages in the aggregated list of packages to build, but bpo is expected to pass because it builds packages one at a time --- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-aarch64/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-aarch64/APKBUILD | 35 ++-- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-armhf/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-armhf/APKBUILD | 35 ++-- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-armv7/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-armv7/APKBUILD | 35 ++-- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-riscv64/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-riscv64/APKBUILD | 35 ++-- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-x86/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../gcc-x86/0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-x86/APKBUILD | 35 ++-- .../0002-gcc-poison-system-directories.patch | 6 +- cross/gcc-x86_64/0013-nopie.patch | 80 ++++---- .../0023-riscv-disable-multilib-support.patch | 8 +- .../0026-ada-musl-support-fixes.patch | 9 + ...5-loongarch-disable-multilib-support.patch | 32 +++ ...clobber-issues-with-rot32di2-on-i386.patch | 186 ------------------ ...7-loongarch-disable-multilib-support.patch | 61 ------ cross/gcc-x86_64/APKBUILD | 35 ++-- 48 files changed, 684 insertions(+), 1818 deletions(-) create mode 100644 cross/gcc-aarch64/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-aarch64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-aarch64/0037-loongarch-disable-multilib-support.patch create mode 100644 cross/gcc-armhf/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch create mode 100644 cross/gcc-armv7/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-armv7/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-armv7/0037-loongarch-disable-multilib-support.patch create mode 100644 cross/gcc-riscv64/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-riscv64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-riscv64/0037-loongarch-disable-multilib-support.patch create mode 100644 cross/gcc-x86/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-x86/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-x86/0037-loongarch-disable-multilib-support.patch create mode 100644 cross/gcc-x86_64/0035-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-x86_64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch delete mode 100644 cross/gcc-x86_64/0037-loongarch-disable-multilib-support.patch diff --git a/cross/gcc-aarch64/0002-gcc-poison-system-directories.patch b/cross/gcc-aarch64/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-aarch64/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-aarch64/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-aarch64/0013-nopie.patch b/cross/gcc-aarch64/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-aarch64/0013-nopie.patch +++ b/cross/gcc-aarch64/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-aarch64/0023-riscv-disable-multilib-support.patch b/cross/gcc-aarch64/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-aarch64/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-aarch64/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-aarch64/0026-ada-musl-support-fixes.patch b/cross/gcc-aarch64/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-aarch64/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-aarch64/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-aarch64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-aarch64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-aarch64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-aarch64/0037-loongarch-disable-multilib-support.patch b/cross/gcc-aarch64/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-aarch64/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD index 86a579bcb..e7c174c48 100644 --- a/cross/gcc-aarch64/APKBUILD +++ b/cross/gcc-aarch64/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-aarch64 -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch " diff --git a/cross/gcc-armhf/0002-gcc-poison-system-directories.patch b/cross/gcc-armhf/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-armhf/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-armhf/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-armhf/0013-nopie.patch b/cross/gcc-armhf/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-armhf/0013-nopie.patch +++ b/cross/gcc-armhf/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-armhf/0023-riscv-disable-multilib-support.patch b/cross/gcc-armhf/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-armhf/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-armhf/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-armhf/0026-ada-musl-support-fixes.patch b/cross/gcc-armhf/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-armhf/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-armhf/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-armhf/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-armhf/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-armhf/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch b/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD index f24cbd912..544212a0f 100644 --- a/cross/gcc-armhf/APKBUILD +++ b/cross/gcc-armhf/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-armhf -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch " diff --git a/cross/gcc-armv7/0002-gcc-poison-system-directories.patch b/cross/gcc-armv7/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-armv7/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-armv7/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-armv7/0013-nopie.patch b/cross/gcc-armv7/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-armv7/0013-nopie.patch +++ b/cross/gcc-armv7/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-armv7/0023-riscv-disable-multilib-support.patch b/cross/gcc-armv7/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-armv7/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-armv7/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-armv7/0026-ada-musl-support-fixes.patch b/cross/gcc-armv7/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-armv7/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-armv7/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-armv7/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-armv7/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-armv7/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-armv7/0037-loongarch-disable-multilib-support.patch b/cross/gcc-armv7/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-armv7/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD index 82f875655..e2ce0387e 100644 --- a/cross/gcc-armv7/APKBUILD +++ b/cross/gcc-armv7/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-armv7 -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch " diff --git a/cross/gcc-riscv64/0002-gcc-poison-system-directories.patch b/cross/gcc-riscv64/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-riscv64/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-riscv64/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-riscv64/0013-nopie.patch b/cross/gcc-riscv64/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-riscv64/0013-nopie.patch +++ b/cross/gcc-riscv64/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-riscv64/0023-riscv-disable-multilib-support.patch b/cross/gcc-riscv64/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-riscv64/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-riscv64/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-riscv64/0026-ada-musl-support-fixes.patch b/cross/gcc-riscv64/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-riscv64/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-riscv64/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-riscv64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-riscv64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-riscv64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-riscv64/0037-loongarch-disable-multilib-support.patch b/cross/gcc-riscv64/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-riscv64/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-riscv64/APKBUILD b/cross/gcc-riscv64/APKBUILD index 3d8036ea3..677d8904f 100644 --- a/cross/gcc-riscv64/APKBUILD +++ b/cross/gcc-riscv64/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-riscv64 -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch " diff --git a/cross/gcc-x86/0002-gcc-poison-system-directories.patch b/cross/gcc-x86/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-x86/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-x86/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-x86/0013-nopie.patch b/cross/gcc-x86/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-x86/0013-nopie.patch +++ b/cross/gcc-x86/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-x86/0023-riscv-disable-multilib-support.patch b/cross/gcc-x86/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-x86/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-x86/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-x86/0026-ada-musl-support-fixes.patch b/cross/gcc-x86/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-x86/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-x86/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-x86/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-x86/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-x86/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-x86/0037-loongarch-disable-multilib-support.patch b/cross/gcc-x86/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-x86/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-x86/APKBUILD b/cross/gcc-x86/APKBUILD index 5c09f6f7f..90792245e 100644 --- a/cross/gcc-x86/APKBUILD +++ b/cross/gcc-x86/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-x86 -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch " diff --git a/cross/gcc-x86_64/0002-gcc-poison-system-directories.patch b/cross/gcc-x86_64/0002-gcc-poison-system-directories.patch index b14c921c2..84c80c95b 100644 --- a/cross/gcc-x86_64/0002-gcc-poison-system-directories.patch +++ b/cross/gcc-x86_64/0002-gcc-poison-system-directories.patch @@ -150,13 +150,13 @@ diff --git a/gcc/gcc.cc b/gcc/gcc.cc index 16bb07f2cdc..33b56e721d2 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc -@@ -1146,6 +1146,8 @@ proper position among the other output files. */ - "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ +@@ -1177,6 +1187,8 @@ proper position among the other output files. */ + "-z now " \ "%X %{o*} %{e*} %{N} %{n} %{r}\ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \ + %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ diff --git a/gcc/incpath.cc b/gcc/incpath.cc diff --git a/cross/gcc-x86_64/0013-nopie.patch b/cross/gcc-x86_64/0013-nopie.patch index 28a765ef2..6578ee110 100644 --- a/cross/gcc-x86_64/0013-nopie.patch +++ b/cross/gcc-x86_64/0013-nopie.patch @@ -9,23 +9,22 @@ Subject: [PATCH 13/35] nopie 2 files changed, 40 insertions(+) diff --git a/gcc/configure b/gcc/configure -index 8c46369f73f..e59cbee1767 100755 +index 23da7d55d..f38732bb2 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -32268,6 +32268,33 @@ fi +@@ -34534,6 +34534,29 @@ rm -f core conftest.err conftest.$ac_objext \ + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 ++# Check if -nopie works. ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 +$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : ++if ${gcc_cv_nopie+:} false; then : + $as_echo_n "(cached) " >&6 +else + saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++ LDFLAGS="$LDFLAGS -nopie" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void) {return 0;} +_ACEOF @@ -36,40 +35,51 @@ index 8c46369f73f..e59cbee1767 100755 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" ++ LDFLAGS="$saved_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 +$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi + + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -34551,6 +34574,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= fi - - diff --git a/gcc/configure.ac b/gcc/configure.ac -index 5504bf6eb01..57268319de1 100644 +index d7cf0b92c..db2e2c802 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac -@@ -7552,6 +7552,19 @@ AC_CACHE_CHECK([for -no-pie option], +@@ -7781,6 +7781,15 @@ AC_CACHE_CHECK([for -no-pie option], + [gcc_cv_no_pie=yes], + [gcc_cv_no_pie=no]) LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) ++# Check if -nopie works. ++AC_CACHE_CHECK([for -nopie option], ++ [gcc_cv_nopie], ++ [saved_LDFLAGS="$LDFLAGS" ++ LDFLAGS="$LDFLAGS -nopie" ++ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], ++ [gcc_cv_nopie=yes], ++ [gcc_cv_nopie=no]) ++ LDFLAGS="$saved_LDFLAGS"]) + if test x$enable_host_shared = xyes; then + PICFLAG=-fPIC +@@ -7798,6 +7807,8 @@ if test x$enable_host_pie = xyes; then + LD_PICFLAG=-pie + elif test x$gcc_cv_no_pie = xyes; then + LD_PICFLAG=-no-pie ++elif test x$gcc_cv_nopie = xyes; then ++ LD_PICFLAG=-nopie + else + LD_PICFLAG= + fi -- 2.41.0 diff --git a/cross/gcc-x86_64/0023-riscv-disable-multilib-support.patch b/cross/gcc-x86_64/0023-riscv-disable-multilib-support.patch index b919defc3..49916376f 100644 --- a/cross/gcc-x86_64/0023-riscv-disable-multilib-support.patch +++ b/cross/gcc-x86_64/0023-riscv-disable-multilib-support.patch @@ -46,10 +46,10 @@ diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index f8c2c351e5a..8d9881eadeb 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{static:-static}}" - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack +@@ -60,11 +60,3 @@ along with GCC; see the file COPYING3. If not see + %{rdynamic:-export-dynamic} \ + -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ + %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" - -#define STARTFILE_PREFIX_SPEC \ - "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/cross/gcc-x86_64/0026-ada-musl-support-fixes.patch b/cross/gcc-x86_64/0026-ada-musl-support-fixes.patch index ada929350..98b7f90eb 100644 --- a/cross/gcc-x86_64/0026-ada-musl-support-fixes.patch +++ b/cross/gcc-x86_64/0026-ada-musl-support-fixes.patch @@ -41,6 +41,15 @@ index 96306f8cc9a..090b6770ae5 100644 LIBGNAT_TARGET_PAIRS = \ a-intnam.ads +Date: Mon, 7 Aug 2023 15:25:58 +0800 +Subject: [PATCH] loongarch disable multilib support + +Signed-off-by: Jingyun Hua +--- + gcc/config/loongarch/t-linux | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux +index 23e1fb979..c2753abb8 100644 +--- a/gcc/config/loongarch/t-linux ++++ b/gcc/config/loongarch/t-linux +@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) + MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) + + # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. +-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) +- +- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) +- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) +- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) +- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) +- +-endif ++ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib ++ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib +-- +2.41.0 + diff --git a/cross/gcc-x86_64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch b/cross/gcc-x86_64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch deleted file mode 100644 index e3c09cc84..000000000 --- a/cross/gcc-x86_64/0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://gcc.gnu.org/PR110792 -https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=790c1f60a5662b16eb19eb4b81922995863c7571 -https://github.com/randombit/botan/issues/3637 - -From 85628c5653ff40963158a24c60eeec6a3b5a8e56 Mon Sep 17 00:00:00 2001 -From: Roger Sayle -Date: Thu, 3 Aug 2023 07:12:04 +0100 -Subject: [PATCH] PR target/110792: Early clobber issues with - rot32di2_doubleword on i386. - -This patch is a conservative fix for PR target/110792, a wrong-code -regression affecting doubleword rotations by BITS_PER_WORD, which -effectively swaps the highpart and lowpart words, when the source to be -rotated resides in memory. The issue is that if the register used to -hold the lowpart of the destination is mentioned in the address of -the memory operand, the current define_insn_and_split unintentionally -clobbers it before reading the highpart. - -Hence, for the testcase, the incorrectly generated code looks like: - - salq $4, %rdi // calculate address - movq WHIRL_S+8(%rdi), %rdi // accidentally clobber addr - movq WHIRL_S(%rdi), %rbp // load (wrong) lowpart - -Traditionally, the textbook way to fix this would be to add an -explicit early clobber to the instruction's constraints. - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -+ [(set (match_operand:DI 0 "register_operand" "=r,r,&r") - (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") - (const_int 32)))] - -but unfortunately this currently generates significantly worse code, -due to a strange choice of reloads (effectively memcpy), which ends up -looking like: - - salq $4, %rdi // calculate address - movdqa WHIRL_S(%rdi), %xmm0 // load the double word in SSE reg. - movaps %xmm0, -16(%rsp) // store the SSE reg back to the stack - movq -8(%rsp), %rdi // load highpart - movq -16(%rsp), %rbp // load lowpart - -Note that reload's "&" doesn't distinguish between the memory being -early clobbered, vs the registers used in an addressing mode being -early clobbered. - -The fix proposed in this patch is to remove the third alternative, that -allowed offsetable memory as an operand, forcing reload to place the -operand into a register before the rotation. This results in: - - salq $4, %rdi - movq WHIRL_S(%rdi), %rax - movq WHIRL_S+8(%rdi), %rdi - movq %rax, %rbp - -I believe there's a more advanced solution, by swapping the order of -the loads (if first destination register is mentioned in the address), -or inserting a lea insn (if both destination registers are mentioned -in the address), but this fix is a minimal "safe" solution, that -should hopefully be suitable for backporting. - -2023-08-03 Roger Sayle - -gcc/ChangeLog - PR target/110792 - * config/i386/i386.md (ti3): For rotations by 64 bits - place operand in a register before gen_64ti2_doubleword. - (di3): Likewise, for rotations by 32 bits, place - operand in a register before gen_32di2_doubleword. - (32di2_doubleword): Constrain operand to be in register. - (64ti2_doubleword): Likewise. - -gcc/testsuite/ChangeLog - PR target/110792 - * g++.target/i386/pr110792.C: New 32-bit C++ test case. - * gcc.target/i386/pr110792.c: New 64-bit C test case. - -(cherry picked from commit 790c1f60a5662b16eb19eb4b81922995863c7571) ---- - gcc/config/i386/i386.md | 18 ++++++++++++------ - gcc/testsuite/g++.target/i386/pr110792.C | 16 ++++++++++++++++ - gcc/testsuite/gcc.target/i386/pr110792.c | 18 ++++++++++++++++++ - 3 files changed, 46 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/g++.target/i386/pr110792.C - create mode 100644 gcc/testsuite/gcc.target/i386/pr110792.c - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index f3a3305..a71e837 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -14359,7 +14359,10 @@ - emit_insn (gen_ix86_ti3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 64) -- emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (TImode, operands[1]); -+ emit_insn (gen_64ti2_doubleword (operands[0], operands[1])); -+ } - else - { - rtx amount = force_reg (QImode, operands[2]); -@@ -14394,7 +14397,10 @@ - emit_insn (gen_ix86_di3_doubleword - (operands[0], operands[1], operands[2])); - else if (CONST_INT_P (operands[2]) && INTVAL (operands[2]) == 32) -- emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ { -+ operands[1] = force_reg (DImode, operands[1]); -+ emit_insn (gen_32di2_doubleword (operands[0], operands[1])); -+ } - else - FAIL; - -@@ -14562,8 +14568,8 @@ - }) - - (define_insn_and_split "32di2_doubleword" -- [(set (match_operand:DI 0 "register_operand" "=r,r,r") -- (any_rotate:DI (match_operand:DI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:DI 0 "register_operand" "=r,r") -+ (any_rotate:DI (match_operand:DI 1 "register_operand" "0,r") - (const_int 32)))] - "!TARGET_64BIT" - "#" -@@ -14580,8 +14586,8 @@ - }) - - (define_insn_and_split "64ti2_doubleword" -- [(set (match_operand:TI 0 "register_operand" "=r,r,r") -- (any_rotate:TI (match_operand:TI 1 "nonimmediate_operand" "0,r,o") -+ [(set (match_operand:TI 0 "register_operand" "=r,r") -+ (any_rotate:TI (match_operand:TI 1 "register_operand" "0,r") - (const_int 64)))] - "TARGET_64BIT" - "#" -diff --git a/gcc/testsuite/g++.target/i386/pr110792.C b/gcc/testsuite/g++.target/i386/pr110792.C -new file mode 100644 -index 0000000..ce21a7a ---- /dev/null -+++ b/gcc/testsuite/g++.target/i386/pr110792.C -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2" } */ -+ -+template -+inline T rotr(T input) -+{ -+ return static_cast((input >> ROT) | (input << (8 * sizeof(T) - ROT))); -+} -+ -+unsigned long long WHIRL_S[256] = {0x18186018C07830D8}; -+unsigned long long whirl(unsigned char x0) -+{ -+ const unsigned long long s4 = WHIRL_S[x0&0xFF]; -+ return rotr<32>(s4); -+} -+/* { dg-final { scan-assembler-not "movl\tWHIRL_S\\+4\\(,%eax,8\\), %eax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/pr110792.c b/gcc/testsuite/gcc.target/i386/pr110792.c -new file mode 100644 -index 0000000..b65125c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/pr110792.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target int128 } } */ -+/* { dg-options "-O2" } */ -+ -+static inline unsigned __int128 rotr(unsigned __int128 input) -+{ -+ return ((input >> 64) | (input << (64))); -+} -+ -+unsigned __int128 WHIRL_S[256] = {((__int128)0x18186018C07830D8) << 64 |0x18186018C07830D8}; -+unsigned __int128 whirl(unsigned char x0) -+{ -+ register int t __asm("rdi") = x0&0xFF; -+ const unsigned __int128 s4 = WHIRL_S[t]; -+ register unsigned __int128 tt __asm("rdi") = rotr(s4); -+ asm("":::"memory"); -+ return tt; -+} -+/* { dg-final { scan-assembler-not "movq\tWHIRL_S\\+8\\(%rdi\\), %rdi" } } */ --- -2.41.0 - diff --git a/cross/gcc-x86_64/0037-loongarch-disable-multilib-support.patch b/cross/gcc-x86_64/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index 37de3c729..000000000 --- a/cross/gcc-x86_64/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/linux.h | 10 +--------- - gcc/config/loongarch/t-linux | 18 +++--------------- - 3 files changed, 5 insertions(+), 25 deletions(-) - -diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h -index 9059d2441..23eaff0cc 100644 ---- a/gcc/config/loongarch/linux.h -+++ b/gcc/config/loongarch/linux.h -@@ -22,15 +22,7 @@ along with GCC; see the file COPYING3. If not see - * can work in a multilib environment. */ - - #if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) -- -- #if DEFAULT_ABI_BASE == ABI_BASE_LP64D -- #define ABI_LIBDIR "lib64" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64F -- #define ABI_LIBDIR "lib64/f32" -- #elif DEFAULT_ABI_BASE == ABI_BASE_LP64S -- #define ABI_LIBDIR "lib64/sf" -- #endif -- -+ #define ABI_LIBDIR "lib" - #endif - - #ifndef ABI_LIBDIR -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index e40da1792..f72c6e878 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -36,18 +36,6 @@ else - endif - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = \ -- mabi.lp64d=../lib64$\ -- $(call if_multiarch,:loongarch64-linux-gnu) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64f=../lib64/f32$\ -- $(call if_multiarch,:loongarch64-linux-gnuf32) -- -- MULTILIB_OSDIRNAMES += \ -- mabi.lp64s=../lib64/sf$\ -- $(call if_multiarch,:loongarch64-linux-gnusf) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.41.0 - diff --git a/cross/gcc-x86_64/APKBUILD b/cross/gcc-x86_64/APKBUILD index 4ebf9773c..3f9b8a476 100644 --- a/cross/gcc-x86_64/APKBUILD +++ b/cross/gcc-x86_64/APKBUILD @@ -24,7 +24,7 @@ CBUILDROOT="/" _cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" pkgname=gcc-x86_64 -pkgver=13.2.1_git20240309 +pkgver=14.2.0 # i.e. 13.2.1, must match gcc/BASE-VER _pkgbase="${pkgver%%_git*}" # date component from snapshots @@ -171,7 +171,7 @@ esac # currently on x86, x86_64 and ia64 _libquadmath=$LANG_FORTRAN case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) _libquadmath=$LANG_FORTRAN ;; +x86 | x86_64) _libquadmath=$LANG_FORTRAN ;; *) _libquadmath=false ;; esac @@ -241,7 +241,8 @@ makedepends="$makedepends_build $makedepends_host" # # PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, # so that they can be properly tracked and easily rebased if needed. -source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz +source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz 0001-posix_memalign.patch 0002-gcc-poison-system-directories.patch 0003-specs-turn-on-Wl-z-now-by-default.patch @@ -276,8 +277,7 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch 0033-libphobos-do-not-use-LFS64-symbols.patch 0034-libgo-fix-lfs64-use.patch - 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch - 0037-loongarch-disable-multilib-support.patch + 0035-loongarch-disable-multilib-support.patch " # secfixes: @@ -285,7 +285,8 @@ source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${ # - CVE-2023-4039 # we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +#_gccdir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap +_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver} _gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}" _gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}" @@ -364,7 +365,14 @@ build() { $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" + if ! $_libquadmath; then + _arch_configure="$_arch_configure --disable-libquadmath" + # ppc64le needs both --disable-libquadmath{,-support} + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116007 + [ "$CARCH" = "ppc64le" ] && + _arch_configure="$_arch_configure + --disable-libquadmath-support" + fi msg "Building the following:" echo "" @@ -793,9 +801,9 @@ gdb() { } sha512sums=" -2d1e0374ebdee526f0549319fc9c364968c52a0d4aaa16759f00453cb083fe58d8f463c47d97f3bb74a0a92e251989eb75a50ee5800b4569978c72d25446b44e gcc-13-20240309.tar.xz +932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396 gcc-14.2.0.tar.xz 1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch -163f282455b6a4df33f011bcd8b0440566ba0ffaeeab30d8ac52d39948980a56881ca0eff60687129d59556389a58b9d64e7768750bd70b1fe0fedbc9fc30dc2 0002-gcc-poison-system-directories.patch +1d102a7b17683909dde4d8591dd889149299e77a2b2003cdc0635dc816666be940e41ae534b469485391a9bed183cd5cd337f130e4e1ecb62cb9ad86c4a081db 0002-gcc-poison-system-directories.patch 3f24bb6a50d3c45b71ea05590e32fe3e69b91377ab185352891d5035c76ed193117c6d0b314a4c364bcf136b9a9dd5c926d6c7c30ab436976c121ebfea8d3ddd 0003-specs-turn-on-Wl-z-now-by-default.patch 17a2993027d3ddf8595952ebcae425695ddc7b1cf73b384d2e55fddecb9cbf3f6482860a502ff69b14075e12badf27300fd3039f3a9005e851fd8d121d258c2b 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch 444550e55491ff89fe8cbbb4b73d017c9c147cdce1ad5c0561fe7d6ab3834515a814c7676c408cfeec18e1aaace27b3c26a2ffe4a75042285df5124976c38672 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch @@ -806,7 +814,7 @@ sha512sums=" da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch 35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch 9d43f844fad0ac6e1c35a2b6f461f9278ae09e468f2c9ae8adc43accbe6934994aa10d3a433644d1393a4a76e3caed69e3191db7f3c0c24b4e7a0a0a0cbac3f1 0012-libgcc_s.patch -b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e45334290dbe467a4e891ed34a6522e0c72f746def22e8663 0013-nopie.patch +91dde3079c1400c124ab5604597f5857185d075809649603aa3641a4581b34029bfcbd4281a5bd925d1c5e6e3b1f5f3322efda34345c6930652d685a6c9525f4 0013-nopie.patch 0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch 00097c7106625ccf02149a757366f434c48f2abe824bb8b4bf067d29308889cb6039a5e5b2d3bd2683617693b47707d549252c56eea6bc3cdc2450a8d14f46a7 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch 7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch @@ -816,10 +824,10 @@ b2c4921c5eef33ee43a92ab5ec7f09d5d3adb49a2416595001e6376ffdf652ef9d0dc21778c3a86e a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch 44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch -e0763083c31485e8ac0b3724376a28af01bb6f50e1a054780b61886e4e3de2a35d127e6e353eb8d8729964ada9b5751bf05bdd51df539667008216db38f228a3 0023-riscv-disable-multilib-support.patch +abf845792433a21fed5dd06167b9f6cf5e8f8026a409acce93824e466c5148e192bf5f404a271931fe4b65283499329bf67bb01019f2f3e02501f20619404e6c 0023-riscv-disable-multilib-support.patch ab88a2f63e3545bbc36537aa9a86f2c6c35e41bbf702d6e13743a405cdac4f901eed5737189b780da96647fea9f5d863fdc76373f25a00064106dcb5514d6d87 0024-always-build-libgcc_eh.a.patch 8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch -30369bea84020c32d514196ba3adb3d09d2d0359af5550bd3f9719aa357e44b2f695623c1d2a99416e120dc86896c196c5dd4f638183dced4799604137385367 0026-ada-musl-support-fixes.patch +5fd23a506b55c88d4f000e01c539eb25d6da2516949c9d7a1c9ee20f4c6b627e4788541284d9c14c33bafa7cb43ce2e0469dd91006152f00e30815107150320f 0026-ada-musl-support-fixes.patch 3f9a406d7d2ce34951215ffbcadb49a45e55ad5c24ab9097c0e5e92383e43b876872ccd2a7e7def2833ab204975ee5733f8bcf90934db9fa9c4f6f56c62081f6 0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 720a4001f9a1fa4122e456077ecff8d3eb8af7c83d0a81f9da6a6cca05b23664206a82a349e34482c48bfe40e99aa5f21567613d0913f6a24f282bc84a994496 0028-configure-fix-detection-of-atomic-builtins-in-libato.patch 2044c23b23726965c0a6fd39f616cc464badd650947cb40495eeabd906a3af629878c1d28b403b8eb46b30a1a0ba39083023290d62f0c99ccf070063226e3f8f 0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch @@ -828,6 +836,5 @@ d47b559075f40d526235f47b91da1d0cf6bfe6c5b7311bbfe08af9dd6e8f27e6c7cd82e3b2d529aa b325035cb7122d79c6b42ca6d3fc9e02319ed2f7cddb0639dff25d2798d2ce63812cd623462cdf95e21c9ffbf2412193f8b9fc89a4c36fa5a6a041661ac7399d 0032-libgnat-time_t-is-always-64-bit-on-musl-libc.patch c474f34e6f9a4239d486a65141a133dbe8ce91427d502a57a9fd6eb403478a2b5715ba74f24c1cc0761e16eec77ba2c1ca921fb7d7bc1e040fc3703fc9559e75 0033-libphobos-do-not-use-LFS64-symbols.patch c4482ffc36e7894b2140800159f4cbc9a3e9011e43a69b69f4fa92d5a11e2ee645c7e21df4423dd1e0636e8890849a5719647bfbdf84f951d638f8f488cb718c 0034-libgo-fix-lfs64-use.patch -cc1e10ac6e72db816f09325e301103109cc212a6f3de3ce0b9b038d149233c467319d203941695dbf3d7b9e2dcbbcd17609cdb056e831fcc323cd592423882d8 0036-PR110792-Early-clobber-issues-with-rot32di2-on-i386.patch -d834f5f95f4ebe70ec0af0748c8632c99a4f57b69dc14db1a38becdfcb03406b32febf39f772f37bd145538147099fa7433edce845e14ee77cd8f38fd9774fc1 0037-loongarch-disable-multilib-support.patch +65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch "