Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (79bc62ddfbcf80a59e9881d30418e1bf0fc49f5a)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (79bc62ddfbcf80a59e9881d30418e1bf0fc49f5a)
  • Date: Fri, 14 Jul 2023 20:54:49 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

gnu/gcc/DETAILS
| 1
gnu/gcc/HISTORY
| 20
gnu/gcc/patches/0001-Add-targetm.libm_function_max_error.patch
| 618 ++++++++++

gnu/gcc/patches/0001-musl-always-use--lib--directory-for-all-x86_64-ABIs.patch
| 116 -
gnu/gcc/patches/0002-Remove-conflicting-duplicated-manpages.patch
| 36
gnu/gcc/patches/0003-all-posix_memalign.patch
| 45

gnu/gcc/patches/0004-convert-__cpu_indicator_init-to-__cpu_indicator_init.patch
| 46

gnu/gcc/patches/0005-musl-always-use-lib-directory-for-all-x86_64-ABIs-PR.patch
| 115 +
gnu/gcc/patches/0006-ada-libgnarl-compatibility-for-musl.patch
| 138 ++
gnu/gcc/patches/0007-ada-musl-support-fixes.patch
| 226 +++

gnu/gcc/patches/0008-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
| 30

gnu/gcc/patches/0009-gdc-unconditionally-link-libgphobos-against-libucont.patch
| 31

gnu/gcc/patches/0010-druntime-link-against-libucontext-on-all-platforms.patch
| 58
gnu/gcc/patches/0011-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
| 28
gnu/gcc/patches/0012-libphobos-do-not-use-LFS64-symbols.patch
| 34
gnu/gcc/patches/0013-libgo-fix-lfs64-use.patch
| 198 +++
gnu/gcc/patches/50_all_cpu_indicator.patch
| 37
gnu/gcc/patches/50_all_posix_memalign.patch
| 31
18 files changed, 1624 insertions(+), 184 deletions(-)

New commits:
commit 79bc62ddfbcf80a59e9881d30418e1bf0fc49f5a
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

gcc: Add build fixes, PATCHLEVEL++

diff --git a/gnu/gcc/DETAILS b/gnu/gcc/DETAILS
index ec12831..905b1c9 100755
--- a/gnu/gcc/DETAILS
+++ b/gnu/gcc/DETAILS
@@ -1,6 +1,7 @@
# Watch: https://ftp.gnu.org/gnu/gcc href="gcc-([0-9.]+)/"
SPELL=gcc
VERSION=13.1.0
+ PATCHLEVEL=1
ISL_VERSION=0.24
BASE_SOURCE_URL="https://ftp.gnu.org/pub/gnu/gcc/gcc-$VERSION";
SOURCE=gcc-$VERSION.tar.xz
diff --git a/gnu/gcc/HISTORY b/gnu/gcc/HISTORY
index bbca0b6..67111fd 100644
--- a/gnu/gcc/HISTORY
+++ b/gnu/gcc/HISTORY
@@ -1,3 +1,23 @@
+2023-07-14 Ismael Luceno <ismael AT sourcemage.org>
+ * DETAILS: PATCHLEVEL++
+ * 0003-all-posix_memalign.patch,
+ 0004-convert-__cpu_indicator_init-to-__cpu_indicator_init.patch,
+ 0005-musl-always-use-lib-directory-for-all-x86_64-ABIs-PR.patch:
+ normalised and renamed the patches
+ * patches/0002-Remove-conflicting-duplicated-manpages.patch:
+ added to avoid conflicting GCC installations
+ * patches/0001-Add-targetm.libm_function_max_error.patch:
+ added upstream fix
+ * patches/0006-ada-libgnarl-compatibility-for-musl.patch,
+ patches/0007-ada-musl-support-fixes.patch,
+
patches/0008-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
+
patches/0009-gdc-unconditionally-link-libgphobos-against-libucont.patch
+
patches/0010-druntime-link-against-libucontext-on-all-platforms.patch
+ patches/0011-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
+ patches/0012-libphobos-do-not-use-LFS64-symbols.patch
+ patches/0013-libgo-fix-lfs64-use.patch:
+ added build fixes for musl
+
2023-07-11 Ismael Luceno <ismael AT sourcemage.org>
* PRE_BUILD: enabled patch application again
* patches/0001-libgo-make-match.sh-POSIX-shell-compatible.patch:
diff --git a/gnu/gcc/patches/0001-Add-targetm.libm_function_max_error.patch
b/gnu/gcc/patches/0001-Add-targetm.libm_function_max_error.patch
new file mode 100644
index 0000000..ff07b16
--- /dev/null
+++ b/gnu/gcc/patches/0001-Add-targetm.libm_function_max_error.patch
@@ -0,0 +1,618 @@
+From 0bcb1683aa0986519f10d2bab149096d394ca715 Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub AT redhat.com>
+Date: Fri, 28 Apr 2023 08:59:29 +0200
+Subject: [PATCH 01/13] Add targetm.libm_function_max_error
+
+As has been discussed before, the following patch adds target hook
+for math library function maximum errors measured in ulps.
+The default is to return ~0U which is a magic maximum value which means
+nothing is known about precision of the match function.
+
+The first argument is unsigned int because enum combined_fn isn't available
+everywhere where target hooks are included but is expected to be given
+the enum combined_fn value, although it should be used solely to find out
+which kind of match function (say sin vs. cos vs. sqrt vs. exp10) rather
+than its variant (f suffix, no suffix, l suffix, f128 suffix, ...), for
+which there is the machine_mode argument.
+The last argument is a bool, if it is false, the function should return
+maximum known error in ulps for a given function (taking -frounding-math
+into account if enabled), with 0.5ulps being represented as 0.
+If it is true, it is about whether the function can return values outside of
+an intrinsic finite range for the function and by how many ulps.
+E.g. sin/cos should return result in [-1.,1], if the function is expected
+to never return values outside of that finite interval, the hook should
+return 0. Similarly for sqrt such range is [-0.,+Inf].
+
+The patch implements it for glibc only so far, I hope other maintainers
+can submit details for Solaris, musl, perhaps BSDs, etc.
+For glibc I've gathered data from:
+1)
https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
+ as latest published glibc data
+2)
https://www.gnu.org/software/libc/manual/2.22/html_node/Errors-in-Math-Functions.html
+ as a few years old glibc data
+3) using attached libc-ulps.sh script from glibc git
+4) using attached ulp-tester.c (how to invoke in file comment; tested
+ both x86_64, ppc64, ppc64le 50M pseudo-random values in all 4 rounding
+ modes, plus on x86_64 float/double sin/cos using libmvec - see
+ attached libmvec-wrapper.c as well)
+5) using attached boundary-tester.c to test for whether sin/cos/sqrt return
+ values outside of the intrinsic ranges for those functions (again,
+ tested on x86_64, ppc64, ppc64le plus on x86_64 using libmvec as well;
+ libmvec with non-default rounding modes is pretty much random number
+ generator it seems)
+
+The data is added to various hooks, the generic and generic glibc versions
+being in targhooks.c so that the various targets can easily override it.
+The intent is that the generic glibc version handles most of the stuff
+and specific target arch overrides handle the outliers or special cases.
+The patch has special case for x86_64 when __FAST_MATH__ is defined (as
+one can use in that case either libm or libmvec and we don't know which
+one will be used; so it uses maximum of what libm provides and libmvec),
+rs6000 (had to add one because cosf has 3ulps on ppc* rather than 1-2ulps
+on most other targets; MODE_COMPOSITE_P could be in theory handled in the
+generic code too, but as we have rs6000-linux specific function, it can be
+done just there), arc-linux (because DFmode sin has 7ulps there compared to
+1ulps on other targets, both in default rounding mode and in others) and
+or1k-linux (while DFmode sin has 1ulps there for default rounding mode,
+for other rounding modes it has up to 7ulps).
+Now, for -frounding-math I'm trying to add a few ulps more because I expect
+it to be much less tested, except that for boundary_p I try to use
+the numbers I got from the 5) tester.
+
+2023-04-28 Jakub Jelinek <jakub AT redhat.com>
+
+ * target.def (libm_function_max_error): New target hook.
+ * doc/tm.texi.in (TARGET_LIBM_FUNCTION_MAX_ERROR): Add.
+ * doc/tm.texi: Regenerated.
+ * targhooks.h (default_libm_function_max_error,
+ glibc_linux_libm_function_max_error): Declare.
+ * targhooks.cc: Include case-cfn-macros.h.
+ (default_libm_function_max_error,
+ glibc_linux_libm_function_max_error): New functions.
+ * config/linux.h (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+ * config/linux-protos.h (linux_libm_function_max_error): Declare.
+ * config/linux.cc: Include target.h and targhooks.h.
+ (linux_libm_function_max_error): New function.
+ * config/arc/arc.cc: Include targhooks.h and case-cfn-macros.h.
+ (arc_libm_function_max_error): New function.
+ (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+ * config/i386/i386.cc (ix86_libc_has_fast_function): Formatting fix.
+ (ix86_libm_function_max_error): New function.
+ (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+ * config/rs6000/rs6000-protos.h
+ (rs6000_linux_libm_function_max_error): Declare.
+ * config/rs6000/rs6000-linux.cc: Include target.h, targhooks.h, tree.h
+ and case-cfn-macros.h.
+ (rs6000_linux_libm_function_max_error): New function.
+ * config/rs6000/linux.h (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+ * config/rs6000/linux64.h (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+ * config/or1k/or1k.cc: Include targhooks.h and case-cfn-macros.h.
+ (or1k_libm_function_max_error): New function.
+ (TARGET_LIBM_FUNCTION_MAX_ERROR): Redefine.
+
+(cherry picked from commit bd539c9b801bde3a919a5ad16b741ab4f5eca6e3)
+Origin: Upstream
+Upstream-Status: Backport [v14]
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/config/arc/arc.cc | 36 ++++++++++++++++
+ gcc/config/i386/i386.cc | 55 ++++++++++++++++++++++++-
+ gcc/config/linux-protos.h | 2 +
+ gcc/config/linux.cc | 11 +++++
+ gcc/config/linux.h | 3 ++
+ gcc/config/or1k/or1k.cc | 31 ++++++++++++++
+ gcc/config/rs6000/linux.h | 3 ++
+ gcc/config/rs6000/linux64.h | 3 ++
+ gcc/config/rs6000/rs6000-linux.cc | 40 ++++++++++++++++++
+ gcc/config/rs6000/rs6000-protos.h | 2 +
+ gcc/doc/tm.texi | 15 +++++++
+ gcc/doc/tm.texi.in | 2 +
+ gcc/target.def | 17 ++++++++
+ gcc/targhooks.cc | 68 +++++++++++++++++++++++++++++++
+ gcc/targhooks.h | 3 ++
+ 15 files changed, 290 insertions(+), 1 deletion(-)
+
+diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
+index 22eb2e9cb459..b47935a9214d 100644
+--- a/gcc/config/arc/arc.cc
++++ b/gcc/config/arc/arc.cc
+@@ -68,6 +68,8 @@ along with GCC; see the file COPYING3. If not see
+ #include "alias.h"
+ #include "opts.h"
+ #include "hw-doloop.h"
++#include "targhooks.h"
++#include "case-cfn-macros.h"
+
+ /* Which cpu we're compiling for (ARC600, ARC601, ARC700). */
+ static char arc_cpu_name[10] = "";
+@@ -11808,6 +11810,37 @@ arc_insn_cost (rtx_insn *insn, bool speed)
+ return cost;
+ }
+
++static unsigned
++arc_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++#ifdef OPTION_GLIBC
++ bool glibc_p = OPTION_GLIBC;
++#else
++ bool glibc_p = false;
++#endif
++ if (glibc_p)
++ {
++ int rnd = flag_rounding_math ? 4 : 0;
++ switch (cfn)
++ {
++ CASE_CFN_SIN:
++ CASE_CFN_SIN_FN:
++ if (!boundary_p && mode == DFmode)
++ return 7 + rnd;
++ break;
++ CASE_CFN_COS:
++ CASE_CFN_COS_FN:
++ if (!boundary_p && mode == DFmode)
++ return 4 + rnd;
++ default:
++ break;
++ }
++ return glibc_linux_libm_function_max_error (cfn, mode, boundary_p);
++ }
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
++
+ #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
+ #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p
+
+@@ -11832,6 +11865,9 @@ arc_insn_cost (rtx_insn *insn, bool speed)
+ #undef TARGET_INSN_COST
+ #define TARGET_INSN_COST arc_insn_cost
+
++#undef TARGET_LIBM_FUNCTION_MAX_ERROR
++#define TARGET_LIBM_FUNCTION_MAX_ERROR arc_libm_function_max_error
++
+ struct gcc_target targetm = TARGET_INITIALIZER;
+
+ #include "gt-arc.h"
+diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
+index fbd33a6bfd12..f3ae413cacbe 100644
+--- a/gcc/config/i386/i386.cc
++++ b/gcc/config/i386/i386.cc
+@@ -25248,7 +25248,8 @@ ix86_libgcc_floating_mode_supported_p
+ #undef TARGET_MEMTAG_TAG_SIZE
+ #define TARGET_MEMTAG_TAG_SIZE ix86_memtag_tag_size
+
+-static bool ix86_libc_has_fast_function (int fcode ATTRIBUTE_UNUSED)
++static bool
++ix86_libc_has_fast_function (int fcode ATTRIBUTE_UNUSED)
+ {
+ #ifdef OPTION_GLIBC
+ if (OPTION_GLIBC)
+@@ -25263,6 +25264,58 @@ static bool ix86_libc_has_fast_function (int fcode
ATTRIBUTE_UNUSED)
+ #undef TARGET_LIBC_HAS_FAST_FUNCTION
+ #define TARGET_LIBC_HAS_FAST_FUNCTION ix86_libc_has_fast_function
+
++static unsigned
++ix86_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++#ifdef OPTION_GLIBC
++ bool glibc_p = OPTION_GLIBC;
++#else
++ bool glibc_p = false;
++#endif
++ if (glibc_p)
++ {
++ /* If __FAST_MATH__ is defined, glibc provides libmvec. */
++ unsigned int libmvec_ret = 0;
++ if (!flag_trapping_math
++ && flag_unsafe_math_optimizations
++ && flag_finite_math_only
++ && !flag_signed_zeros
++ && !flag_errno_math)
++ switch (cfn)
++ {
++ CASE_CFN_COS:
++ CASE_CFN_COS_FN:
++ CASE_CFN_SIN:
++ CASE_CFN_SIN_FN:
++ if (!boundary_p)
++ {
++ /* With non-default rounding modes, libmvec provides
++ complete garbage in results. E.g.
++ _ZGVcN8v_sinf for 1.40129846e-45f in FE_UPWARD
++ returns 0.00333309174f rather than 1.40129846e-45f. */
++ if (flag_rounding_math)
++ return ~0U;
++ /*
https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
++ claims libmvec maximum error is 4ulps.
++ My own random testing indicates 2ulps for SFmode and
++ 0.5ulps for DFmode, but let's go with the 4ulps. */
++ libmvec_ret = 4;
++ }
++ break;
++ default:
++ break;
++ }
++ unsigned int ret = glibc_linux_libm_function_max_error (cfn, mode,
++ boundary_p);
++ return MAX (ret, libmvec_ret);
++ }
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
++
++#undef TARGET_LIBM_FUNCTION_MAX_ERROR
++#define TARGET_LIBM_FUNCTION_MAX_ERROR ix86_libm_function_max_error
++
+ #if CHECKING_P
+ #undef TARGET_RUN_TARGET_SELFTESTS
+ #define TARGET_RUN_TARGET_SELFTESTS selftest::ix86_run_selftests
+diff --git a/gcc/config/linux-protos.h b/gcc/config/linux-protos.h
+index 147b4ebdb24c..f2ea930ace76 100644
+--- a/gcc/config/linux-protos.h
++++ b/gcc/config/linux-protos.h
+@@ -20,3 +20,5 @@ along with GCC; see the file COPYING3. If not see
+ extern bool linux_has_ifunc_p (void);
+
+ extern bool linux_libc_has_function (enum function_class fn_class, tree);
++
++extern unsigned linux_libm_function_max_error (unsigned, machine_mode,
bool);
+diff --git a/gcc/config/linux.cc b/gcc/config/linux.cc
+index 28c8c15dbc0b..9114e55d44e7 100644
+--- a/gcc/config/linux.cc
++++ b/gcc/config/linux.cc
+@@ -23,6 +23,8 @@ along with GCC; see the file COPYING3. If not see
+ #include "tm.h"
+ #include "tree.h"
+ #include "linux-protos.h"
++#include "target.h"
++#include "targhooks.h"
+
+ bool
+ linux_libc_has_function (enum function_class fn_class,
+@@ -38,3 +40,12 @@ linux_libc_has_function (enum function_class fn_class,
+
+ return false;
+ }
++
++unsigned
++linux_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++ if (OPTION_GLIBC)
++ return glibc_linux_libm_function_max_error (cfn, mode, boundary_p);
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
+diff --git a/gcc/config/linux.h b/gcc/config/linux.h
+index e3aca79ccccb..ac56816bfca0 100644
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
+@@ -212,4 +212,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.
If not, see
+ # undef TARGET_LIBC_HAS_FUNCTION
+ # define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+
++# undef TARGET_LIBM_FUNCTION_MAX_ERROR
++# define TARGET_LIBM_FUNCTION_MAX_ERROR linux_libm_function_max_error
++
+ #endif
+diff --git a/gcc/config/or1k/or1k.cc b/gcc/config/or1k/or1k.cc
+index f98f1ec685bd..ec30bc8156cb 100644
+--- a/gcc/config/or1k/or1k.cc
++++ b/gcc/config/or1k/or1k.cc
+@@ -44,6 +44,8 @@
+ #include "explow.h"
+ #include "cfgrtl.h"
+ #include "alias.h"
++#include "targhooks.h"
++#include "case-cfn-macros.h"
+
+ /* These 4 are needed to allow using satisfies_constraint_J. */
+ #include "insn-config.h"
+@@ -2191,6 +2193,32 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
+ epilogue_completed = 0;
+ }
+
++static unsigned
++or1k_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++#ifdef OPTION_GLIBC
++ bool glibc_p = OPTION_GLIBC;
++#else
++ bool glibc_p = false;
++#endif
++ if (glibc_p)
++ {
++ switch (cfn)
++ {
++ CASE_CFN_SIN:
++ CASE_CFN_SIN_FN:
++ if (!boundary_p && mode == DFmode && flag_rounding_math)
++ return 7;
++ break;
++ default:
++ break;
++ }
++ return glibc_linux_libm_function_max_error (cfn, mode, boundary_p);
++ }
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
++
+ #undef TARGET_ASM_OUTPUT_MI_THUNK
+ #define TARGET_ASM_OUTPUT_MI_THUNK or1k_output_mi_thunk
+ #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
+@@ -2214,6 +2242,9 @@ or1k_output_mi_thunk (FILE *file, tree thunk_fndecl,
+ #undef TARGET_HAVE_SPECULATION_SAFE_VALUE
+ #define TARGET_HAVE_SPECULATION_SAFE_VALUE speculation_safe_value_not_needed
+
++#undef TARGET_LIBM_FUNCTION_MAX_ERROR
++#define TARGET_LIBM_FUNCTION_MAX_ERROR or1k_libm_function_max_error
++
+ /* Calling Conventions. */
+ #undef TARGET_FUNCTION_VALUE
+ #define TARGET_FUNCTION_VALUE or1k_function_value
+diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
+index 5d21befe8e41..8dc2a89684a2 100644
+--- a/gcc/config/rs6000/linux.h
++++ b/gcc/config/rs6000/linux.h
+@@ -50,6 +50,9 @@
+ #undef TARGET_LIBC_HAS_FUNCTION
+ #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+
++#undef TARGET_LIBM_FUNCTION_MAX_ERROR
++#define TARGET_LIBM_FUNCTION_MAX_ERROR rs6000_linux_libm_function_max_error
++
+ #undef TARGET_OS_CPP_BUILTINS
+ #define TARGET_OS_CPP_BUILTINS() \
+ do \
+diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
+index 9e457033d115..6e4acaf00c20 100644
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -288,6 +288,9 @@ extern int dot_symbols;
+ #undef TARGET_LIBC_HAS_FUNCTION
+ #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
+
++#undef TARGET_LIBM_FUNCTION_MAX_ERROR
++#define TARGET_LIBM_FUNCTION_MAX_ERROR rs6000_linux_libm_function_max_error
++
+ #undef TARGET_OS_CPP_BUILTINS
+ #define TARGET_OS_CPP_BUILTINS() \
+ do \
+diff --git a/gcc/config/rs6000/rs6000-linux.cc
b/gcc/config/rs6000/rs6000-linux.cc
+index 35dc10974167..0f89cb47777c 100644
+--- a/gcc/config/rs6000/rs6000-linux.cc
++++ b/gcc/config/rs6000/rs6000-linux.cc
+@@ -23,6 +23,10 @@ along with GCC; see the file COPYING3. If not see
+ #include "system.h"
+ #include "coretypes.h"
+ #include "tm.h"
++#include "target.h"
++#include "targhooks.h"
++#include "tree.h"
++#include "case-cfn-macros.h"
+
+ /* Implement TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P. */
+
+@@ -36,3 +40,39 @@ rs6000_linux_float_exceptions_rounding_supported_p (void)
+ else
+ return TARGET_HARD_FLOAT;
+ }
++
++/* Implement TARGET_LIBM_FUNCTION_MAX_ERROR. */
++
++unsigned
++rs6000_linux_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++ if (OPTION_GLIBC)
++ {
++ int rnd = flag_rounding_math ? 4 : 0;
++ switch (cfn)
++ {
++ CASE_CFN_SQRT:
++ CASE_CFN_SQRT_FN:
++ if (!boundary_p && MODE_COMPOSITE_P (mode))
++ return 1 + rnd;
++ break;
++ CASE_CFN_COS:
++ CASE_CFN_COS_FN:
++ if (!boundary_p && mode == SFmode)
++ return 3 + rnd;
++ if (!boundary_p && MODE_COMPOSITE_P (mode))
++ return 4 + rnd;
++ break;
++ CASE_CFN_SIN:
++ CASE_CFN_SIN_FN:
++ if (!boundary_p && MODE_COMPOSITE_P (mode))
++ return 1 + rnd;
++ break;
++ default:
++ break;
++ }
++ return glibc_linux_libm_function_max_error (cfn, mode, boundary_p);
++ }
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
+diff --git a/gcc/config/rs6000/rs6000-protos.h
b/gcc/config/rs6000/rs6000-protos.h
+index 1a4fc1df6683..9a4cc18c6d3b 100644
+--- a/gcc/config/rs6000/rs6000-protos.h
++++ b/gcc/config/rs6000/rs6000-protos.h
+@@ -334,6 +334,8 @@ extern unsigned char
rs6000_class_max_nregs[][LIM_REG_CLASSES];
+ extern unsigned char rs6000_hard_regno_nregs[][FIRST_PSEUDO_REGISTER];
+
+ extern bool rs6000_linux_float_exceptions_rounding_supported_p (void);
++extern unsigned rs6000_linux_libm_function_max_error (unsigned,
machine_mode,
++ bool);
+
+ /* Pass management. */
+ namespace gcc { class context; }
+diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
+index a660e33739bd..33e7ffc8af5a 100644
+--- a/gcc/doc/tm.texi
++++ b/gcc/doc/tm.texi
+@@ -5760,6 +5760,21 @@ This hook determines whether a function from a class
of functions
+ @code{(enum function_class)}@var{fcode} has a fast implementation.
+ @end deftypefn
+
++@deftypefn {Target Hook} unsigned TARGET_LIBM_FUNCTION_MAX_ERROR (unsigned
@var{cfn}, machine_mode @var{mode}, bool @var{boundary_p})
++This hook determines expected maximum errors for math functions measured
++in ulps (units of the last place). 0 means 0.5ulps precision (correctly
++rounded). ~0U means unknown errors. The @code{combined_fn} @var{cfn}
++argument should identify just which math built-in function it is rather than
++its variant, @var{mode} the variant in terms of floating-point machine mode.
++The hook should also take into account @code{flag_rounding_math} whether it
++is maximum error just in default rounding mode, or in all possible rounding
++modes. @var{boundary_p} is @code{true} for maximum errors on intrinsic math
++boundaries of functions rather than errors inside of the usual result ranges
++of the functions. E.g.@ the sin/cos function finite result is in between
++-1.0 and 1.0 inclusive, with @var{boundary_p} true the function returns how
++many ulps below or above those boundaries result could be.
++@end deftypefn
++
+ @defmac NEXT_OBJC_RUNTIME
+ Set this macro to 1 to use the "NeXT" Objective-C message sending
conventions
+ by default. This calling convention involves passing the object, the
selector
+diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
+index f7ab5d48a634..c98b2447e28a 100644
+--- a/gcc/doc/tm.texi.in
++++ b/gcc/doc/tm.texi.in
+@@ -4004,6 +4004,8 @@ macro, a reasonable default is used.
+
+ @hook TARGET_LIBC_HAS_FAST_FUNCTION
+
++@hook TARGET_LIBM_FUNCTION_MAX_ERROR
++
+ @defmac NEXT_OBJC_RUNTIME
+ Set this macro to 1 to use the "NeXT" Objective-C message sending
conventions
+ by default. This calling convention involves passing the object, the
selector
+diff --git a/gcc/target.def b/gcc/target.def
+index 171bbd1caf15..cda6c51e5167 100644
+--- a/gcc/target.def
++++ b/gcc/target.def
+@@ -2670,6 +2670,23 @@ DEFHOOK
+ bool, (int fcode),
+ default_libc_has_fast_function)
+
++DEFHOOK
++(libm_function_max_error,
++ "This hook determines expected maximum errors for math functions
measured\n\
++in ulps (units of the last place). 0 means 0.5ulps precision (correctly\n\
++rounded). ~0U means unknown errors. The @code{combined_fn} @var{cfn}\n\
++argument should identify just which math built-in function it is rather
than\n\
++its variant, @var{mode} the variant in terms of floating-point machine
mode.\n\
++The hook should also take into account @code{flag_rounding_math} whether
it\n\
++is maximum error just in default rounding mode, or in all possible
rounding\n\
++modes. @var{boundary_p} is @code{true} for maximum errors on intrinsic
math\n\
++boundaries of functions rather than errors inside of the usual result
ranges\n\
++of the functions. E.g.@ the sin/cos function finite result is in between\n\
++-1.0 and 1.0 inclusive, with @var{boundary_p} true the function returns
how\n\
++many ulps below or above those boundaries result could be.",
++ unsigned, (unsigned cfn, machine_mode mode, bool boundary_p),
++ default_libm_function_max_error)
++
+ /* True if new jumps cannot be created, to replace existing ones or
+ not, at the current point in the compilation. */
+ DEFHOOK
+diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc
+index 51bf3fb7a82f..e190369f87a9 100644
+--- a/gcc/targhooks.cc
++++ b/gcc/targhooks.cc
+@@ -94,6 +94,7 @@ along with GCC; see the file COPYING3. If not see
+ #include "cfgloop.h"
+ #include "tree-vectorizer.h"
+ #include "options.h"
++#include "case-cfn-macros.h"
+
+ bool
+ default_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
+@@ -1903,6 +1904,73 @@ bsd_libc_has_function (enum function_class fn_class,
+ return false;
+ }
+
++unsigned
++default_libm_function_max_error (unsigned, machine_mode, bool)
++{
++ return ~0U;
++}
++
++unsigned
++glibc_linux_libm_function_max_error (unsigned cfn, machine_mode mode,
++ bool boundary_p)
++{
++ /* Let's use
++
https://www.gnu.org/software/libc/manual/2.22/html_node/Errors-in-Math-Functions.html
++
https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html
++ with usual values recorded here and significant outliers handled in
++ target CPU specific overriders. The tables only record default
++ rounding to nearest, for -frounding-math let's add some extra ulps.
++ For boundary_p values (say finite results outside of [-1.,1.] for
++ sin/cos, or [-0.,+Inf] for sqrt etc. let's use custom random testers.
*/
++ int rnd = flag_rounding_math ? 4 : 0;
++ bool sf = (REAL_MODE_FORMAT (mode) == &ieee_single_format
++ || REAL_MODE_FORMAT (mode) == &mips_single_format
++ || REAL_MODE_FORMAT (mode) == &motorola_single_format);
++ bool df = (REAL_MODE_FORMAT (mode) == &ieee_double_format
++ || REAL_MODE_FORMAT (mode) == &mips_double_format
++ || REAL_MODE_FORMAT (mode) == &motorola_double_format);
++ bool xf = (REAL_MODE_FORMAT (mode) == &ieee_extended_intel_96_format
++ || REAL_MODE_FORMAT (mode) == &ieee_extended_intel_128_format
++ || REAL_MODE_FORMAT (mode) == &ieee_extended_motorola_format);
++ bool tf = (REAL_MODE_FORMAT (mode) == &ieee_quad_format
++ || REAL_MODE_FORMAT (mode) == &mips_quad_format);
++
++ switch (cfn)
++ {
++ CASE_CFN_SQRT:
++ CASE_CFN_SQRT_FN:
++ if (boundary_p)
++ /* https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616595.html */
++ return 0;
++ if (sf || df || xf || tf)
++ return 0 + rnd;
++ break;
++ CASE_CFN_COS:
++ CASE_CFN_COS_FN:
++ /* cos is generally errors like sin, but far more arches have 2ulps
++ for double. */
++ if (!boundary_p && df)
++ return 2 + rnd;
++ gcc_fallthrough ();
++ CASE_CFN_SIN:
++ CASE_CFN_SIN_FN:
++ if (boundary_p)
++ /* According to
++ https://sourceware.org/pipermail/gcc-patches/2023-April/616315.html
++ seems default rounding sin/cos stay strictly in [-1.,1.] range,
++ with rounding to infinity it can be 1ulp larger/smaller. */
++ return flag_rounding_math ? 1 : 0;
++ if (sf || df)
++ return 1 + rnd;
++ if (xf || tf)
++ return 2 + rnd;
++ break;
++ default:
++ break;
++ }
++
++ return default_libm_function_max_error (cfn, mode, boundary_p);
++}
+
+ tree
+ default_builtin_tm_load_store (tree ARG_UNUSED (type))
+diff --git a/gcc/targhooks.h b/gcc/targhooks.h
+index cf3d3107a0db..1a0db8dddd59 100644
+--- a/gcc/targhooks.h
++++ b/gcc/targhooks.h
+@@ -219,6 +219,9 @@ extern bool default_libc_has_fast_function (int fcode);
+ extern bool no_c99_libc_has_function (enum function_class, tree);
+ extern bool gnu_libc_has_function (enum function_class, tree);
+ extern bool bsd_libc_has_function (enum function_class, tree);
++extern unsigned default_libm_function_max_error (unsigned, machine_mode,
bool);
++extern unsigned glibc_linux_libm_function_max_error (unsigned, machine_mode,
++ bool);
+
+ extern tree default_builtin_tm_load_store (tree);
+
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0001-musl-always-use--lib--directory-for-all-x86_64-ABIs.patch

b/gnu/gcc/patches/0001-musl-always-use--lib--directory-for-all-x86_64-ABIs.patch
deleted file mode 100644
index 80fa28c..0000000
---
a/gnu/gcc/patches/0001-musl-always-use--lib--directory-for-all-x86_64-ABIs.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From f313773d9087298a3f0ab45602791946debff8b7 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox AT gentoo.org>
-Date: Mon, 05 Jul 2021 18:15:44 +0000
-Subject: [PATCH] musl: always use 'lib' directory for all x86_64 ABIs
[PR90077]
-Message-ID: <20210705181544.1519647-1-slyfox AT gentoo.org>
-
-From: Sergei Trofimovich <siarheit AT google.com>
-
-musl library intentionally does not support glibc-style multilib layout
-and usually assumes --libdir=lib (Gentoo and Alpine Linux both use it).
-
-Before the change --disable-multilib x86_64-gentoo-linux-musl returned:
-
- $ gcc -print-multi-os-directory
- ../lib64
- $ gcc -print-multi-os-directory -m32
- ../lib32
- $ gcc -print-multi-os-directory -mx32
- ../libx32
-
-After the change the layout is always the same:
-
- $ gcc -print-multi-os-directory
- ../lib
- $ gcc -print-multi-os-directory -m32
- ../lib
- $ gcc -print-multi-os-directory -mx32
- ../lib
-
-The discrepancy was noticed in meson build system which uses
--print-multi-os-directory to find out target directory.
-
-Debian's multi-arch setup should not change.
-
- PR target/90077
-
-gcc/ChangeLog
-
- * gcc/config.gcc: Specal case musl to t-linux64-musl.
-
- * gcc/config/i386/t-linux64-musl: New file based on t-linux64
- that pins MULTILIB_OSDIRNAMES to lib.
-
-Origin: Gentoo
-Upstream-Status: Submitted
[https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574482.html]
-Signed-off-by: Ismael Luceno <ismael AT iodev.co.uk>
----
- gcc/config.gcc | 10 ++++++++--
- gcc/config/i386/t-linux64-musl | 28 ++++++++++++++++++++++++++++
- 2 files changed, 36 insertions(+), 2 deletions(-)
- create mode 100644 gcc/config/i386/t-linux64-musl
-
-diff --git a/gcc/config.gcc b/gcc/config.gcc
-index 0230bb88861..a87a59c9403 100644
---- a/gcc/config.gcc
-+++ b/gcc/config.gcc
-@@ -1923,7 +1923,10 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu |
i[34567]86-*-gnu* | i[34567]8
- if test x$enable_targets = xall; then
- tm_file="${tm_file} i386/x86-64.h
i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
- tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-- tmake_file="${tmake_file} i386/t-linux64"
-+ case $target in
-+ *-*-*musl*) tmake_file="${tmake_file}
i386/t-linux64-musl";;
-+ *) tmake_file="${tmake_file} i386/t-linux64";;
-+ esac
- x86_multilibs="${with_multilib_list}"
- if test "$x86_multilibs" = "default"; then
- x86_multilibs="m64,m32"
-@@ -1983,7 +1986,10 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu)
- tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"
- ;;
- esac
-- tmake_file="${tmake_file} i386/t-linux64"
-+ case $target in
-+ *-*-*musl*) tmake_file="${tmake_file} i386/t-linux64-musl";;
-+ *) tmake_file="${tmake_file} i386/t-linux64";;
-+ esac
- x86_multilibs="${with_multilib_list}"
- if test "$x86_multilibs" = "default"; then
- case ${with_abi} in
-diff --git a/gcc/config/i386/t-linux64-musl b/gcc/config/i386/t-linux64-musl
-new file mode 100644
-index 00000000000..58e23c3c7dc
---- /dev/null
-+++ b/gcc/config/i386/t-linux64-musl
-@@ -0,0 +1,28 @@
-+# Copyright (C) 2002-2021 Free Software Foundation, Inc.
-+#
-+# This file is part of GCC.
-+#
-+# GCC is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3, or (at your option)
-+# any later version.
-+#
-+# GCC is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with GCC; see the file COPYING3. If not see
-+# &lt;<a
href="http://www.gnu.org/licenses/";>http://www.gnu.org/licenses/</a>&gt;.
-+
-+# musl explicitly does not support lib/lib32/lib64 layouts and always
-+# uses lib layout. On debian full arch suffix is used. Thus we populate
-+# all the m32/m64/mx32 with the same lib and apply multiarch suffix.
-+
-+comma=,
-+MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
-+MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-+MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
-+MULTILIB_OSDIRNAMES+= m32=../lib$(call if_multiarch,:i386-linux-gnu)
-+MULTILIB_OSDIRNAMES+= mx32=../lib$(call if_multiarch,:x86_64-linux-gnux32)
---
-2.32.0
diff --git
a/gnu/gcc/patches/0002-Remove-conflicting-duplicated-manpages.patch
b/gnu/gcc/patches/0002-Remove-conflicting-duplicated-manpages.patch
new file mode 100644
index 0000000..7470f35
--- /dev/null
+++ b/gnu/gcc/patches/0002-Remove-conflicting-duplicated-manpages.patch
@@ -0,0 +1,36 @@
+From 92af01f41471d7e932950860f3fb9271fbea2926 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Mon, 10 Jul 2023 21:58:03 +0000
+Subject: [PATCH 02/13] Remove conflicting/duplicated manpages
+
+The fsf-funding.7, gfdl.7, and gpl.7 files conflict with other
+installed instances of GCC. Since there's no point in having
+different versions of these files, just remove them from the
+installation.
+
+Origin: Source Mage
+Upstream-Status: Inappropiate
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/Makefile.in | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index ad9a5d94cd01..a6c0592c7e9d 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -3889,10 +3889,7 @@ install-man: lang.install-man \
+ $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \
+ $(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext) \
+ $(DESTDIR)$(man1dir)/$(GCOV_DUMP_INSTALL_NAME)$(man1ext) \
+- $(if $(filter
yes,@enable_lto@),$(DESTDIR)$(man1dir)/$(LTO_DUMP_INSTALL_NAME)$(man1ext)) \
+- $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \
+- $(DESTDIR)$(man7dir)/gfdl$(man7ext) \
+- $(DESTDIR)$(man7dir)/gpl$(man7ext)
++ $(if $(filter
yes,@enable_lto@),$(DESTDIR)$(man1dir)/$(LTO_DUMP_INSTALL_NAME)$(man1ext))
+
+ $(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs
+ -rm -f $@
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/0003-all-posix_memalign.patch
b/gnu/gcc/patches/0003-all-posix_memalign.patch
new file mode 100644
index 0000000..f4ada43
--- /dev/null
+++ b/gnu/gcc/patches/0003-all-posix_memalign.patch
@@ -0,0 +1,45 @@
+From 9d3ea1c18250b0db443ce4f6fd6febbce6903cdd Mon Sep 17 00:00:00 2001
+From: Unknown <unknown>
+Date: Thu, 13 Jul 2023 17:38:12 +0200
+Subject: [PATCH 03/13] all posix_memalign
+
+Origin: Gentoo
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/config/i386/pmm_malloc.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
+index 3527283693bd..ea0421ecb0c2 100644
+--- a/gcc/config/i386/pmm_malloc.h
++++ b/gcc/config/i386/pmm_malloc.h
+@@ -27,12 +27,13 @@
+ #include <stdlib.h>
+
+ /* We can't depend on <stdlib.h> since the prototype of posix_memalign
+- may not be visible. */
++ may not be visible and we can't pollute the namespace either. */
+ #ifndef __cplusplus
+-extern int posix_memalign (void **, size_t, size_t);
++extern int __gcc_posix_memalign (void **, size_t, size_t)
+ #else
+-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
++extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw ()
+ #endif
++__asm__("posix_memalign");
+
+ static __inline void *
+ _mm_malloc (size_t __size, size_t __alignment)
+@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
+ return malloc (__size);
+ if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
+ __alignment = sizeof (void *);
+- if (posix_memalign (&__ptr, __alignment, __size) == 0)
++ if (__gcc_posix_memalign (&__ptr, __alignment, __size) == 0)
+ return __ptr;
+ else
+ return NULL;
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0004-convert-__cpu_indicator_init-to-__cpu_indicator_init.patch

b/gnu/gcc/patches/0004-convert-__cpu_indicator_init-to-__cpu_indicator_init.patch
new file mode 100644
index 0000000..40b46ec
--- /dev/null
+++
b/gnu/gcc/patches/0004-convert-__cpu_indicator_init-to-__cpu_indicator_init.patch
@@ -0,0 +1,46 @@
+From aaea9a0d97fb8adc7801453783886795341eca69 Mon Sep 17 00:00:00 2001
+From: Unknown <unknown>
+Date: Thu, 7 May 2020 21:14:11 -0500
+Subject: [PATCH 04/13] convert "__cpu_indicator_init" to
+ "__cpu_indicator_init_local"
+
+Origin: Gentoo
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/config/i386/i386-expand.cc | 4 ++--
+ libgcc/config/i386/cpuinfo.c | 3 +++
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
+index 0d817fc3f3b8..4dfc79e8b50c 100644
+--- a/gcc/config/i386/i386-expand.cc
++++ b/gcc/config/i386/i386-expand.cc
+@@ -12691,10 +12691,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx
subtarget,
+ {
+ case IX86_BUILTIN_CPU_INIT:
+ {
+- /* Make it call __cpu_indicator_init in libgcc. */
++ /* Make it call __cpu_indicator_init_local in libgcc. */
+ tree call_expr, fndecl, type;
+ type = build_function_type_list (integer_type_node, NULL_TREE);
+- fndecl = build_fn_decl ("__cpu_indicator_init", type);
++ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
+ call_expr = build_call_expr (fndecl, 0);
+ return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
+ }
+diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
+index 50b6d8248a27..bbc0684ae65f 100644
+--- a/libgcc/config/i386/cpuinfo.c
++++ b/libgcc/config/i386/cpuinfo.c
+@@ -66,4 +66,7 @@ __cpu_indicator_init (void)
+ #if defined SHARED && defined USE_ELF_SYMVER
+ __asm__ (".symver __cpu_indicator_init, __cpu_indicator_init AT GCC_4.8.0");
+ __asm__ (".symver __cpu_model, __cpu_model AT GCC_4.8.0");
++#elif ! defined SHARED
++int __cpu_indicator_init_local (void)
++ __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0005-musl-always-use-lib-directory-for-all-x86_64-ABIs-PR.patch

b/gnu/gcc/patches/0005-musl-always-use-lib-directory-for-all-x86_64-ABIs-PR.patch
new file mode 100644
index 0000000..8d9bb1e
--- /dev/null
+++
b/gnu/gcc/patches/0005-musl-always-use-lib-directory-for-all-x86_64-ABIs-PR.patch
@@ -0,0 +1,115 @@
+From da72f8c07ee6d51a79cbb98d2ae54a79754a0eb4 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <siarheit AT google.com>
+Date: Mon, 5 Jul 2021 18:15:44 +0000
+Subject: [PATCH 05/13] musl: always use 'lib' directory for all x86_64 ABIs
+ [PR90077]
+
+musl library intentionally does not support glibc-style multilib layout
+and usually assumes --libdir=lib (Gentoo and Alpine Linux both use it).
+
+Before the change --disable-multilib x86_64-gentoo-linux-musl returned:
+
+ $ gcc -print-multi-os-directory
+ ../lib64
+ $ gcc -print-multi-os-directory -m32
+ ../lib32
+ $ gcc -print-multi-os-directory -mx32
+ ../libx32
+
+After the change the layout is always the same:
+
+ $ gcc -print-multi-os-directory
+ ../lib
+ $ gcc -print-multi-os-directory -m32
+ ../lib
+ $ gcc -print-multi-os-directory -mx32
+ ../lib
+
+The discrepancy was noticed in meson build system which uses
+-print-multi-os-directory to find out target directory.
+
+Debian's multi-arch setup should not change.
+
+ PR target/90077
+
+gcc/ChangeLog
+
+ * gcc/config.gcc: Specal case musl to t-linux64-musl.
+
+ * gcc/config/i386/t-linux64-musl: New file based on t-linux64
+ that pins MULTILIB_OSDIRNAMES to lib.
+
+Origin: Gentoo
+Upstream-Status: Submitted
[https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574482.html]
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/config.gcc | 10 ++++++++--
+ gcc/config/i386/t-linux64-musl | 28 ++++++++++++++++++++++++++++
+ 2 files changed, 36 insertions(+), 2 deletions(-)
+ create mode 100644 gcc/config/i386/t-linux64-musl
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 6fd1594480a1..ea378b41dc35 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -1924,7 +1924,10 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu |
i[34567]86-*-gnu* | i[34567]8
+ if test x$enable_targets = xall; then
+ tm_file="${tm_file} i386/x86-64.h
i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
+ tm_defines="${tm_defines} TARGET_BI_ARCH=1"
+- tmake_file="${tmake_file} i386/t-linux64"
++ case $target in
++ *-*-*musl*) tmake_file="${tmake_file}
i386/t-linux64-musl";;
++ *) tmake_file="${tmake_file} i386/t-linux64";;
++ esac
+ x86_multilibs="${with_multilib_list}"
+ if test "$x86_multilibs" = "default"; then
+ x86_multilibs="m64,m32"
+@@ -1987,7 +1990,10 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu |
x86_64-*-gnu*)
+ tm_file="${tm_file} gnu.h i386/gnu64.h"
+ ;;
+ esac
+- tmake_file="${tmake_file} i386/t-linux64"
++ case $target in
++ *-*-*musl*) tmake_file="${tmake_file} i386/t-linux64-musl";;
++ *) tmake_file="${tmake_file} i386/t-linux64";;
++ esac
+ x86_multilibs="${with_multilib_list}"
+ if test "$x86_multilibs" = "default"; then
+ case ${with_abi} in
+diff --git a/gcc/config/i386/t-linux64-musl b/gcc/config/i386/t-linux64-musl
+new file mode 100644
+index 000000000000..fcacec410e53
+--- /dev/null
++++ b/gcc/config/i386/t-linux64-musl
+@@ -0,0 +1,28 @@
++# Copyright (C) 2002-2021 Free Software Foundation, Inc.
++#
++# This file is part of GCC.
++#
++# GCC is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# GCC is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GCC; see the file COPYING3. If not see
++# &lt;<a
href="http://www.gnu.org/licenses/";>http://www.gnu.org/licenses/</a>&gt;.
++
++# musl explicitly does not support lib/lib32/lib64 layouts and always
++# uses lib layout. On debian full arch suffix is used. Thus we populate
++# all the m32/m64/mx32 with the same lib and apply multiarch suffix.
++
++comma=,
++MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
++MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib$(call if_multiarch,:i386-linux-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../lib$(call if_multiarch,:x86_64-linux-gnux32)
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/0006-ada-libgnarl-compatibility-for-musl.patch
b/gnu/gcc/patches/0006-ada-libgnarl-compatibility-for-musl.patch
new file mode 100644
index 0000000..a9970f7
--- /dev/null
+++ b/gnu/gcc/patches/0006-ada-libgnarl-compatibility-for-musl.patch
@@ -0,0 +1,138 @@
+From 447ffc221168d346be9fde743d230a0e6f89fd6c Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne AT dereferenced.org>
+Date: Fri, 21 Aug 2020 07:06:30 +0000
+Subject: [PATCH 06/13] ada: libgnarl compatibility for musl
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/ada/libgnarl/s-osinte__linux.ads | 11 ------
+ gcc/ada/libgnarl/s-taprop__linux.adb | 53 ++--------------------------
+ 2 files changed, 3 insertions(+), 61 deletions(-)
+
+diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads
b/gcc/ada/libgnarl/s-osinte__linux.ads
+index a5e645d334d5..321653470714 100644
+--- a/gcc/ada/libgnarl/s-osinte__linux.ads
++++ b/gcc/ada/libgnarl/s-osinte__linux.ads
+@@ -403,12 +403,6 @@ package System.OS_Interface is
+ PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
+ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
+
+- function pthread_rwlockattr_setkind_np
+- (attr : access pthread_rwlockattr_t;
+- pref : int) return int;
+- pragma Import
+- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
+-
+ function pthread_rwlock_init
+ (mutex : access pthread_rwlock_t;
+ attr : access pthread_rwlockattr_t) return int;
+@@ -470,11 +464,6 @@ package System.OS_Interface is
+ protocol : int) return int;
+ pragma Import (C, pthread_mutexattr_setprotocol);
+
+- function pthread_mutexattr_setprioceiling
+- (attr : access pthread_mutexattr_t;
+- prioceiling : int) return int;
+- pragma Import (C, pthread_mutexattr_setprioceiling);
+-
+ type struct_sched_param is record
+ sched_priority : int; -- scheduling priority
+ end record;
+diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb
b/gcc/ada/libgnarl/s-taprop__linux.adb
+index 821ceef30e4e..ae95b58e01ee 100644
+--- a/gcc/ada/libgnarl/s-taprop__linux.adb
++++ b/gcc/ada/libgnarl/s-taprop__linux.adb
+@@ -198,9 +198,6 @@ package body System.Task_Primitives.Operations is
+ pragma Import
+ (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
+
+- function GNAT_has_cap_sys_nice return C.int;
+- pragma Import
+- (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
+ -- We do not have pragma Linker_Options ("-lcap"); here, because this
+ -- library is not present on many Linux systems. 'libcap' is the Linux
+ -- "capabilities" library, called by __gnat_has_cap_sys_nice.
+@@ -210,38 +207,6 @@ package body System.Task_Primitives.Operations is
+ -- Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
+ -- GNU/Linux, so we map 0 .. 98 to 1 .. 99.
+
+- function Get_Ceiling_Support return Boolean;
+- -- Get the value of the Ceiling_Support constant (see below).
+- -- Note well: If this function or related code is modified, it should be
+- -- tested by hand, because automated testing doesn't exercise it.
+-
+- -------------------------
+- -- Get_Ceiling_Support --
+- -------------------------
+-
+- function Get_Ceiling_Support return Boolean is
+- Ceiling_Support : Boolean := False;
+- begin
+- if Locking_Policy /= 'C' then
+- return False;
+- end if;
+-
+- declare
+- function geteuid return Integer;
+- pragma Import (C, geteuid, "geteuid");
+- Superuser : constant Boolean := geteuid = 0;
+- Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
+- pragma Assert (Has_Cap in 0 | 1);
+- begin
+- Ceiling_Support := Superuser or else Has_Cap = 1;
+- end;
+-
+- return Ceiling_Support;
+- end Get_Ceiling_Support;
+-
+- pragma Warnings (Off, "non-preelaborable call not allowed*");
+- Ceiling_Support : constant Boolean := Get_Ceiling_Support;
+- pragma Warnings (On, "non-preelaborable call not allowed*");
+ -- True if the locking policy is Ceiling_Locking, and the current
process
+ -- has permission to use this policy. The process has permission if it
is
+ -- running as 'root', or if the capability was set by the setcap
command,
+@@ -344,7 +309,9 @@ package body System.Task_Primitives.Operations is
+ -- Init_Mutex --
+ ----------------
+
++ pragma Warnings (Off, "formal parameter * is not referenced");
+ function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int
is
++ pragma Warnings (On, "formal parameter * is not referenced");
+ Mutex_Attr : aliased pthread_mutexattr_t;
+ Result, Result_2 : C.int;
+
+@@ -356,16 +323,7 @@ package body System.Task_Primitives.Operations is
+ return Result;
+ end if;
+
+- if Ceiling_Support then
+- Result := pthread_mutexattr_setprotocol
+- (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
+- pragma Assert (Result = 0);
+-
+- Result := pthread_mutexattr_setprioceiling
+- (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
+- pragma Assert (Result = 0);
+-
+- elsif Locking_Policy = 'I' then
++ if Locking_Policy = 'I' then
+ Result := pthread_mutexattr_setprotocol
+ (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
+ pragma Assert (Result = 0);
+@@ -405,11 +363,6 @@ package body System.Task_Primitives.Operations is
+ Result := pthread_rwlockattr_init (RWlock_Attr'Access);
+ pragma Assert (Result = 0);
+
+- Result := pthread_rwlockattr_setkind_np
+- (RWlock_Attr'Access,
+- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
+- pragma Assert (Result = 0);
+-
+ Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
+
+ pragma Assert (Result in 0 | ENOMEM);
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/0007-ada-musl-support-fixes.patch
b/gnu/gcc/patches/0007-ada-musl-support-fixes.patch
new file mode 100644
index 0000000..d8a1b3a
--- /dev/null
+++ b/gnu/gcc/patches/0007-ada-musl-support-fixes.patch
@@ -0,0 +1,226 @@
+From c551e81f2957f8a81d4bce32032bb0219c0e8e63 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne AT dereferenced.org>
+Date: Fri, 21 Aug 2020 07:07:48 +0000
+Subject: [PATCH 07/13] ada: musl support fixes
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/ada/Makefile.rtl | 10 +++++-----
+ gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
+ gcc/ada/adaint.h | 10 ++++------
+ gcc/ada/terminals.c | 8 ++++----
+ 4 files changed, 32 insertions(+), 30 deletions(-)
+
+diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
+index 96306f8cc9ae..090b6770ae51 100644
+--- a/gcc/ada/Makefile.rtl
++++ b/gcc/ada/Makefile.rtl
+@@ -1549,7 +1549,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu)
$(target_os))),)
+ s-intman.adb<libgnarl/s-intman__posix.adb \
+ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ a-exetim.adb<libgnarl/a-exetim__posix.adb \
+ a-exetim.ads<libgnarl/a-exetim__default.ads \
+ s-linux.ads<libgnarl/s-linux.ads \
+@@ -2174,7 +2174,7 @@ ifeq ($(strip $(filter-out powerpc%
linux%,$(target_cpu) $(target_os))),)
+ s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
+ s-taspri.ads<libgnarl/s-taspri__posix.ads \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ system.ads<libgnat/system-linux-ppc.ads
+@@ -2205,7 +2205,7 @@ ifeq ($(strip $(filter-out powerpc%
linux%,$(target_cpu) $(target_os))),)
+ endif
+
+ # ARM linux, GNU eabi
+-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu)
$(target_os))),)
++ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi%
linux-muslgnueabi%,$(target_cpu) $(target_os))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
+@@ -2420,7 +2420,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu)
$(target_os))),)
+ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ $(GNATRTL_128BIT_PAIRS) \
+@@ -2524,7 +2524,7 @@ ifeq ($(strip $(filter-out %x86_64
linux%,$(target_cpu) $(target_os))),)
+ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ s-taspri.ads<libgnarl/s-taspri__posix.ads \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(X86_64_TARGET_PAIRS) \
+ $(SIMD_PATH_TARGET_PAIRS) \
+diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
+index 8522094164e0..dcb9e95251a3 100644
+--- a/gcc/ada/adaint.c
++++ b/gcc/ada/adaint.c
+@@ -92,6 +92,11 @@
+ #include <sys/pstat.h>
+ #endif
+
++#if defined (linux) || defined(__linux__)
++#define _GNU_SOURCE 1
++#include <sched.h>
++#endif
++
+ #ifdef __PikeOS__
+ #define __BSD_VISIBLE 1
+ #endif
+@@ -3438,7 +3443,6 @@ __gnat_lwp_self (void)
+ #endif
+
+ #if defined (__linux__)
+-#include <sched.h>
+
+ /* glibc versions earlier than 2.7 do not define the routines to handle
+ dynamically allocated CPU sets. For these targets, we use the static
+@@ -3448,7 +3452,7 @@ __gnat_lwp_self (void)
+
+ /* Dynamic cpu sets */
+
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count)
+ {
+ return CPU_ALLOC (count);
+@@ -3461,33 +3465,33 @@ __gnat_cpu_alloc_size (size_t count)
+ }
+
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__gnat_cpu_free (void *set)
+ {
+- CPU_FREE (set);
++ CPU_FREE ((cpu_set_t *) set);
+ }
+
+ void
+-__gnat_cpu_zero (size_t count, cpu_set_t *set)
++__gnat_cpu_zero (size_t count, void *set)
+ {
+- CPU_ZERO_S (count, set);
++ CPU_ZERO_S (count, (cpu_set_t *) set);
+ }
+
+ void
+-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
++__gnat_cpu_set (int cpu, size_t count, void *set)
+ {
+ /* Ada handles CPU numbers starting from 1, while C identifies the first
+ CPU by a 0, so we need to adjust. */
+- CPU_SET_S (cpu - 1, count, set);
++ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
+ }
+
+ #else /* !CPU_ALLOC */
+
+ /* Static cpu sets */
+
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
+ {
+- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
++ return xmalloc (sizeof (cpu_set_t));
+ }
+
+ size_t
+@@ -3497,23 +3501,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
+ }
+
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__gnat_cpu_free (void *set)
+ {
+ free (set);
+ }
+
+ void
+-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+- CPU_ZERO (set);
++ CPU_ZERO ((cpu_set_t *) set);
+ }
+
+ void
+-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+ /* Ada handles CPU numbers starting from 1, while C identifies the first
+ CPU by a 0, so we need to adjust. */
+- CPU_SET (cpu - 1, set);
++ CPU_SET (cpu - 1, (cpu_set_t *) set);
+ }
+ #endif /* !CPU_ALLOC */
+ #endif /* __linux__ */
+diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
+index 987432c93072..4d782f07de92 100644
+--- a/gcc/ada/adaint.h
++++ b/gcc/ada/adaint.h
+@@ -319,13 +319,11 @@ extern void *__gnat_lwp_self
(void);
+
+ /* Routines for interface to required CPU set primitives */
+
+-#include <sched.h>
+-
+-extern cpu_set_t *__gnat_cpu_alloc (size_t);
++extern void * __gnat_cpu_alloc (size_t);
+ extern size_t __gnat_cpu_alloc_size (size_t);
+-extern void __gnat_cpu_free (cpu_set_t *);
+-extern void __gnat_cpu_zero (size_t, cpu_set_t *);
+-extern void __gnat_cpu_set (int, size_t, cpu_set_t
*);
++extern void __gnat_cpu_free (void *);
++extern void __gnat_cpu_zero (size_t, void *);
++extern void __gnat_cpu_set (int, size_t, void *);
+ #endif
+
+ #if defined (_WIN32)
+diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
+index c0ee4a16bb1a..ed796a48c1b7 100644
+--- a/gcc/ada/terminals.c
++++ b/gcc/ada/terminals.c
+@@ -1127,7 +1127,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
+ /* POSIX does not specify how to open the master side of a terminal.Several
+ methods are available (system specific):
+ 1- using a cloning device (USE_CLONE_DEVICE)
+- 2- getpt (USE_GETPT)
++ 2- posix_openpt (USE_POSIX_OPENPT)
+ 3- openpty (USE_OPENPTY)
+
+ When using the cloning device method, the macro USE_CLONE_DEVICE should
+@@ -1141,7 +1141,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED,
+ #if defined (__APPLE__) || defined (BSD)
+ #define USE_OPENPTY
+ #elif defined (__linux__)
+-#define USE_GETPT
++#define USE_POSIX_OPENPT
+ #elif defined (__sun__)
+ #define USE_CLONE_DEVICE "/dev/ptmx"
+ #elif defined (_AIX)
+@@ -1190,8 +1190,8 @@ allocate_pty_desc (pty_desc **desc) {
+ int master_fd = -1;
+ char *slave_name = NULL;
+
+-#ifdef USE_GETPT
+- master_fd = getpt ();
++#if defined(USE_POSIX_OPENPT)
++ master_fd = posix_openpt(O_RDWR | O_NOCTTY);
+ #elif defined (USE_OPENPTY)
+ status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
+ #elif defined (USE_CLONE_DEVICE)
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0008-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch

b/gnu/gcc/patches/0008-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
new file mode 100644
index 0000000..51224ec
--- /dev/null
+++
b/gnu/gcc/patches/0008-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
@@ -0,0 +1,30 @@
+From 52805ba84cefb34275220da2c0424671e5f316e7 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Thu, 30 Jun 2022 16:44:51 +0000
+Subject: [PATCH 08/13] libstdc++: do not throw exceptions for non-C locales
on
+ musl targets
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ libstdc++-v3/config/locale/generic/c_locale.cc | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc
b/libstdc++-v3/config/locale/generic/c_locale.cc
+index 8849d78fdfac..aff467f98fe1 100644
+--- a/libstdc++-v3/config/locale/generic/c_locale.cc
++++ b/libstdc++-v3/config/locale/generic/c_locale.cc
+@@ -242,9 +242,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // Currently, the generic model only supports the "C" locale.
+ // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
+ __cloc = 0;
+- if (strcmp(__s, "C"))
+- __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+- "name not valid"));
+ }
+
+ void
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0009-gdc-unconditionally-link-libgphobos-against-libucont.patch

b/gnu/gcc/patches/0009-gdc-unconditionally-link-libgphobos-against-libucont.patch
new file mode 100644
index 0000000..922b7c0
--- /dev/null
+++
b/gnu/gcc/patches/0009-gdc-unconditionally-link-libgphobos-against-libucont.patch
@@ -0,0 +1,31 @@
+From f1303df4cf4cd4865b29221cc9a9c5275fb3125f Mon Sep 17 00:00:00 2001
+From: Mathias LANG <pro.mathias.lang AT gmail.com>
+Date: Mon, 17 Jan 2022 03:49:21 +0000
+Subject: [PATCH 09/13] gdc: unconditionally link libgphobos against
+ libucontext
+
+Ref: alpine/aports#13422
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 06a9398e1722..0c19a04d661f 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -52807,7 +52807,7 @@ configure-target-libphobos:
+ esac; \
+ module_srcdir=libphobos; \
+ rm -f no-such-file || : ; \
+- CONFIG_SITE=no-such-file $(SHELL) \
++ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
+ $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0010-druntime-link-against-libucontext-on-all-platforms.patch

b/gnu/gcc/patches/0010-druntime-link-against-libucontext-on-all-platforms.patch
new file mode 100644
index 0000000..657fc59
--- /dev/null
+++
b/gnu/gcc/patches/0010-druntime-link-against-libucontext-on-all-platforms.patch
@@ -0,0 +1,58 @@
+From 378db466221355b7770bafe547950aa3dd59d2fa Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git AT soeren-tempel.net>
+Date: Sat, 16 Jul 2022 09:21:11 +0200
+Subject: [PATCH 10/13] druntime: link against libucontext on all platforms
+
+On musl-based Linux distributions, swapcontext etc. are not provided by
+musl but instead by libucontext. Hence, we _always_ need to link against
+an external library for these functions.
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ libphobos/configure | 8 --------
+ libphobos/m4/druntime/libraries.m4 | 8 --------
+ 2 files changed, 16 deletions(-)
+
+diff --git a/libphobos/configure b/libphobos/configure
+index 925c53c5f5e4..60c2a0c11c67 100755
+--- a/libphobos/configure
++++ b/libphobos/configure
+@@ -15216,14 +15216,6 @@ fi
+ # Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
+ # "yes" for targets that have 'version = AsmExternal'.
+ druntime_fiber_asm_external=no
+- case "$target_cpu" in
+- aarch64* | \
+- arm* | \
+- i[34567]86|x86_64 | \
+- powerpc)
+- druntime_fiber_asm_external=yes
+- ;;
+- esac
+ if test "$druntime_fiber_asm_external" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library
containing swapcontext" >&5
+ $as_echo_n "checking for library containing swapcontext... " >&6; }
+diff --git a/libphobos/m4/druntime/libraries.m4
b/libphobos/m4/druntime/libraries.m4
+index 45a56f6f76a7..fef6e890b1e4 100644
+--- a/libphobos/m4/druntime/libraries.m4
++++ b/libphobos/m4/druntime/libraries.m4
+@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT],
+ # Keep this in sync with core/thread.d, set druntime_fiber_asm_external to
+ # "yes" for targets that have 'version = AsmExternal'.
+ druntime_fiber_asm_external=no
+- case "$target_cpu" in
+- aarch64* | \
+- arm* | \
+- i[[34567]]86|x86_64 | \
+- powerpc)
+- druntime_fiber_asm_external=yes
+- ;;
+- esac
+ if test "$druntime_fiber_asm_external" = no; then
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [],
+ AC_MSG_ERROR([swapcontext required but not found]))
+--
+2.40.1
+
diff --git
a/gnu/gcc/patches/0011-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
b/gnu/gcc/patches/0011-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
new file mode 100644
index 0000000..d42abea
--- /dev/null
+++ b/gnu/gcc/patches/0011-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
@@ -0,0 +1,28 @@
+From 5db97215bf502f07dcdd693f46fbdcaa3ca5fac6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git AT soeren-tempel.net>
+Date: Tue, 19 Jul 2022 14:54:07 +0200
+Subject: [PATCH 11/13] libgnat: time_t is always 64-bit on musl libc
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ gcc/ada/libgnat/s-parame.ads | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/ada/libgnat/s-parame.ads b/gcc/ada/libgnat/s-parame.ads
+index 3d6e345a1ba9..cfe0b4d3ca6c 100644
+--- a/gcc/ada/libgnat/s-parame.ads
++++ b/gcc/ada/libgnat/s-parame.ads
+@@ -102,7 +102,7 @@ package System.Parameters is
+ -- Characteristics of time_t type --
+ ------------------------------------
+
+- time_t_bits : constant := Long_Integer'Size;
++ time_t_bits : constant := Long_Long_Integer'Size;
+ -- Number of bits in type time_t
+
+ ----------------------------------------------
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/0012-libphobos-do-not-use-LFS64-symbols.patch
b/gnu/gcc/patches/0012-libphobos-do-not-use-LFS64-symbols.patch
new file mode 100644
index 0000000..ae51a8e
--- /dev/null
+++ b/gnu/gcc/patches/0012-libphobos-do-not-use-LFS64-symbols.patch
@@ -0,0 +1,34 @@
+From c6aac26ea17dcdc5ac45f78fddd703a6962a2e3d Mon Sep 17 00:00:00 2001
+From: psykose <alice AT ayaya.dev>
+Date: Mon, 29 May 2023 15:33:11 +0000
+Subject: [PATCH 12/13] libphobos: do not use LFS64 symbols
+
+musl does not have these since 1.2.4, we can't use the compat interfaces.
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ libphobos/libdruntime/core/sys/posix/sys/mman.d | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d
b/libphobos/libdruntime/core/sys/posix/sys/mman.d
+index 0d3d517d69a5..323aa0af72db 100644
+--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
++++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
+@@ -293,11 +293,7 @@ else version (CRuntime_Bionic)
+ }
+ else version (CRuntime_Musl)
+ {
+- static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int,
int, off_t);
+- static if (__USE_FILE_OFFSET64)
+- alias mmap = mmap64;
+- else
+- void* mmap(void*, size_t, int, int, int, off_t);
++ void* mmap(void*, size_t, int, int, int, off_t);
+ int munmap(void*, size_t);
+ }
+ else version (CRuntime_UClibc)
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/0013-libgo-fix-lfs64-use.patch
b/gnu/gcc/patches/0013-libgo-fix-lfs64-use.patch
new file mode 100644
index 0000000..85bcd1c
--- /dev/null
+++ b/gnu/gcc/patches/0013-libgo-fix-lfs64-use.patch
@@ -0,0 +1,198 @@
+From 09513be79b48fafe3554b3cb873f0e827772747f Mon Sep 17 00:00:00 2001
+From: psykose <alice AT ayaya.dev>
+Date: Mon, 10 Jul 2023 23:23:29 +0000
+Subject: [PATCH 13/13] libgo: fix lfs64 use
+
+Origin: Alpine Linux
+Upstream-Status: Unknown
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ .../go/internal/syscall/unix/at_largefile.go | 2 +-
+ libgo/go/os/dir_largefile.go | 2 +-
+ libgo/go/syscall/libcall_glibc.go | 2 +-
+ libgo/go/syscall/libcall_linux.go | 4 +--
+ libgo/go/syscall/libcall_posix_largefile.go | 26 +++++++++----------
+ libgo/runtime/go-varargs.c | 2 +-
+ libgo/sysinfo.c | 9 +++----
+ 7 files changed, 22 insertions(+), 25 deletions(-)
+
+diff --git a/libgo/go/internal/syscall/unix/at_largefile.go
b/libgo/go/internal/syscall/unix/at_largefile.go
+index 82e0dcfd0749..16151ecad1be 100644
+--- a/libgo/go/internal/syscall/unix/at_largefile.go
++++ b/libgo/go/internal/syscall/unix/at_largefile.go
+@@ -10,5 +10,5 @@ import (
+ "syscall"
+ )
+
+-//extern fstatat64
++//extern fstatat
+ func fstatat(int32, *byte, *syscall.Stat_t, int32) int32
+diff --git a/libgo/go/os/dir_largefile.go b/libgo/go/os/dir_largefile.go
+index 1fc5ee0771f5..0c6dffe1a758 100644
+--- a/libgo/go/os/dir_largefile.go
++++ b/libgo/go/os/dir_largefile.go
+@@ -11,5 +11,5 @@ package os
+
+ import "syscall"
+
+-//extern readdir64
++//extern readdir
+ func libc_readdir(*syscall.DIR) *syscall.Dirent
+diff --git a/libgo/go/syscall/libcall_glibc.go
b/libgo/go/syscall/libcall_glibc.go
+index 5c1ec483c759..5a1245ed44b0 100644
+--- a/libgo/go/syscall/libcall_glibc.go
++++ b/libgo/go/syscall/libcall_glibc.go
+@@ -114,7 +114,7 @@ func Pipe2(p []int, flags int) (err error) {
+ }
+
+ //sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written
int, err error)
+-//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t)
Ssize_t
++//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t)
Ssize_t
+
+ func Sendfile(outfd int, infd int, offset *int64, count int) (written int,
err error) {
+ if race.Enabled {
+diff --git a/libgo/go/syscall/libcall_linux.go
b/libgo/go/syscall/libcall_linux.go
+index 19ae4393cf13..0f72c81e6294 100644
+--- a/libgo/go/syscall/libcall_linux.go
++++ b/libgo/go/syscall/libcall_linux.go
+@@ -158,7 +158,7 @@ func Reboot(cmd int) (err error) {
+ //adjtimex(buf *Timex) _C_int
+
+ //sys Fstatfs(fd int, buf *Statfs_t) (err error)
+-//fstatfs64(fd _C_int, buf *Statfs_t) _C_int
++//fstatfs(fd _C_int, buf *Statfs_t) _C_int
+
+ func Gettid() (tid int) {
+ r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0)
+@@ -237,7 +237,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64,
len int, flags int) (n i
+ }
+
+ //sys Statfs(path string, buf *Statfs_t) (err error)
+-//statfs64(path *byte, buf *Statfs_t) _C_int
++//statfs(path *byte, buf *Statfs_t) _C_int
+
+ //sysnb Sysinfo(info *Sysinfo_t) (err error)
+ //sysinfo(info *Sysinfo_t) _C_int
+diff --git a/libgo/go/syscall/libcall_posix_largefile.go
b/libgo/go/syscall/libcall_posix_largefile.go
+index f90055bb29a0..334212f0af18 100644
+--- a/libgo/go/syscall/libcall_posix_largefile.go
++++ b/libgo/go/syscall/libcall_posix_largefile.go
+@@ -10,40 +10,40 @@
+ package syscall
+
+ //sys Creat(path string, mode uint32) (fd int, err error)
+-//creat64(path *byte, mode Mode_t) _C_int
++//creat(path *byte, mode Mode_t) _C_int
+
+ //sys Fstat(fd int, stat *Stat_t) (err error)
+-//fstat64(fd _C_int, stat *Stat_t) _C_int
++//fstat(fd _C_int, stat *Stat_t) _C_int
+
+ //sys Ftruncate(fd int, length int64) (err error)
+-//ftruncate64(fd _C_int, length Offset_t) _C_int
++//ftruncate(fd _C_int, length Offset_t) _C_int
+
+ //sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
+-//getrlimit64(resource _C_int, rlim *Rlimit) _C_int
++//getrlimit(resource _C_int, rlim *Rlimit) _C_int
+
+ //sys Lstat(path string, stat *Stat_t) (err error)
+-//lstat64(path *byte, stat *Stat_t) _C_int
++//lstat(path *byte, stat *Stat_t) _C_int
+
+ //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int,
offset int64) (xaddr uintptr, err error)
+-//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int,
offset Offset_t) *byte
++//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int,
offset Offset_t) *byte
+
+ //sys Open(path string, mode int, perm uint32) (fd int, err error)
+-//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int
++//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int
+
+ //sys Pread(fd int, p []byte, offset int64) (n int, err error)
+-//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
++//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+
+ //sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
+-//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
++//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+
+ //sys Seek(fd int, offset int64, whence int) (off int64, err error)
+-//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t
++//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t
+
+ //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+-//setrlimit64(resource int, rlim *Rlimit) _C_int
++//setrlimit(resource int, rlim *Rlimit) _C_int
+
+ //sys Stat(path string, stat *Stat_t) (err error)
+-//stat64(path *byte, stat *Stat_t) _C_int
++//stat(path *byte, stat *Stat_t) _C_int
+
+ //sys Truncate(path string, length int64) (err error)
+-//truncate64(path *byte, length Offset_t) _C_int
++//truncate(path *byte, length Offset_t) _C_int
+diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c
+index f84860891e6c..7efc96159853 100644
+--- a/libgo/runtime/go-varargs.c
++++ b/libgo/runtime/go-varargs.c
+@@ -84,7 +84,7 @@ __go_ioctl_ptr (int d, int request, void *arg)
+ int
+ __go_open64 (char *path, int mode, mode_t perm)
+ {
+- return open64 (path, mode, perm);
++ return open (path, mode, perm);
+ }
+
+ #endif
+diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
+index 180f5c31d742..1d717d55c0e9 100644
+--- a/libgo/sysinfo.c
++++ b/libgo/sysinfo.c
+@@ -366,7 +366,7 @@ typedef loff_t libgo_loff_t_type;
+ #endif
+
+ #if defined(HAVE_OFF64_T)
+-typedef off64_t libgo_off_t_type;
++typedef off_t libgo_off_t_type;
+ #else
+ typedef off_t libgo_off_t_type;
+ #endif
+@@ -398,13 +398,11 @@ typedef off_t libgo_off_t_type;
+
+ // From dirent.h
+ SREF(dirent);
+-SREF(dirent64);
+ OTREF(DIR);
+ EREF(DT_UNKNOWN);
+
+ // From fcntl.h
+ SREF(flock);
+-SREF(flock64);
+
+ // From ffi headers
+ SREF(_ffi_type);
+@@ -485,11 +483,10 @@ EREF(SS_ONSTACK);
+ EREF(SEGV_MAPERR);
+
+ // From stat.h
+-SREF(stat64);
++SREF(stat);
+
+ // From statfs.h
+ SREF(statfs);
+-SREF(statfs64);
+
+ // From sysinfo.h
+ SREF(sysinfo);
+@@ -519,7 +516,7 @@ EREF(PTRACE_PEEKTEXT);
+
+ // From sys/resource.h
+ SREF(rusage);
+-SREF(rlimit64);
++SREF(rlimit);
+ EREF(RLIMIT_NOFILE);
+ EREF(PRIO_USER);
+ EREF(RUSAGE_SELF);
+--
+2.40.1
+
diff --git a/gnu/gcc/patches/50_all_cpu_indicator.patch
b/gnu/gcc/patches/50_all_cpu_indicator.patch
deleted file mode 100644
index ca0876e..0000000
--- a/gnu/gcc/patches/50_all_cpu_indicator.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From d16a8ceb1c3c8a7ec381090b4c316ff4c55661c0 Mon Sep 17 00:00:00 2001
-From:
-Date: Thu, 7 May 2020 21:14:11 -0500
-Subject: [PATCH] convert "__cpu_indicator_init" to
- "__cpu_indicator_init_local"
-
-Origin: Gentoo
-
---- a/gcc/config/i386/i386-expand.cc
-+++ b/gcc/config/i386/i386-expand.cc
-@@ -12338,10 +12338,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx
subtarget,
- {
- case IX86_BUILTIN_CPU_INIT:
- {
-- /* Make it call __cpu_indicator_init in libgcc. */
-+ /* Make it call __cpu_indicator_init_local in libgcc. */
- tree call_expr, fndecl, type;
- type = build_function_type_list (integer_type_node, NULL_TREE);
-- fndecl = build_fn_decl ("__cpu_indicator_init", type);
-+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
- call_expr = build_call_expr (fndecl, 0);
- return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
- }
-
---- a/libgcc/config/i386/cpuinfo.c
-+++ b/libgcc/config/i386/cpuinfo.c
-@@ -508,7 +508,7 @@ __cpu_indicator_init (void)
- return 0;
- }
-
--#if defined SHARED && defined USE_ELF_SYMVER
--__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init AT GCC_4.8.0");
--__asm__ (".symver __cpu_model, __cpu_model AT GCC_4.8.0");
-+#ifndef SHARED
-+int __cpu_indicator_init_local (void)
-+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
- #endif
diff --git a/gnu/gcc/patches/50_all_posix_memalign.patch
b/gnu/gcc/patches/50_all_posix_memalign.patch
deleted file mode 100644
index d974b56..0000000
--- a/gnu/gcc/patches/50_all_posix_memalign.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Origin: Gentoo
-
-diff -Naur gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h
gcc-7.1.0/gcc/config/i386/pmm_malloc.h
---- gcc-7.1.0.orig/gcc/config/i386/pmm_malloc.h 2017-01-01
04:07:43.000000000 -0800
-+++ gcc-7.1.0/gcc/config/i386/pmm_malloc.h 2017-05-07 11:35:22.878398460
-0700
-@@ -27,12 +27,13 @@
- #include <stdlib.h>
-
- /* We can't depend on <stdlib.h> since the prototype of posix_memalign
-- may not be visible. */
-+ may not be visible and we can't pollute the namespace either. */
- #ifndef __cplusplus
--extern int posix_memalign (void **, size_t, size_t);
-+extern int __gcc_posix_memalign (void **, size_t, size_t)
- #else
--extern "C" int posix_memalign (void **, size_t, size_t) throw ();
-+extern "C" int __gcc_posix_memalign (void **, size_t, size_t) throw ()
- #endif
-+__asm__("posix_memalign");
-
- static __inline void *
- _mm_malloc (size_t __size, size_t __alignment)
-@@ -42,7 +43,7 @@
- return malloc (__size);
- if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
- __alignment = sizeof (void *);
-- if (posix_memalign (&__ptr, __alignment, __size) == 0)
-+ if (__gcc_posix_memalign (&__ptr, __alignment, __size) == 0)
- return __ptr;
- else
- return NULL;



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (79bc62ddfbcf80a59e9881d30418e1bf0fc49f5a), Ismael Luceno, 07/14/2023

Archive powered by MHonArc 2.6.24.

Top of Page