cross/gcc-*: upgrade to 15.1.1_git20250719-r2

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6829

[ci:skip-build]: already built successfully in CI
This commit is contained in:
Oliver Smith 2025-07-27 11:31:06 +02:00 committed by Aster Boese
parent 7783568da9
commit a1b32209a3
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
334 changed files with 8474 additions and 7748 deletions

View file

@ -1,14 +1,14 @@
From 47b4bd4deb2c356bb07d2a96f22127aefafec3a4 Mon Sep 17 00:00:00 2001
From 94cf7d2b3514ed3a4401861a519ead450e022afc Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 01/35] posix_memalign
Subject: [PATCH] posix_memalign
---
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 3527283693b..c4071b64b53 100644
index d1d79a32fc9..069c3bb8324 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
@ -38,5 +38,5 @@ index 3527283693b..c4071b64b53 100644
else
return NULL;
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 4fa620d8c3e6730211bfb071eb4c817320491bd0 Mon Sep 17 00:00:00 2001
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:59:00 +0400
Subject: [PATCH 02/35] gcc: poison-system-directories
Date: Thu, 23 Jan 2025 17:12:51 -0800
Subject: [PATCH] gcc: poison-system-directories
Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for
@ -11,23 +11,25 @@ aborted.
Instead, we add the two missing items to the current scan. If the user
wants this to be a failure, they can add "-Werror=poison-system-directories".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
gcc/configure | 16 ++++++++++++++++
gcc/configure.ac | 10 ++++++++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 2 ++
gcc/incpath.cc | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
gcc/gcc.cc | 12 ++++++++++--
gcc/incpath.cc | 25 +++++++++++++++++++++++++
7 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e3fa0dacec4..bea1adc0940 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -715,6 +715,10 @@ Wreturn-local-addr
@@ -729,6 +729,10 @@ Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable.
@ -38,9 +40,11 @@ Upstream-Status: Pending
Wshadow
Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global.
diff --git a/gcc/config.in b/gcc/config.in
index a79c51adb2b..8a531ed591c 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -249,6 +249,12 @@
@@ -249,6 +249,16 @@
#endif
@ -48,14 +52,20 @@ Upstream-Status: Pending
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index 16965953f05..0f4a5d52c30 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1050,6 +1050,7 @@ enable_maintainer_mode
@@ -1051,6 +1051,7 @@ enable_maintainer_mode
enable_link_mutex
enable_link_serialization
enable_version_specific_runtime_libs
@ -63,7 +73,7 @@ Upstream-Status: Pending
enable_plugin
enable_host_shared
enable_host_pie
@@ -1823,6 +1824,8 @@ Optional Features:
@@ -1828,6 +1829,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@ -72,7 +82,7 @@ Upstream-Status: Pending
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -34082,6 +34085,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
@@ -34027,6 +34030,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
@ -83,47 +93,60 @@ Upstream-Status: Pending
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+if test "x${enable_poison_system_directories}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9f67e62950a..b0e3615e5aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7555,6 +7555,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
@@ -7502,6 +7502,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [warn for use of native system header directories (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 72009c33cd0..29aea724731 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -391,6 +391,7 @@ Objective-C and Objective-C++ Dialects}.
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
-Wrestrict -Wno-return-local-addr -Wreturn-type
-Wno-scalar-storage-order -Wsequence-point
@@ -8861,6 +8862,14 @@ made up of data only and thus requires no special treatment. But, for
most targets, it is made up of code and thus requires the stack to be
made executable in order for the program to work properly.
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
-Wno-psabi
-Wredundant-decls -Wrestrict
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
Suppress warnings from casts from a pointer to an integer type of a
different size.
+@opindex Wno-poison-system-directories
+@item -Wno-poison-system-directories
@ -133,12 +156,27 @@ Upstream-Status: Pending
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@opindex Wfloat-equal
@opindex Wno-float-equal
@item -Wfloat-equal
@opindex Winvalid-pch
@opindex Wno-invalid-pch
@item -Winvalid-pch
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4fd87f2c4a1..79d4920a047 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1163,6 +1163,8 @@ proper position among the other output files. */
@@ -909,6 +909,12 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+#ifdef POISON_BY_DEFAULT
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
+#else
+#define POISON_IS_ERROR
+#endif
+
/* Assembler options for compressed debug sections. */
#if HAVE_LD_COMPRESS_DEBUG == 0
/* Reject if the linker cannot write compressed debug sections. */
@@ -1166,6 +1172,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@ -147,6 +185,26 @@ Upstream-Status: Pending
%{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
- %{pthread:-fprofile-update=prefer-atomic}}}";
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index c1bbfd3872a..2cdbebc4c50 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -26,6 +26,7 @@
@ -157,9 +215,20 @@ Upstream-Status: Pending
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
cur->name, xstrerror (errno));
reason = REASON_NOENT;
}
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ pcur = &cur->next;
+ continue;
+#endif
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
fprintf (stderr, _("End of #embed search list.\n"));
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
@ -168,19 +237,22 @@ Upstream-Status: Pending
+ struct cpp_dir *p;
+
+ for (p = heads[INC_QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.50.1

View file

@ -1,7 +1,7 @@
From ff4dd4ce33133e675b7bedc86b73357c04631cb9 Mon Sep 17 00:00:00 2001
From 90e8697dd88fd99ce2cf8739e95494853005377e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:45:49 +0000
Subject: [PATCH 03/35] specs: turn on -Wl,-z,now by default
Subject: [PATCH] specs: turn on -Wl,-z,now by default
Previously, we also used to turn on -z relro here, but we now build
binutils with --enable-relro, which is functionally equivalent.
@ -13,9 +13,11 @@ now by default.
gcc/gcc.cc | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 29aea724731..6fb3ab70cc7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -18935,6 +18935,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
@@ -19477,6 +19477,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
@ -25,9 +27,11 @@ now by default.
@opindex u
@item -u @var{symbol}
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 79d4920a047..74a356fdf5e 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1161,6 +1161,7 @@ proper position among the other output files. */
@@ -1170,6 +1170,7 @@ proper position among the other output files. */
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
@ -35,3 +39,6 @@ now by default.
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{Wno-poison-system-directories:--no-poison-system-directories} \
--
2.50.1

View file

@ -1,17 +1,19 @@
From 1b315235433701e4a974da259b8d651169ddc7ac Mon Sep 17 00:00:00 2001
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:22 +0000
Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC,
ObjC++, if the optimization level is > 0
---
gcc/c-family/c-cppbuiltin.cc | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 4589ee4a3a6..9edf095384c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1570,6 +1570,10 @@ c_cpp_builtins (cpp_reader *pfile)
@@ -1581,6 +1581,10 @@ c_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
@ -22,9 +24,11 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6fb3ab70cc7..799ce073dbf 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12496,6 +12496,12 @@ also turns on the following optimization flags:
@@ -12840,6 +12840,12 @@ also turns on the following optimization flags:
Please note the warning under @option{-fgcse} about
invoking @option{-O2} on programs that use computed gotos.
@ -37,3 +41,6 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
@opindex O3
@item -O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.50.1

View file

@ -1,8 +1,8 @@
From 67c0f5789630b27149f60ff831999ef7c1dba5d5 Mon Sep 17 00:00:00 2001
From a59da582e83071de0566274d912ca6f05f4b75d0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:56 +0000
Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
Subject: [PATCH] On linux targets pass --as-needed by default to the linker,
but always link the sanitizer libraries with --no-as-needed.
---
gcc/config/aarch64/aarch64-linux.h | 1 +
@ -21,9 +21,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
gcc/gcc.cc | 28 ++++++++++++++++++++--------
14 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 116bb4e69f3..daf99f8dce9 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
@@ -39,6 +39,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
@ -31,6 +33,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index 3fd3b831166..0b4c2dccebe 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
@ -42,6 +46,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index d4d389e2aa8..adccc0b11c2 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
@ -52,6 +58,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 4c4e31efa39..3c17ac6eade 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -78,6 +86,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
#endif
#undef TARGET_F951_OPTIONS
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 7abfda53049..ceb8f855b7d 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
@ -89,6 +99,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{!static-pie: \
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index abe714711bf..3ca128a79f5 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -99,6 +111,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index a2494c214c4..e1a5d530cdf 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
@ -110,6 +124,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5a82508c113..6eee7cdc603 100644
--- a/gcc/config/mips/gnu-user.h
+++ b/gcc/config/mips/gnu-user.h
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
@ -120,6 +136,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 9060c940a44..282c77b6a7b 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
@ -130,6 +148,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
-X \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 0316d8cb65d..139e1b6796c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -378,13 +378,13 @@ extern int dot_symbols;
@ -148,6 +168,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index afb5c6ad867..b64638fb25b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -781,7 +781,7 @@ GNU_USER_TARGET_CC1_SPEC
@ -159,6 +181,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 2c3bca5dfcb..b90661247a4 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
@ -170,6 +194,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{static:-static} \
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 6d928846895..3cc05bb7240 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
@ -181,9 +207,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 74a356fdf5e..fc9c7d15b04 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -771,8 +771,11 @@ proper position among the other output files. */
@@ -774,8 +774,11 @@ proper position among the other output files. */
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -197,7 +225,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -807,8 +810,11 @@ proper position among the other output files. */
@@ -810,8 +813,11 @@ proper position among the other output files. */
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -211,7 +239,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -825,8 +831,11 @@ proper position among the other output files. */
@@ -828,8 +834,11 @@ proper position among the other output files. */
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -225,7 +253,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -841,8 +850,11 @@ proper position among the other output files. */
@@ -844,8 +853,11 @@ proper position among the other output files. */
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
@ -239,3 +267,6 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.50.1

View file

@ -1,15 +1,17 @@
From bb25e8489384504cd59e4a2538720863da1fb29c Mon Sep 17 00:00:00 2001
From 35c02ea8267e193b92f30495c94ee1e8e5c2be8e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:47:43 +0000
Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Subject: [PATCH] Enable -Wformat and -Wformat-security by default.
---
gcc/c-family/c.opt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 75b6531860e..78830ce4b42 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -774,7 +774,7 @@ Warn about function calls with format strings that write past the end
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
of the destination region.
Wformat-security
@ -18,7 +20,7 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about possible security problems with format functions.
Wformat-signedness
@@ -799,7 +799,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
@@ -830,7 +830,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
@ -27,3 +29,6 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about printf/scanf/strftime/strfmon format string anomalies.
Wframe-address
--
2.50.1

View file

@ -1,16 +1,18 @@
From 4a728ad48a7b437cc6f2697e26603bf648149f86 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:48:24 +0000
Subject: [PATCH 07/35] Enable -Wtrampolines by default.
From 0b82663fd2f054e07e116c4dcc5019f7e969cd3e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:44:20 -0700
Subject: [PATCH] Enable -Wtrampolines by default.
---
gcc/common.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index bea1adc0940..e65a575d9f8 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -811,7 +811,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa
Warn if a comparison always evaluates to true or false.
Wtrampolines
-Common Var(warn_trampolines) Warning
@ -18,3 +20,6 @@ Subject: [PATCH 07/35] Enable -Wtrampolines by default.
Warn whenever a trampoline is generated.
Wtrivial-auto-var-init
--
2.50.1

View file

@ -1,46 +0,0 @@
From 32f24560d0602f7735d5e9efd92fe3151bd72cea Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:49:40 +0000
Subject: [PATCH 08/35] Disable ssp on -nostdlib, -nodefaultlibs and
-ffreestanding Change the buffer size.
---
gcc/gcc.cc | 8 +++++++-
gcc/params.opt | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1000,6 +1000,12 @@ proper position among the other output files. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
#endif
+#ifdef ENABLE_DEFAULT_SSP
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
+#else
+#define NO_SSP_SPEC ""
+#endif
+
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
@@ -1305,7 +1311,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1013,7 +1013,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
The maximum number of SSA_NAME assignments to follow in determining a value.
-param=ssp-buffer-size=
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
The lower bound for a buffer to be considered for stack smashing protection.
-param=stack-clash-protection-guard-size=

View file

@ -0,0 +1,39 @@
From 3acf32fc94fd447874b2f1447a19a65f0905bff5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:49:03 -0700
Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and
-nodefaultlibs
---
gcc/gcc.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fc9c7d15b04..7b0d3d2743b 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1009,6 +1009,12 @@ proper position among the other output files. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
#endif
+#ifdef ENABLE_DEFAULT_SSP
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
+#else
+#define NO_SSP_SPEC ""
+#endif
+
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
@@ -1314,7 +1320,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--
2.50.1

View file

@ -0,0 +1,25 @@
From bb98973bdb5fe8bd040e238afe92845203929b59 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:50:42 -0700
Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4
---
gcc/params.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/params.opt b/gcc/params.opt
index 64e453d29b7..bba3fd574f2 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1064,7 +1064,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
The maximum number of SSA_NAME assignments to follow in determining a value.
-param=ssp-buffer-size=
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
The lower bound for a buffer to be considered for stack smashing protection.
-param=stack-clash-protection-guard-size=
--
2.50.1

View file

@ -1,8 +1,8 @@
From c7ec8da7280d7f97f5543eb9ddeca7600aafc43c Mon Sep 17 00:00:00 2001
From f89d8e95b809d02eceee416b463200c9abb2b33e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:50:33 +0000
Subject: [PATCH 09/35] Ensure that msgfmt doesn't encounter problems during
gcc bootstrapping.
Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc
bootstrapping.
Solves error messages like the following:
@ -26,7 +26,7 @@ https://bugs.gentoo.org/295480
2 files changed, 2 insertions(+)
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
index 12d34910830..61b13762b71 100644
index 7f84a99533e..a4c6284f788 100644
--- a/libstdc++-v3/po/Makefile.am
+++ b/libstdc++-v3/po/Makefile.am
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
@ -50,5 +50,5 @@ index 8e93445acd2..d6ff06e5ddb 100644
all-local: all-local-$(USE_NLS)
--
2.41.0
2.50.1

View file

@ -1,17 +1,17 @@
From aaa029bcee68298695b7c4278c90b6bc320d098c Mon Sep 17 00:00:00 2001
From b45303198567828a5240baf932a8c13255f35d20 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:52:07 +0000
Subject: [PATCH 10/35] Don't declare asprintf if defined as a macro.
Subject: [PATCH] Don't declare asprintf if defined as a macro.
---
include/libiberty.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/libiberty.h b/include/libiberty.h
index 1d5c779fcff..19e3cb1e31c 100644
index d4e8791b14b..c074980ed80 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -652,8 +652,11 @@ extern void *bsearch_r (const void *, const void *,
@@ -678,8 +678,11 @@ extern void *bsearch_r (const void *, const void *,
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
@ -24,5 +24,5 @@ index 1d5c779fcff..19e3cb1e31c 100644
/* Like asprintf but allocates memory without fail. This works like
xmalloc. */
--
2.41.0
2.50.1

View file

@ -1,17 +1,17 @@
From 65e01e749205c9af218b01233cebd0077538d0ee Mon Sep 17 00:00:00 2001
From 68e2c9356221ba30b27840b9449f742505584cf1 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:53:00 +0000
Subject: [PATCH 11/35] libiberty: copy PIC objects during build process
Subject: [PATCH] libiberty: copy PIC objects during build process
---
libiberty/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 72608f3e4a7..58356884728 100644
index ce54d88278d..10c212a1ad3 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -265,6 +265,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
@ -20,5 +20,5 @@ index 72608f3e4a7..58356884728 100644
else true; fi
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 453a815bf2844971a91eaef800af188d9e86b784 Mon Sep 17 00:00:00 2001
From ca482f8c9cac9617855f908dd30d3d6144e850a0 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 12/35] libgcc_s
Subject: [PATCH] libgcc_s
---
gcc/config/i386/i386-expand.cc | 4 ++--
@ -9,9 +9,11 @@ Subject: [PATCH 12/35] libgcc_s
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index cdfd94d3c73..a3a6c988833 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -13089,10 +13089,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
@@ -13643,10 +13643,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
@ -24,6 +26,8 @@ Subject: [PATCH 12/35] libgcc_s
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 2484dc839bf..e980030ef23 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
@ -37,6 +41,8 @@ Subject: [PATCH 12/35] libgcc_s
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
@ -46,3 +52,6 @@ Subject: [PATCH 12/35] libgcc_s
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
--
2.50.1

View file

@ -1,16 +1,18 @@
From 7d7d12137c666761a8dd61179c9651b85dae9b41 Mon Sep 17 00:00:00 2001
From 6dfb241ae9f879f4945941273dd73eb13f127b06 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 7 Nov 2015 02:08:05 +0000
Subject: [PATCH 13/35] nopie
Subject: [PATCH] nopie
---
gcc/configure | 25 +++++++++++++++++++++++++
gcc/configure.ac | 11 +++++++++++
2 files changed, 36 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 0f4a5d52c30..343563c8948 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -34606,6 +34606,29 @@ rm -f core conftest.err conftest.$ac_objext \
@@ -34586,6 +34586,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; }
@ -40,7 +42,7 @@ Subject: [PATCH 13/35] nopie
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -34623,6 +34646,8 @@ if test x$enable_host_pie = xyes; then
@@ -34603,6 +34626,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
@ -49,9 +51,11 @@ Subject: [PATCH 13/35] nopie
else
LD_PICFLAG=
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b0e3615e5aa..b3948469d17 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7821,6 +7821,15 @@ AC_CACHE_CHECK([for -no-pie option],
@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option],
[gcc_cv_no_pie=yes],
[gcc_cv_no_pie=no])
LDFLAGS="$saved_LDFLAGS"])
@ -67,7 +71,7 @@ Subject: [PATCH 13/35] nopie
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -7838,6 +7847,8 @@ if test x$enable_host_pie = xyes; then
@@ -7819,6 +7828,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
@ -76,3 +80,6 @@ Subject: [PATCH 13/35] nopie
else
LD_PICFLAG=
fi
--
2.50.1

View file

@ -1,14 +1,14 @@
From dd5bb97c31a9f57034c70a7a18ba6e2e133084c7 Mon Sep 17 00:00:00 2001
From 8ac6aeca5d6192ee16b959bd8c1903a52d408a55 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:16 +0000
Subject: [PATCH 14/35] ada: fix shared linking
Subject: [PATCH] ada: fix shared linking
---
gcc/ada/link.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
index f2126441208..22cfa9c641f 100644
index 9e3385ca94f..2c0cca6e480 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
@ -38,5 +38,5 @@ index f2126441208..22cfa9c641f 100644
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
--
2.41.0
2.50.1

View file

@ -1,12 +1,14 @@
From 6bb5b7d9161d05f31b001d8211a9c63caf63fd2f Mon Sep 17 00:00:00 2001
From 7323d68ae46fc8e33c0746799d820a4e4c8c8b72 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:43 +0000
Subject: [PATCH 15/35] build: fix CXXFLAGS_FOR_BUILD passing
Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing
---
Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.in b/Makefile.in
index b1ed67d3d4f..1e039c20550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
@ -17,3 +19,6 @@ Subject: [PATCH 15/35] build: fix CXXFLAGS_FOR_BUILD passing
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
--
2.50.1

View file

@ -1,14 +1,14 @@
From f0d9e00cac06689f64b214de7aee80d7116ef084 Mon Sep 17 00:00:00 2001
From eaf89c8c91806905c6e1ec9519cbfb56296204b0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:01:06 +0000
Subject: [PATCH 16/35] add fortify-headers paths
Subject: [PATCH] add fortify-headers paths
---
gcc/config/linux.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index e3aca79cccc..b3537b8fbeb 100644
index d6280a4d4dd..ba69fb9fad7 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -159,6 +159,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -21,5 +21,5 @@ index e3aca79cccc..b3537b8fbeb 100644
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else
--
2.41.0
2.50.1

View file

@ -1,9 +1,9 @@
From 857db04f4f1a06e866551b4172fe8f27363f4a92 Mon Sep 17 00:00:00 2001
From bdedcd9db7b8291637c5147dd82e8a9e3f5f9c87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 21 Aug 2020 07:03:00 +0000
Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
link to it unconditionally, as otherwise we get link failures if some objects
are -fstack-protector built and final link happens with -fno-stack-protector.
Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to
it unconditionally, as otherwise we get link failures if some objects are
-fstack-protector built and final link happens with -fno-stack-protector.
This seems to be the common case when bootstrapping gcc, the piepatches do
not seem to fully fix the crosstoolchain and bootstrap sequence wrt.
stack-protector flag usage.
@ -12,9 +12,11 @@ Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
gcc/gcc.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7b0d3d2743b..e46e976a2e8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1008,8 +1008,7 @@ proper position among the other output files. */
@@ -1017,8 +1017,7 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
@ -24,3 +26,6 @@ Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
--
2.50.1

View file

@ -1,16 +1,18 @@
From 5a8347e23ab13912b6edec2c6c6e3a101b017c79 Mon Sep 17 00:00:00 2001
From 586ce3614d4fc3fbeccf01659114a4643c1879c8 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:03:42 +0000
Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when
linking libtsan.
---
gcc/gcc.cc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index e46e976a2e8..607c8ca1d42 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -772,10 +772,10 @@ proper position among the other output files. */
@@ -775,10 +775,10 @@ proper position among the other output files. */
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
@ -23,7 +25,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -811,10 +811,10 @@ proper position among the other output files. */
@@ -814,10 +814,10 @@ proper position among the other output files. */
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
@ -36,7 +38,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -832,10 +832,10 @@ proper position among the other output files. */
@@ -835,10 +835,10 @@ proper position among the other output files. */
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
@ -49,7 +51,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -851,10 +851,10 @@ proper position among the other output files. */
@@ -854,10 +854,10 @@ proper position among the other output files. */
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
@ -62,3 +64,6 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.50.1

View file

@ -1,7 +1,7 @@
From 41d00a2eb0754acf71958808bd17dbebeb517b84 Mon Sep 17 00:00:00 2001
From 0ca7f92018d0bc04a72655f3b130c9aaeea1b771 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:12:55 +0000
Subject: [PATCH 19/35] aarch64: disable multilib support
Subject: [PATCH] aarch64: disable multilib support
multilib is unsupported on Alpine GCC
---
@ -9,7 +9,7 @@ multilib is unsupported on Alpine GCC
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index 57bf4100fcd..172894b57ef 100644
index 70e36b3299e..e00c3becd3f 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
@ -22,5 +22,5 @@ index 57bf4100fcd..172894b57ef 100644
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 85b42bfbba71616831d14360b16998acb28790fd Mon Sep 17 00:00:00 2001
From b48898c8fbd7828b81f407c74c25cf8e07fb73a4 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:13:59 +0000
Subject: [PATCH 20/35] s390x: disable multilib support
Subject: [PATCH] s390x: disable multilib support
multilib is not supported on Alpine GCC at present
---
@ -21,5 +21,5 @@ index cc6ab367072..7f498ee1cdc 100644
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 7b53df284242638e940c0155b6c21e88cea1f55b Mon Sep 17 00:00:00 2001
From 158d93ce86f3d311ce489d0740326027068ca721 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:14:33 +0000
Subject: [PATCH 21/35] ppc64[le]: disable multilib support
Subject: [PATCH] ppc64[le]: disable multilib support
multilib is not presently supported on Alpine GCC
---
@ -36,7 +36,7 @@ index 4e371255533..128c75c7d39 100644
endif
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 01a94242308..b3a76379c03 100644
index f56b47c268e..c5f757a6284 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -28,8 +28,8 @@
@ -77,5 +77,5 @@ index 2e63bdb9fc9..c6e1c5db65d 100644
+MULTILIB_OSDIRNAMES += m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 96e7e1e9a899d9bb5fcbdf788bd529d0390c626f Mon Sep 17 00:00:00 2001
From 6957fc21caca80f5e01db15df6dc8de46c85167b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:14:54 +0000
Subject: [PATCH 22/35] x86_64: disable multilib support
Subject: [PATCH] x86_64: disable multilib support
multilib is not presently supported on Alpine GCC
---
@ -9,7 +9,7 @@ multilib is not presently supported on Alpine GCC
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 138956b0962..bc03dab874f 100644
index 64a4a20e64f..9a8eb8dd8d1 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -33,6 +33,6 @@
@ -22,5 +22,5 @@ index 138956b0962..bc03dab874f 100644
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From b26224acf342eacb33491f6ea0da1faf73d35715 Mon Sep 17 00:00:00 2001
From fdcbe7ee4ce81cdf247966385c8d521ac3f5a38c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 3 Jan 2022 07:14:48 +0100
Subject: [PATCH 23/35] riscv: disable multilib support
Subject: [PATCH] riscv: disable multilib support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -42,6 +42,8 @@ library.
gcc/config/riscv/t-linux | 7 +++++--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 282c77b6a7b..07adae3d59c 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
@ -56,6 +58,8 @@ library.
- "/usr/lib/ "
-
-#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index a6f64f88d25..f88776ec520 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,5 +1,8 @@
@ -69,3 +73,6 @@ library.
+MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc
MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
--
2.50.1

View file

@ -1,135 +0,0 @@
From 3ee8cbc1cad261b30d4a7a66d31496d5f243ce2f Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:06:30 +0000
Subject: [PATCH 25/35] ada: libgnarl compatibility for musl
---
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 a5e645d334d..32165347071 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 821ceef30e4..ae95b58e01e 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.41.0

View file

@ -1,7 +1,7 @@
From a72e0613f79f6b6867819317accb7a714031a08c Mon Sep 17 00:00:00 2001
From 6f63901256443978a2c3746e72bd5762166a7790 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:05:41 +0000
Subject: [PATCH 24/35] always build libgcc_eh.a
Subject: [PATCH] always build libgcc_eh.a
highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
@ -9,9 +9,11 @@ highly inspired by:
libgcc/Makefile.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 0719fd0615d..80bb8f1622f 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -967,8 +967,9 @@ ifneq ($(LIBUNWIND),)
@@ -971,8 +971,9 @@ ifneq ($(LIBUNWIND),)
all: libunwind.a
endif
@ -22,7 +24,7 @@ highly inspired by:
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1173,10 +1174,6 @@ install-libunwind:
@@ -1177,10 +1178,6 @@ install-libunwind:
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
@ -33,7 +35,7 @@ highly inspired by:
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -1193,6 +1190,10 @@ ifeq ($(enable_gcov),yes)
@@ -1197,6 +1194,10 @@ ifeq ($(enable_gcov),yes)
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
endif
@ -44,3 +46,6 @@ highly inspired by:
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
--
2.50.1

View file

@ -0,0 +1,59 @@
From a365def37f5de93ad85588d8e2c02c0df28e88d6 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:09:02 -0700
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
pthread_rwlockattr_setkind_np
musl's thread library does not implement it
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
gcc/ada/libgnarl/s-taprop__linux.adb | 7 -------
2 files changed, 17 deletions(-)
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index 7aeb15da523..5551b701e5a 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -402,16 +402,6 @@ package System.OS_Interface is
(attr : access pthread_rwlockattr_t) return int;
pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
- 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;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 8f4c835baa7..6df36c7d8f4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
Result : C.int;
begin
- -- Set the rwlock to prefer writer to avoid writers starvation
-
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.50.1

View file

@ -1,239 +0,0 @@
From 3df4788c79c7429b196c7b284af2b4cf9a4b4f8d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 35 insertions(+), 33 deletions(-)
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1558,7 +1558,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 \
@@ -2145,7 +2145,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_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-loongarch.ads
@@ -2233,7 +2233,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
@@ -2268,7 +2268,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 \
@@ -2312,7 +2312,7 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-linux.ads<libgnarl/s-linux.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2489,7 +2489,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) \
@@ -2593,7 +2593,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) \
@@ -2638,7 +2638,7 @@ ifeq ($(strip $(filter-out %x32 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) \
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
+
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3465,7 +3470,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
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
-cpu_set_t *
+void *
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3488,33 +3492,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
@@ -3524,23 +3528,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__ */
--- 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)
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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)

View file

@ -0,0 +1,50 @@
From e1572457f94a26da9a588a36afa3eb0e74122c34 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:13:19 -0700
Subject: [PATCH] ada: libgnarl: use posix_openpt instead of glibc-specific
getpt to open a pty
musl only implements posix_openpt(3), not the older glibc-specific getpt()
and glibc implements both for ages.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/terminals.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 89f887556c0..93557fe2631 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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.50.1

View file

@ -0,0 +1,54 @@
From 4f26d4bfedb7f942b69ca4743f053c3a690a0b4a Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:18:49 -0700
Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/adaint.c | 6 +++++-
gcc/ada/adaint.h | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1fcfae165a7..67318e647ed 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -95,6 +95,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
@@ -3476,7 +3481,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
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 3df12b5f956..26a489f2b78 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -40,6 +40,11 @@ extern "C" {
#include "mingw32.h"
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#include <dirent.h>
/* Constants used for the form parameter encoding values */
--
2.50.1

View file

@ -1,14 +1,14 @@
From 7b50823d8a4131e5a55d2499a0f5a52b3d91eed2 Mon Sep 17 00:00:00 2001
From 6592e702844d31bcef17c340bfc13e0e1be9f132 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Wed, 9 Dec 2020 07:42:06 +0000
Subject: [PATCH 27/35] configure: Add --enable-autolink-libatomic, use in
Subject: [PATCH] configure: Add --enable-autolink-libatomic, use in
LINK_GCC_C_SEQUENCE_SPEC [PR81358]
This fixes issues with RISC-V.
---
Makefile.in | 1 +
gcc/config/gnu-user.h | 12 +++++++++++-
gcc/config.in | 6 ++++++
gcc/config/gnu-user.h | 12 +++++++++++-
gcc/configure | 31 ++++++++++++++++++++++++++++++-
gcc/configure.ac | 21 +++++++++++++++++++++
gcc/doc/install.texi | 8 ++++++++
@ -17,9 +17,11 @@ This fixes issues with RISC-V.
gcc/gcc.cc | 12 +++++++++++-
9 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 1e039c20550..20f535a306a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -237,6 +237,7 @@ HOST_EXPORTS = \
@@ -238,6 +238,7 @@ HOST_EXPORTS = \
RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
@ -27,6 +29,25 @@ This fixes issues with RISC-V.
HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
diff --git a/gcc/config.in b/gcc/config.in
index 8a531ed591c..40045ff35a5 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,12 @@
#endif
+/* Define if libatomic should always be linked. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_AUTOLINK_LIBATOMIC
+#endif
+
+
/* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
#ifndef USED_FOR_TARGET
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 3c17ac6eade..0426efdb8c3 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -109,8 +109,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -49,24 +70,11 @@ This fixes issues with RISC-V.
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
#undef LINK_GCC_C_SEQUENCE_SPEC
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,12 @@
#endif
+/* Define if libatomic should always be linked. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_AUTOLINK_LIBATOMIC
+#endif
+
+
/* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
#ifndef USED_FOR_TARGET
diff --git a/gcc/configure b/gcc/configure
index 343563c8948..54300a2a867 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1002,6 +1002,7 @@ with_changes_root_url
@@ -1003,6 +1003,7 @@ with_changes_root_url
enable_languages
with_multilib_list
with_multilib_generator
@ -74,7 +82,7 @@ This fixes issues with RISC-V.
with_zstd
with_zstd_include
with_zstd_lib
@@ -1739,6 +1740,9 @@ Optional Features:
@@ -1742,6 +1743,9 @@ Optional Features:
--disable-shared don't provide a shared libgcc
--disable-gcov don't provide libgcov and related host tools
--enable-languages=LIST specify which front-ends to build
@ -84,7 +92,7 @@ This fixes issues with RISC-V.
--disable-rpath do not hardcode runtime library paths
--enable-sjlj-exceptions
arrange to use setjmp/longjmp exception handling
@@ -8380,7 +8384,6 @@ else
@@ -8400,7 +8404,6 @@ else
fi
@ -92,7 +100,7 @@ This fixes issues with RISC-V.
# Check whether --with-multilib-generator was given.
if test "${with_multilib_generator+set}" = set; then :
withval=$with_multilib_generator; :
@@ -8388,6 +8391,32 @@ else
@@ -8408,6 +8411,32 @@ else
with_multilib_generator=default
fi
@ -125,9 +133,11 @@ This fixes issues with RISC-V.
# -------------------------
# Checks for other programs
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b3948469d17..81c070830e2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1215,6 +1215,27 @@ AC_ARG_WITH(multilib-generator,
@@ -1227,6 +1227,27 @@ AC_ARG_WITH(multilib-generator,
:,
with_multilib_generator=default)
@ -155,9 +165,11 @@ This fixes issues with RISC-V.
# -------------------------
# Checks for other programs
# -------------------------
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3e9e09b4ae3..6e7b756be61 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2525,6 +2525,14 @@ files, but these changed header paths may conflict with some compilation
@@ -2617,6 +2617,14 @@ files, but these changed header paths may conflict with some compilation
environments. Enabled by default, and may be disabled using
@option{--disable-canonical-system-headers}.
@ -172,6 +184,8 @@ This fixes issues with RISC-V.
@item --with-glibc-version=@var{major}.@var{minor}
Tell GCC that when the GNU C Library (glibc) is used on the target it
will be version @var{major}.@var{minor} or later. Normally this can
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index a96700c0d38..16deedca64d 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
@ -189,6 +203,8 @@ This fixes issues with RISC-V.
@end defmac
@defmac POST_LINK_SPEC
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index eccc4d88493..4ca4c610571 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
@ -206,9 +222,11 @@ This fixes issues with RISC-V.
@end defmac
@defmac POST_LINK_SPEC
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 607c8ca1d42..e9f78f0f4c1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -991,13 +991,23 @@ proper position among the other output files. */
@@ -1000,13 +1000,23 @@ proper position among the other output files. */
# define ASM_DEBUG_OPTION_SPEC ""
#endif
@ -233,3 +251,6 @@ This fixes issues with RISC-V.
#endif
#ifdef ENABLE_DEFAULT_SSP
--
2.50.1

View file

@ -1,8 +1,8 @@
From 5bbbd320e54ab5341cfba83e8af98685131caba1 Mon Sep 17 00:00:00 2001
From 952070c1616f231a810af2da50264713d7587b48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 29 Aug 2021 12:23:34 +0200
Subject: [PATCH 28/35] configure: fix detection of atomic builtins in
libatomic configure script
Subject: [PATCH] configure: fix detection of atomic builtins in libatomic
configure script
Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by
default) causes the libatomic configure script to incorrectly detect
@ -22,7 +22,7 @@ See:
1 file changed, 20 insertions(+)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index a92ae9e8309..90b579ca4d8 100644
index 6db039d6e8b..2751b5c1387 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -30,6 +30,26 @@
@ -53,5 +53,5 @@ index a92ae9e8309..90b579ca4d8 100644
alpha*)
# fenv.c needs this option to generate inexact exceptions.
--
2.41.0
2.50.1

View file

@ -1,15 +1,15 @@
From 430c701a3cefbe09a9c7c8a2f5bbe957f9b2ecb2 Mon Sep 17 00:00:00 2001
From 896b002a2afacb4d75d573aca4ae53b499df19cd Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 30 Jun 2022 16:44:51 +0000
Subject: [PATCH 29/35] libstdc++: do not throw exceptions for non-C locales on
musl targets
Subject: [PATCH] libstdc++: do not throw exceptions for non-C locales on musl
targets
---
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 8849d78fdfa..aff467f98fe 100644
index bfd02b5c2c6..16f9e84d66f 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
@ -23,5 +23,5 @@ index 8849d78fdfa..aff467f98fe 100644
void
--
2.41.0
2.50.1

View file

@ -1,17 +1,18 @@
From 05f0043755f341a2ff4f845379327076b3e0203d Mon Sep 17 00:00:00 2001
From 22d69ae3e2768d301ef5a1f1b362c25cf8bf27b9 Mon Sep 17 00:00:00 2001
From: Mathias LANG <pro.mathias.lang@gmail.com>
Date: Mon, 17 Jan 2022 03:49:21 +0000
Subject: [PATCH 30/35] gdc: unconditionally link libgphobos against
libucontext
Subject: [PATCH] gdc: unconditionally link libgphobos against libucontext
ref: alpine/aports#13422
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 20f535a306a..c087bfe7cd4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54362,7 +54362,7 @@ configure-target-libphobos:
@@ -54382,7 +54382,7 @@ configure-target-libphobos:
esac; \
module_srcdir=libphobos; \
rm -f no-such-file || : ; \
@ -20,3 +21,6 @@ ref: alpine/aports#13422
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--
2.50.1

View file

@ -1,7 +1,7 @@
From 0b89a74fbf77ae6917f043c79cd03db0d6ef0212 Mon Sep 17 00:00:00 2001
From dc66835022cf68085400f2eed30614c5afdc28a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 16 Jul 2022 09:21:11 +0200
Subject: [PATCH 31/35] druntime: link against libucontext on all platforms
Subject: [PATCH] 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
@ -11,9 +11,11 @@ an external library for these functions.
libphobos/m4/druntime/libraries.m4 | 8 --------
2 files changed, 16 deletions(-)
diff --git a/libphobos/configure b/libphobos/configure
index 4f5be7d4ff4..0a48032edb4 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -15375,14 +15375,6 @@ fi
@@ -15420,14 +15420,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
@ -28,6 +30,8 @@ an external library for these functions.
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 8dd9c7da107..b61bf528a14 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT],
@ -45,3 +49,6 @@ an external library for these functions.
if test "$druntime_fiber_asm_external" = no; then
AC_SEARCH_LIBS([swapcontext], [c ucontext], [],
AC_MSG_ERROR([swapcontext required but not found]))
--
2.50.1

View file

@ -1,44 +0,0 @@
From b71d21b87e6946c763edad5e420bf22d8a453077 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 29 May 2023 15:33:11 +0000
Subject: [PATCH 33/35] libphobos: do not use LFS64 symbols
musl does not have these since 1.2.4, we can't use the compat interfaces.
---
libphobos/libdruntime/core/sys/posix/config.d | 2 +-
libphobos/libdruntime/core/sys/posix/sys/mman.d | 6 +-----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d
index ae6752f220e..6b80d1ff0e6 100644
--- a/libphobos/libdruntime/core/sys/posix/config.d
+++ b/libphobos/libdruntime/core/sys/posix/config.d
@@ -88,7 +88,7 @@ else version (CRuntime_Musl)
enum __REDIRECT = false;
// Those three are irrelevant for Musl as it always uses 64 bits off_t
- enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64;
+ enum __USE_FILE_OFFSET64 = false;
enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index 0d3d517d69a..323aa0af72d 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.41.0

View file

@ -1,15 +1,17 @@
From eeec799f43fbd0bfffc13594585b39d708972511 Mon Sep 17 00:00:00 2001
From ab88348da140c68e5e1142041dbe1c7b7d9c9a07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Tue, 19 Jul 2022 14:54:07 +0200
Subject: [PATCH 32/35] libgnat: time_t is always 64-bit on musl libc
Subject: [PATCH] libgnat: time_t is always 64-bit on musl libc
---
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 98284a4d13e..0d14f116a10 100644
--- a/gcc/ada/libgnat/s-parame.ads
+++ b/gcc/ada/libgnat/s-parame.ads
@@ -100,7 +100,7 @@ package System.Parameters is
@@ -101,7 +101,7 @@ package System.Parameters is
-- Characteristics of time_t type --
------------------------------------
@ -18,3 +20,6 @@ Subject: [PATCH 32/35] libgnat: time_t is always 64-bit on musl libc
-- Number of bits in type time_t
----------------------------------------------
--
2.50.1

View file

@ -0,0 +1,30 @@
From f865fb0a27252bd3a01fc4596f101d389929311c Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 29 May 2023 15:33:11 +0000
Subject: [PATCH] libphobos: do not use LFS64 symbols
musl does not have these since 1.2.4, we can't use the compat interfaces.
---
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 b1eb9fa8107..3aee0d96319 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.50.1

View file

@ -1,7 +1,7 @@
From 4bfcb35bc43d3e3b7510620362d7c28d9e4c17ca Mon Sep 17 00:00:00 2001
From cf6ba089ba26cd970962e874a3e35f020c3e921c Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 10 Jul 2023 23:23:29 +0000
Subject: [PATCH 34/35] libgo: fix lfs64 use
Subject: [PATCH] libgo: fix lfs64 use
---
.../go/internal/syscall/unix/at_largefile.go | 2 +-
@ -191,5 +191,5 @@ index 180f5c31d74..1d717d55c0e 100644
EREF(PRIO_USER);
EREF(RUSAGE_SELF);
--
2.41.0
2.50.1

View file

@ -1,87 +0,0 @@
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{

View file

@ -1,15 +1,15 @@
From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001
From a809e7b909e16fcf3379571417d33574e9c1dbff Mon Sep 17 00:00:00 2001
From: Jingyun Hua <huajingyun@loongson.cn>
Date: Mon, 7 Aug 2023 15:25:58 +0800
Subject: [PATCH] loongarch disable multilib support
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
---
gcc/config/loongarch/t-linux | 11 +++--------
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
index 45862048abf..73155acd832 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)
@ -28,5 +28,5 @@ index 23e1fb979..c2753abb8 100644
+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib
+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib
--
2.41.0
2.50.1

View file

@ -1,17 +1,26 @@
Patch-Source: https://github.com/richfelker/musl-cross-make/blob/6f3701d08137496d5aac479e3a3977b5ae993c1f/patches/gcc-14.2.0/0004-static-pie.diff
From 72606254a2456763cb252b4d729a9505e77e449d Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 25 Jul 2025 02:41:46 -0700
Subject: [PATCH] static PIE: ensure -static reaches the linker
gcc doesn't enable static-pie for all arches. As of this writing arm
32-bit is missing. musl supports static-pie on all arches so this
should be allowed on all arches.
on some targets, the logic for the compiler option -static seems not
to be processed when -pie is present. rather than playing
whack-a-mole, just ensure LD_PIE_SPEC specs always pass -static to ld
if either -static or -static-pie is present on the compiler driver
command line.
Without this patch binaries with (only) -static-pie are broken on some
arches.
this may produce redundant -static arguments but it doesn't matter.
---
gcc/common.opt | 4 ++--
gcc/config/gnu-user.h | 17 ++++++++---------
gcc/gcc.cc | 6 +++---
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
index e65a575d9f8..7ad38711f6e 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
@@ -3968,11 +3968,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
@ -26,7 +35,7 @@ index a75b44ee47e..7c564818b49 100644
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
index 0426efdb8c3..866c8bd77f2 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -70,12 +79,12 @@ index 5ebbf42a13d..bb907d8e89a 100644
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 3c81c5798d8..cd96eac5d12 100644
index e9f78f0f4c1..767ff65f348 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
@@ -1056,7 +1056,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
@ -84,12 +93,12 @@ index 3c81c5798d8..cd96eac5d12 100644
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
@@ -1080,12 +1080,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic %{static-pie:-static}}"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif
#else
#define LD_PIE_SPEC ""
@ -99,3 +108,6 @@ index 3c81c5798d8..cd96eac5d12 100644
#endif
#ifndef LINK_BUILDID_SPEC
--
2.50.1

View file

@ -1,4 +1,4 @@
From 49926c2c657dd867f7329df6e250913fd1425475 Mon Sep 17 00:00:00 2001
From d984c5c9ed973bb7072b48399e5d9bb1f35c3123 Mon Sep 17 00:00:00 2001
From: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri, 28 Mar 2025 17:25:56 -0700
Subject: [PATCH] except: Don't use the cached value of the gcc_except_table
@ -73,5 +73,5 @@ index 00000000000..50afa75a43f
+// There should be 3 exception tables,
+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } }
--
2.49.0
2.50.1

View file

@ -0,0 +1,164 @@
From 57eb290b3c8fc36da99213f5050b46cd93575234 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 02:59:45 -0700
Subject: [PATCH] ada: libgnat: use stub symbolic module name functions
The "linux" implementation depends on glibc internals and accordingly
does not work on musl.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/Makefile.rtl | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index cb41e6887cd..152ba70db4d 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1642,7 +1642,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 \
@@ -2014,7 +2014,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-s390.ads
ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
@@ -2359,7 +2359,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(GNATRTL_128BIT_PAIRS) \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
@@ -2407,7 +2407,7 @@ ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-mips.ads
ifeq ($(strip $(filter-out mips64% mipsisa64%,$(target_cpu))),)
@@ -2463,7 +2463,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
@@ -2519,7 +2519,7 @@ ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(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-arm.ads
@@ -2565,7 +2565,7 @@ ifeq ($(strip $(filter-out aarch64% 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) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2607,7 +2607,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
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 \
system.ads<libgnat/system-linux-sparc.ads
ifeq ($(strip $(filter-out sparc64 sparcv9,$(target_cpu))),)
@@ -2660,7 +2660,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-hppa.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2697,7 +2697,7 @@ ifeq ($(strip $(filter-out m68k% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-m68k.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2734,7 +2734,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-sh4.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-linux.adb
@@ -2779,7 +2779,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) \
@@ -2859,7 +2859,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.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) \
@@ -2904,7 +2904,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) \
@@ -2956,7 +2956,7 @@ ifeq ($(strip $(filter-out %x32 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) \
@@ -3000,7 +3000,7 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-riscv.ads
ifeq ($(strip $(filter-out riscv64,$(target_cpu))),)
--
2.50.1

View file

@ -0,0 +1,26 @@
From 3e246a3de14e843b7a9b322bacb4be497e1c504b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 03:02:38 -0700
Subject: [PATCH] ada: libgnat: recognize linux-musleabi and linux-muslgnueabi
platforms for ARM
---
gcc/ada/Makefile.rtl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 152ba70db4d..89574cdfba7 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2500,7 +2500,7 @@ endif
# ARM linux, GNU eabi
ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
-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))),)
SELECTED_PAIRS=arm-linux-gnueabi
--
2.50.1

View file

@ -24,7 +24,7 @@ CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-aarch64
pkgver=14.3.0
pkgver=15.1.1_git20250719
# i.e. 13.2.1, must match gcc/BASE-VER
_pkgbase="${pkgver%%_git*}"
# date component from snapshots
@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-aarch64
pkgrel=6
pkgrel=2
pkgdesc="Stage2 cross-compiler for aarch64"
url="https://gcc.gnu.org"
arch="x86_64"
@ -183,7 +183,7 @@ if $_libgomp; then
fi
case "$CTARGET_ARCH" in
riscv64|loongarch64)
riscv64)
LANG_ADA=false;;
esac
@ -241,7 +241,7 @@ fi
# 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://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
source="https://gcc.gnu.org/pub/gcc/snapshots/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-specs-turn-on-Wl-z-now-by-default.patch
@ -249,37 +249,40 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0006-Enable-Wformat-and-Wformat-security-by-default.patch
0007-Enable-Wtrampolines-by-default.patch
0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0011-libiberty-copy-PIC-objects-during-build-process.patch
0012-libgcc_s.patch
0013-nopie.patch
0014-ada-fix-shared-linking.patch
0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0016-add-fortify-headers-paths.patch
0017-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0018-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0019-aarch64-disable-multilib-support.patch
0020-s390x-disable-multilib-support.patch
0021-ppc64-le-disable-multilib-support.patch
0022-x86_64-disable-multilib-support.patch
0023-riscv-disable-multilib-support.patch
0024-always-build-libgcc_eh.a.patch
0025-ada-libgnarl-compatibility-for-musl.patch
0026-ada-musl-support-fixes.patch
0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0030-gdc-unconditionally-link-libgphobos-against-libucont.patch
0031-druntime-link-against-libucontext-on-all-platforms.patch
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
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
0037-static-pie.patch
0038-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0012-libiberty-copy-PIC-objects-during-build-process.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-ada-fix-shared-linking.patch
0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0017-add-fortify-headers-paths.patch
0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0020-aarch64-disable-multilib-support.patch
0021-s390x-disable-multilib-support.patch
0022-ppc64-le-disable-multilib-support.patch
0023-x86_64-disable-multilib-support.patch
0024-riscv-disable-multilib-support.patch
0025-always-build-libgcc_eh.a.patch
0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
0033-druntime-link-against-libucontext-on-all-platforms.patch
0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0035-libphobos-do-not-use-LFS64-symbols.patch
0036-libgo-fix-lfs64-use.patch
0037-loongarch-disable-multilib-support.patch
0038-static-PIE-ensure-static-reaches-the-linker.patch
0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
"
# secfixes:
@ -287,8 +290,8 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
# - CVE-2023-4039
# we build out-of-tree
#builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
builddir="$srcdir"/gcc-$_pkgbase
builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
#builddir="$srcdir"/gcc-$_pkgbase
_gcclibdir="usr/lib/gcc/$CTARGET/$_pkgbase"
_gcclibexec="usr/libexec/gcc/$CTARGET/$_pkgbase"
@ -752,43 +755,46 @@ gdb() {
}
sha512sums="
cb4e3259640721bbd275c723fe4df53d12f9b1673afb3db274c22c6aa457865dccf2d6ea20b4fd4c591f6152e6d4b87516c402015900f06ce9d43af66d3b7a93 gcc-14.3.0.tar.xz
1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch
6dd1eecbc050e30e5a0493969a0e80507d971f4ca87c06466f725fa50c9106e18aef86453fc8a80cd277438b6e79695a99cdaf2eaeb2f1add7e28f7cffd0cd2f 0002-gcc-poison-system-directories.patch
b6903b60b01187bfebc961e74d01ff5d8dc2852747663dff2b4a4f66df4b5aa412347fe92926cce1821fdd0c59d088404acbbced4b464aba9664d599a9e1bbce 0003-specs-turn-on-Wl-z-now-by-default.patch
d41a519ea5014e9ab49f017d3793e2a0a82429c2b7ded2776f2df7a2d0ac02aa294e7dbe74e027fe7c844c87525d483e0eda3846cf16340eb02e934389cfd838 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
e34d7bb51c4c413b1a10bafcdfd5729fb5980b0288277ef44ed4779700d443d2fd22129b3b22d401def140851263e803160d2f3ed8825b0bf4f3fb8606db77bd 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
83665b6adb0b8080245b253abe3344ee5106ac2bc248aad9bef713b22b644a268d75c75fbab7554e0543836903a89bc4f0bec4b6d6d4e3d5ba355dddbc5ba190 0006-Enable-Wformat-and-Wformat-security-by-default.patch
ca5757a32f02bb24bc5b42bb03dca49fb9f9e6f34776343f1c5580efd2bcacf8c5b59f4b61652fa3ea1506eb14bcd390f5fda7b4cbfd32f7d1a750d14add4739 0007-Enable-Wtrampolines-by-default.patch
e476da4c2f29a941b7f4f1dfc9a37ba82b439badc47fc3fb72630ec5620f64849bdb66d339e0182674a0ee898a75564ffaf702986b770bfd793e7fbdcaa9f21b 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
93d03afd83dee5f7129c36a7b81fa8fd323476507e2f53a4fbe40a026037e7dfafa23591145d7af5848d9a322d212497947a0f58ef828734552e6a6dabd00cfa 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch
b40b6cbc3725ae88c506bc39a8ba10cfcdcc208fa26d667393bbb80e24346da2ccfac3ff914bb9fc4c374f022fa7f913e6873b9a66a96b79a1ac84959c9d5348 0012-libgcc_s.patch
6cc2c00b15d259289fa9831b60b58f8afdf09858410bd08ab3d839a45c6f3fb9e8e214dab851d105c61df7965f1c10255c84b5b6301630a390b27b8929a25e1e 0013-nopie.patch
0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch
7640e71cd957066e2e07ffcec1f8540cd6b1bdaf976c980693bf6f5d3afaf51ca7e41c62f92cb13c86c2dea9eb9cd799b2e3ea77d74926e82bf1e12bb7a4d64e 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch
8a8c9dc96f300f660f1a643c800352383f32db258dfcfa88a44159a38bb81a7298089a5dcb23906002c85cafc806caf6f3db0e1cb26fcac6192ae1e41d9ada3a 0017-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
6c1cbfcf9e6f54b2173af39bbbfd97e7c18ae32a690fb4c6b1e35fa183992ea0f8046d479be57b6ac7d798bf2a6dade4f9ea3e3a839dc6fb8d47203de9c89e25 0018-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
2213e07bab6f5d8d3d39c732f5385f46cc8f0c84e35054139fdaf13051252d7bf11f647f54aa8456b532166b008fff0656d8f41278e34ba868dd6fe427427a3a 0019-aarch64-disable-multilib-support.patch
a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch
f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch
44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch
0ef65a344975b641343767e289578ba5b0fd381c7177ebe4558cb67d8b41e33e3b825478fa46852f1f40ec9119ff908cf75ee36307266aea13f39460e080b0b6 0023-riscv-disable-multilib-support.patch
55438233a217dc1ee58990413b8782b9bd560a1532c1e6c860f377072ed1bdf75d5dc2458ed33194040ec5427c30df3fa68948dcd26de90e3803d3f7b784becd 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
02e8358b8855fb49bbb2b3ef293cff67441c5fdf1f2fee4dcec86ef1fd4f701e899ea9c7e072d888b0f1e674d7874d3085138f3deb9845d1f2e35d4a1fe3f5ab 0026-ada-musl-support-fixes.patch
8eff7679140f9e39f1a0ac2e4a6cc7e131efa3d5a669696dd28300eb5d75ef3be62f10c1b91d8f8c8ba2cba1ff9cf121228b6fcd3adafa28389ac63698e7d5a7 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
458c9b121e00cec4d0dbe1d18c5e5332342eb0a3429129e5a9d9ace3247c31d85571ad9f47046c4ed3bc62e5d8a4297f48744a30424a19acbdd9aa484e3ee715 0030-gdc-unconditionally-link-libgphobos-against-libucont.patch
099103f4b0b4612ff4bd2e8721cf1593415b636bff74d4feba304bb610ced6f4951cb3ab89088111e58029a2f9bf4a5dcc91e2b2afe4dd9813d2fa6b0999a5a2 0031-druntime-link-against-libucontext-on-all-platforms.patch
21ff4d55eec48ad4a9db0cd359e760cff548f7f6b1a67759a2e87fc7e16a262d82d2f980d309a3ce5e14097665beeb5516a5f2d98869a5d28345e685c6fe689d 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
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
8249ce989c1a76bcb5bbb1123ef88d88f220b709fe6ac804f18c905a7b31c4e68ef6f5cc2236f446feed89fa773a3aed996a6aba7618e73a000d73cb0b0753f6 0037-static-pie.patch
90b6148d47f39caf1b70416abf2a09f4ce048491f784f56bd659dbf99e2c9f6a44b244827f23977494ab4e42640c49c1dc79f43a4d69c2b31c4b1e25d54d8142 0038-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
a5e0082e492502385565479201bca3e9f5138a55d83540bff8b84a94d958c4d2afce474328656ee7d55fad910c04523c0068efe92382e68a327a65f6e641b88a gcc-15-20250719.tar.xz
fd5cebc5deb1d588583424acbc1b5a6d8d6f5b1bfa9f4bdbc082cfd406723f423d87011ee30e04ed18128a7ed8021cbfc9262becff5419125dc1afb6f407defa 0001-posix_memalign.patch
6634004cb9feea9ee0d063d6b6984d7db3b10c692b6139bb99169a4f2d74f0e10b5ca0ab31ce346ffef34b8eb9c3f536aa4d94bce1b27f8e0b8a9fc5cc4b7057 0002-gcc-poison-system-directories.patch
37e089791dbcbad73af866b662cda611dc0970d93e28251c7a9aa898db3b96446654e8b778d7866eb8550ba7f4a57cf22e8514d562bfed0c66613e65550d9c85 0003-specs-turn-on-Wl-z-now-by-default.patch
d4d5bfeb20a9fac968f37497d86d7eff4a9ac863e015dadbffae24c08236f5efde69b615d95191e2546672ce2d4b30d3627528c64a83fc64b715e8fa6fd4c372 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
b77cd1ee887fc52afee2fafd2d338f70a62c115017aa4fcb0ab9cf82b8a003794f75b7913cc153c767c351d2be8e1e7c113f893edee818217f20cad3cb6a2e66 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
af634de360e8b7aef285702815affb16da667719b786848ccdb9e4cca2a27826793f64c903a32a5d8ba1953965a5cc8999c58e2b6ce9ef36f74807e495cc9e42 0006-Enable-Wformat-and-Wformat-security-by-default.patch
21ad1cd4b7ef652ddaf6b9fb8071a87ec2fc694e8c420a79baf456347b8e1db5930a914c92a375943dda63d096c4823a2b8028d02a5b49c9bcdab5c170558004 0007-Enable-Wtrampolines-by-default.patch
dcd07ecf0daad8743a378abbcb921d4b17e528651a596454956563a3417fe9ea3b88dce7b15b9270f55ae2ea2a72efe8a7215236d0a21e2942c7c5ba0e8e2c39 0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
488bd530e209e3213f83d695fb2ac529c408e3dba9024457594cfb0d266acb079447bca184fbf136bacd1f1ec5ca3607dc4998b66630af9781ea7ee41c16236b 0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
7229a3fe655e8460148e0cd4c39d7362e713d1a6215530547f346371a5e3647245123637e8b075c58c5e7e35c823d96a0b3cdbedb6c07b5095507b4499bc053a 0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
f7c1870bda4d418380f471b520b7cf20fde743f57415323c1a8898a815f8c7023adc3882e1d0453c5b6fcb65a27a9534fdeb297bf451453a95d90c0395e42c3b 0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
140c8165726404da0fc0ea01add2a7fa307377817968177334c520bdaabc23e8ec5d76f80337b89ff03edfd52dead7119433a03d2165e24780dc944633a9c2a3 0012-libiberty-copy-PIC-objects-during-build-process.patch
af848ef58b63a7592ad0f549be65fbe8dcd3c1e5ea9f30cfa65be02519ca9826d7612131c3b0042615b7537683d74eeb6849aba61810b0d8ed1c79f968188260 0013-libgcc_s.patch
c97b473c08b46090b48764af55b244ec70a13d26f2d881c57761abbc4a1c481da9766f33e59daee7188bc06c4631e53becbaf8801d0b35ca0b5fe84cb6a840f7 0014-nopie.patch
9c37cc38bb7238058751d3ff60712acd4134aa4c28d946c453b8b230bd6ba34c45c47a4b4d7e74aa7e3ed8dfc74cbb1d5a328bda706dd3037320e02a15421b86 0015-ada-fix-shared-linking.patch
b4afb30431ecdfd86acfd66ba857c275628b55e91cc9b21c18ca0e795b2fadfe895da801978a8e818ff9c93144075e72cf0521f3bce5c6c1d44e47e1b77b8ba4 0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
6260341ed13926ce449cf351ada85d8e28fc7da63a4ae73b69c24fb2e8d0e3003ffacb1bb0f957185b8d5d7e013f777f7f696c9a1c94b2204a9b3e8274ec2f43 0017-add-fortify-headers-paths.patch
8fe954daf7e9b1d221f0536f54186bc1715e23cf3c74dfd0956c0fa22ce3b5b5e30b5e17ea584db1cc193ac7fdc72daff68c9163dbc46a837e01d25a7a4a90e0 0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
fc5ce12cd70382b15317931ff0f57ae1ed10e8c09dbf2fee627bc55a268f55ebbf9ae32b89b4ef6f51e9a9b7ca32eed201245d481cde88f6eb572d40134f5f4c 0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
e0d4fd0e0bf4ecfb517b60b55d73f326deda0faa75bfd07d1fcae116f91088a96caaa2dd20e2e38a93cc8ffed0aef422c0c861879c8de406364faef0cbcd50ff 0020-aarch64-disable-multilib-support.patch
7af318ea6fe14dce98b8db1f8f46a2dc9f75c2f27e63a52c62c7b47d6d62cb64748d5c2690eba772d931ff96ac089e3f03bf46b49122ffb5a03a1c186f01ae11 0021-s390x-disable-multilib-support.patch
b96dbbd0e1aa98ebc2e7eaa2a44912681e4c8bc9a129fafa53a943d67b62451b6d4fad53f92429cd4346a753527359c8c09d58836cf0968a56f5fe933496a412 0022-ppc64-le-disable-multilib-support.patch
60106cb08f27c89509ba46dc2ff0edecc1f4c7973874c85047dfdd67eabe50e3a852d7540002a09bcb6185c786a5daeba7915958c441fc92d7f16a0cce5bcdea 0023-x86_64-disable-multilib-support.patch
d55d65242af9341eef7f1e3d03fec2e2de75632a23ed83df4fe6304619f62127b42eba9d9286f7f3647e3b9bd95aaeb79023263e71ff9d58c47f3051b73d8bc2 0024-riscv-disable-multilib-support.patch
b6dda179cafbd9e7f3ef7e137b303a76491a0157d68f1504dee6611cecdca16d27ca32cbd2298da2f6301e7167b8730d70a775ee5ba88ae3773adef8421efa98 0025-always-build-libgcc_eh.a.patch
95245b6548ddca5065bac06131294028767a32740c80f707a4d1cf8653a0398305ec68e7c44a3f2912741b792d41048f03729657b0a1c1a2a7bff097c6b2fdc7 0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
ff6b8b9e1ab9b45d1853e74befb5c904cf7cd83dadb5a4b6f8c94a75e6249d1cdaa72aef73d6b1045beabc2d9012ea869d886015ec3aae561eb4ba8b9d00c2d7 0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
0582f00e8801df06e51fca45a8dc3ee62e9b6ce9245af98937f435c90c709edc7eb9071569c0e59c9a143d964fe5731b9e11b011174443b97043abddc9db1cce 0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
8683314212c0a6f49ed45ea8c74908f59d863822fa8c99e94c7e39ba3a642ca6a3167543e1ae4b58d8acd1ff97824d6e60cc432b19e6580cad2027e3a5c37603 0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
60bb67f6cf4b92243dec861fba702aa5847925bf413c2c83705a0ee4ebe4c523cc295cce29666c69c9b2dec70d63def83cd9074e613b4f46e014248f53c87db4 0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
b49f72cce409f74407761fe64b028e97d58e4f236af7d9099189a8553f2ece3f30559760fab768f3d1fc4c7f89ae3ee6d687018251f3df52c9a43817c9c7c93e 0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0bd3aa81590d5f47205e193d2998bb5986cbb82adb75e3d39dcf820625bb358d380d1695ebbb18437fdd935ce350b0f5b7364a5fa7c8e07ebe8f972c8cd46cd1 0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
e8d5c4159f41fcb09e76758768d127ff366c93095137b694a405e9dbba88f2036ba64b69ac6c5c75e488be3281a1227cccbadcea2bef6f60ba0be7fc3d7db754 0033-druntime-link-against-libucontext-on-all-platforms.patch
6f530cdb1935296925ec29be7a30e4d69cebc155695db6ea30ee95ce65de7e8917e2a6148d3668974715120e7f13f734e5c36bfd35f707f4725a7556cbc1caa5 0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
1dabb0c8d581ec86d8758dfa3d2f1713d915f6d927639f56b3590ed9b0885dfdf452e30ca87edac49721d2dc43d4fbdb4d178f8448e8ba5cc595457f216bf210 0035-libphobos-do-not-use-LFS64-symbols.patch
b915a0eaf7cc3e48f41f31ebbd9142760891b9ede304ff3f1dc7166f85a9e3f82017a17bb7e65824d3da07445b2c8bcd156a992eed92633362c08329b04b6cb4 0036-libgo-fix-lfs64-use.patch
0164467e66719187b6041c8d2d717a9bcd5b8c801dab6391b0e503c41e26518cc78389c97bdd2b2bc64f660f95410439aaa8a20799ec01eab17e7ba415ac1dd9 0037-loongarch-disable-multilib-support.patch
2cae2cb470b2cf469973c0ff3a7a020960cf4325502ff6c84c6b1b3514c8cacfae8452b5c79b55e657b0877fc9d81cc68db6f650156ca6d1376c1bd1a2290d8b 0038-static-PIE-ensure-static-reaches-the-linker.patch
7d73041566678fc86885877d8315481bf358858cbe54227356d5ab48623e435426ac7ff6e54d21b9fee4cc73e3f4bc7ef646d3e4ab1970e524c890cd1f735905 0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
4556ead97907ec76aaa7dde450e4b6068f87268c49168eeb2af0c3df1dfa312b0a4a947b65b11fd413dae9af0beb3ef002d077c0d7f43b0bc466d3cd4348e657 0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
389eacbeba976a461af3d087d732d1c4f2a38bc5db91b935149e60ad4b210286ba76688b8a947d00f324566b6789152bf3b93a188fa2fb7ee8042786df483fed 0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
"

View file

@ -1,14 +1,14 @@
From 47b4bd4deb2c356bb07d2a96f22127aefafec3a4 Mon Sep 17 00:00:00 2001
From 94cf7d2b3514ed3a4401861a519ead450e022afc Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 01/35] posix_memalign
Subject: [PATCH] posix_memalign
---
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 3527283693b..c4071b64b53 100644
index d1d79a32fc9..069c3bb8324 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
@ -38,5 +38,5 @@ index 3527283693b..c4071b64b53 100644
else
return NULL;
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 4fa620d8c3e6730211bfb071eb4c817320491bd0 Mon Sep 17 00:00:00 2001
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:59:00 +0400
Subject: [PATCH 02/35] gcc: poison-system-directories
Date: Thu, 23 Jan 2025 17:12:51 -0800
Subject: [PATCH] gcc: poison-system-directories
Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for
@ -11,23 +11,25 @@ aborted.
Instead, we add the two missing items to the current scan. If the user
wants this to be a failure, they can add "-Werror=poison-system-directories".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
gcc/configure | 16 ++++++++++++++++
gcc/configure.ac | 10 ++++++++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 2 ++
gcc/incpath.cc | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
gcc/gcc.cc | 12 ++++++++++--
gcc/incpath.cc | 25 +++++++++++++++++++++++++
7 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e3fa0dacec4..bea1adc0940 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -715,6 +715,10 @@ Wreturn-local-addr
@@ -729,6 +729,10 @@ Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable.
@ -38,9 +40,11 @@ Upstream-Status: Pending
Wshadow
Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global.
diff --git a/gcc/config.in b/gcc/config.in
index a79c51adb2b..8a531ed591c 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -249,6 +249,12 @@
@@ -249,6 +249,16 @@
#endif
@ -48,14 +52,20 @@ Upstream-Status: Pending
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index 16965953f05..0f4a5d52c30 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1050,6 +1050,7 @@ enable_maintainer_mode
@@ -1051,6 +1051,7 @@ enable_maintainer_mode
enable_link_mutex
enable_link_serialization
enable_version_specific_runtime_libs
@ -63,7 +73,7 @@ Upstream-Status: Pending
enable_plugin
enable_host_shared
enable_host_pie
@@ -1823,6 +1824,8 @@ Optional Features:
@@ -1828,6 +1829,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@ -72,7 +82,7 @@ Upstream-Status: Pending
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -34082,6 +34085,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
@@ -34027,6 +34030,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
@ -83,47 +93,60 @@ Upstream-Status: Pending
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+if test "x${enable_poison_system_directories}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9f67e62950a..b0e3615e5aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7555,6 +7555,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
@@ -7502,6 +7502,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [warn for use of native system header directories (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 72009c33cd0..29aea724731 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -391,6 +391,7 @@ Objective-C and Objective-C++ Dialects}.
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
-Wrestrict -Wno-return-local-addr -Wreturn-type
-Wno-scalar-storage-order -Wsequence-point
@@ -8861,6 +8862,14 @@ made up of data only and thus requires no special treatment. But, for
most targets, it is made up of code and thus requires the stack to be
made executable in order for the program to work properly.
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
-Wno-psabi
-Wredundant-decls -Wrestrict
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
Suppress warnings from casts from a pointer to an integer type of a
different size.
+@opindex Wno-poison-system-directories
+@item -Wno-poison-system-directories
@ -133,12 +156,27 @@ Upstream-Status: Pending
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@opindex Wfloat-equal
@opindex Wno-float-equal
@item -Wfloat-equal
@opindex Winvalid-pch
@opindex Wno-invalid-pch
@item -Winvalid-pch
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4fd87f2c4a1..79d4920a047 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1163,6 +1163,8 @@ proper position among the other output files. */
@@ -909,6 +909,12 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+#ifdef POISON_BY_DEFAULT
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
+#else
+#define POISON_IS_ERROR
+#endif
+
/* Assembler options for compressed debug sections. */
#if HAVE_LD_COMPRESS_DEBUG == 0
/* Reject if the linker cannot write compressed debug sections. */
@@ -1166,6 +1172,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@ -147,6 +185,26 @@ Upstream-Status: Pending
%{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
- %{pthread:-fprofile-update=prefer-atomic}}}";
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index c1bbfd3872a..2cdbebc4c50 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -26,6 +26,7 @@
@ -157,9 +215,20 @@ Upstream-Status: Pending
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
cur->name, xstrerror (errno));
reason = REASON_NOENT;
}
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ pcur = &cur->next;
+ continue;
+#endif
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
fprintf (stderr, _("End of #embed search list.\n"));
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
@ -168,19 +237,22 @@ Upstream-Status: Pending
+ struct cpp_dir *p;
+
+ for (p = heads[INC_QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.50.1

View file

@ -1,7 +1,7 @@
From ff4dd4ce33133e675b7bedc86b73357c04631cb9 Mon Sep 17 00:00:00 2001
From 90e8697dd88fd99ce2cf8739e95494853005377e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:45:49 +0000
Subject: [PATCH 03/35] specs: turn on -Wl,-z,now by default
Subject: [PATCH] specs: turn on -Wl,-z,now by default
Previously, we also used to turn on -z relro here, but we now build
binutils with --enable-relro, which is functionally equivalent.
@ -13,9 +13,11 @@ now by default.
gcc/gcc.cc | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 29aea724731..6fb3ab70cc7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -18935,6 +18935,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
@@ -19477,6 +19477,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
@ -25,9 +27,11 @@ now by default.
@opindex u
@item -u @var{symbol}
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 79d4920a047..74a356fdf5e 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1161,6 +1161,7 @@ proper position among the other output files. */
@@ -1170,6 +1170,7 @@ proper position among the other output files. */
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
@ -35,3 +39,6 @@ now by default.
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{Wno-poison-system-directories:--no-poison-system-directories} \
--
2.50.1

View file

@ -1,17 +1,19 @@
From 1b315235433701e4a974da259b8d651169ddc7ac Mon Sep 17 00:00:00 2001
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:22 +0000
Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC,
ObjC++, if the optimization level is > 0
---
gcc/c-family/c-cppbuiltin.cc | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 4589ee4a3a6..9edf095384c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1570,6 +1570,10 @@ c_cpp_builtins (cpp_reader *pfile)
@@ -1581,6 +1581,10 @@ c_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
@ -22,9 +24,11 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6fb3ab70cc7..799ce073dbf 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12496,6 +12496,12 @@ also turns on the following optimization flags:
@@ -12840,6 +12840,12 @@ also turns on the following optimization flags:
Please note the warning under @option{-fgcse} about
invoking @option{-O2} on programs that use computed gotos.
@ -37,3 +41,6 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
@opindex O3
@item -O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.50.1

View file

@ -1,8 +1,8 @@
From 67c0f5789630b27149f60ff831999ef7c1dba5d5 Mon Sep 17 00:00:00 2001
From a59da582e83071de0566274d912ca6f05f4b75d0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:56 +0000
Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
Subject: [PATCH] On linux targets pass --as-needed by default to the linker,
but always link the sanitizer libraries with --no-as-needed.
---
gcc/config/aarch64/aarch64-linux.h | 1 +
@ -21,9 +21,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
gcc/gcc.cc | 28 ++++++++++++++++++++--------
14 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 116bb4e69f3..daf99f8dce9 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
@@ -39,6 +39,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
@ -31,6 +33,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index 3fd3b831166..0b4c2dccebe 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
@ -42,6 +46,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index d4d389e2aa8..adccc0b11c2 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
@ -52,6 +58,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 4c4e31efa39..3c17ac6eade 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -78,6 +86,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
#endif
#undef TARGET_F951_OPTIONS
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 7abfda53049..ceb8f855b7d 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
@ -89,6 +99,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{!static-pie: \
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index abe714711bf..3ca128a79f5 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -99,6 +111,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index a2494c214c4..e1a5d530cdf 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
@ -110,6 +124,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5a82508c113..6eee7cdc603 100644
--- a/gcc/config/mips/gnu-user.h
+++ b/gcc/config/mips/gnu-user.h
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
@ -120,6 +136,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 9060c940a44..282c77b6a7b 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
@ -130,6 +148,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
-X \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 0316d8cb65d..139e1b6796c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -378,13 +378,13 @@ extern int dot_symbols;
@ -148,6 +168,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index afb5c6ad867..b64638fb25b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -781,7 +781,7 @@ GNU_USER_TARGET_CC1_SPEC
@ -159,6 +181,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 2c3bca5dfcb..b90661247a4 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
@ -170,6 +194,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{static:-static} \
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 6d928846895..3cc05bb7240 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
@ -181,9 +207,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 74a356fdf5e..fc9c7d15b04 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -771,8 +771,11 @@ proper position among the other output files. */
@@ -774,8 +774,11 @@ proper position among the other output files. */
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -197,7 +225,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -807,8 +810,11 @@ proper position among the other output files. */
@@ -810,8 +813,11 @@ proper position among the other output files. */
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -211,7 +239,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -825,8 +831,11 @@ proper position among the other output files. */
@@ -828,8 +834,11 @@ proper position among the other output files. */
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -225,7 +253,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -841,8 +850,11 @@ proper position among the other output files. */
@@ -844,8 +853,11 @@ proper position among the other output files. */
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
@ -239,3 +267,6 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.50.1

View file

@ -1,15 +1,17 @@
From bb25e8489384504cd59e4a2538720863da1fb29c Mon Sep 17 00:00:00 2001
From 35c02ea8267e193b92f30495c94ee1e8e5c2be8e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:47:43 +0000
Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Subject: [PATCH] Enable -Wformat and -Wformat-security by default.
---
gcc/c-family/c.opt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 75b6531860e..78830ce4b42 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -774,7 +774,7 @@ Warn about function calls with format strings that write past the end
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
of the destination region.
Wformat-security
@ -18,7 +20,7 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about possible security problems with format functions.
Wformat-signedness
@@ -799,7 +799,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
@@ -830,7 +830,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
@ -27,3 +29,6 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about printf/scanf/strftime/strfmon format string anomalies.
Wframe-address
--
2.50.1

View file

@ -1,16 +1,18 @@
From 4a728ad48a7b437cc6f2697e26603bf648149f86 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:48:24 +0000
Subject: [PATCH 07/35] Enable -Wtrampolines by default.
From 0b82663fd2f054e07e116c4dcc5019f7e969cd3e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:44:20 -0700
Subject: [PATCH] Enable -Wtrampolines by default.
---
gcc/common.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index bea1adc0940..e65a575d9f8 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -811,7 +811,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa
Warn if a comparison always evaluates to true or false.
Wtrampolines
-Common Var(warn_trampolines) Warning
@ -18,3 +20,6 @@ Subject: [PATCH 07/35] Enable -Wtrampolines by default.
Warn whenever a trampoline is generated.
Wtrivial-auto-var-init
--
2.50.1

View file

@ -1,46 +0,0 @@
From 32f24560d0602f7735d5e9efd92fe3151bd72cea Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:49:40 +0000
Subject: [PATCH 08/35] Disable ssp on -nostdlib, -nodefaultlibs and
-ffreestanding Change the buffer size.
---
gcc/gcc.cc | 8 +++++++-
gcc/params.opt | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1000,6 +1000,12 @@ proper position among the other output files. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
#endif
+#ifdef ENABLE_DEFAULT_SSP
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
+#else
+#define NO_SSP_SPEC ""
+#endif
+
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
@@ -1305,7 +1311,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1013,7 +1013,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
The maximum number of SSA_NAME assignments to follow in determining a value.
-param=ssp-buffer-size=
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
The lower bound for a buffer to be considered for stack smashing protection.
-param=stack-clash-protection-guard-size=

View file

@ -0,0 +1,39 @@
From 3acf32fc94fd447874b2f1447a19a65f0905bff5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:49:03 -0700
Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and
-nodefaultlibs
---
gcc/gcc.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index fc9c7d15b04..7b0d3d2743b 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1009,6 +1009,12 @@ proper position among the other output files. */
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
#endif
+#ifdef ENABLE_DEFAULT_SSP
+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
+#else
+#define NO_SSP_SPEC ""
+#endif
+
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
@@ -1314,7 +1320,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
--
2.50.1

View file

@ -0,0 +1,25 @@
From bb98973bdb5fe8bd040e238afe92845203929b59 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 01:50:42 -0700
Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4
---
gcc/params.opt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/params.opt b/gcc/params.opt
index 64e453d29b7..bba3fd574f2 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1064,7 +1064,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim
The maximum number of SSA_NAME assignments to follow in determining a value.
-param=ssp-buffer-size=
-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
The lower bound for a buffer to be considered for stack smashing protection.
-param=stack-clash-protection-guard-size=
--
2.50.1

View file

@ -1,8 +1,8 @@
From c7ec8da7280d7f97f5543eb9ddeca7600aafc43c Mon Sep 17 00:00:00 2001
From f89d8e95b809d02eceee416b463200c9abb2b33e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:50:33 +0000
Subject: [PATCH 09/35] Ensure that msgfmt doesn't encounter problems during
gcc bootstrapping.
Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc
bootstrapping.
Solves error messages like the following:
@ -26,7 +26,7 @@ https://bugs.gentoo.org/295480
2 files changed, 2 insertions(+)
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
index 12d34910830..61b13762b71 100644
index 7f84a99533e..a4c6284f788 100644
--- a/libstdc++-v3/po/Makefile.am
+++ b/libstdc++-v3/po/Makefile.am
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
@ -50,5 +50,5 @@ index 8e93445acd2..d6ff06e5ddb 100644
all-local: all-local-$(USE_NLS)
--
2.41.0
2.50.1

View file

@ -1,17 +1,17 @@
From aaa029bcee68298695b7c4278c90b6bc320d098c Mon Sep 17 00:00:00 2001
From b45303198567828a5240baf932a8c13255f35d20 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:52:07 +0000
Subject: [PATCH 10/35] Don't declare asprintf if defined as a macro.
Subject: [PATCH] Don't declare asprintf if defined as a macro.
---
include/libiberty.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/libiberty.h b/include/libiberty.h
index 1d5c779fcff..19e3cb1e31c 100644
index d4e8791b14b..c074980ed80 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -652,8 +652,11 @@ extern void *bsearch_r (const void *, const void *,
@@ -678,8 +678,11 @@ extern void *bsearch_r (const void *, const void *,
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
@ -24,5 +24,5 @@ index 1d5c779fcff..19e3cb1e31c 100644
/* Like asprintf but allocates memory without fail. This works like
xmalloc. */
--
2.41.0
2.50.1

View file

@ -1,17 +1,17 @@
From 65e01e749205c9af218b01233cebd0077538d0ee Mon Sep 17 00:00:00 2001
From 68e2c9356221ba30b27840b9449f742505584cf1 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:53:00 +0000
Subject: [PATCH 11/35] libiberty: copy PIC objects during build process
Subject: [PATCH] libiberty: copy PIC objects during build process
---
libiberty/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 72608f3e4a7..58356884728 100644
index ce54d88278d..10c212a1ad3 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -265,6 +265,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
@ -20,5 +20,5 @@ index 72608f3e4a7..58356884728 100644
else true; fi
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 453a815bf2844971a91eaef800af188d9e86b784 Mon Sep 17 00:00:00 2001
From ca482f8c9cac9617855f908dd30d3d6144e850a0 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 12/35] libgcc_s
Subject: [PATCH] libgcc_s
---
gcc/config/i386/i386-expand.cc | 4 ++--
@ -9,9 +9,11 @@ Subject: [PATCH 12/35] libgcc_s
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index cdfd94d3c73..a3a6c988833 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -13089,10 +13089,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
@@ -13643,10 +13643,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
@ -24,6 +26,8 @@ Subject: [PATCH 12/35] libgcc_s
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 2484dc839bf..e980030ef23 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
@ -37,6 +41,8 @@ Subject: [PATCH 12/35] libgcc_s
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
@ -46,3 +52,6 @@ Subject: [PATCH 12/35] libgcc_s
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
--
2.50.1

View file

@ -1,16 +1,18 @@
From 7d7d12137c666761a8dd61179c9651b85dae9b41 Mon Sep 17 00:00:00 2001
From 6dfb241ae9f879f4945941273dd73eb13f127b06 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 7 Nov 2015 02:08:05 +0000
Subject: [PATCH 13/35] nopie
Subject: [PATCH] nopie
---
gcc/configure | 25 +++++++++++++++++++++++++
gcc/configure.ac | 11 +++++++++++
2 files changed, 36 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 0f4a5d52c30..343563c8948 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -34606,6 +34606,29 @@ rm -f core conftest.err conftest.$ac_objext \
@@ -34586,6 +34586,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; }
@ -40,7 +42,7 @@ Subject: [PATCH 13/35] nopie
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -34623,6 +34646,8 @@ if test x$enable_host_pie = xyes; then
@@ -34603,6 +34626,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
@ -49,9 +51,11 @@ Subject: [PATCH 13/35] nopie
else
LD_PICFLAG=
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b0e3615e5aa..b3948469d17 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7821,6 +7821,15 @@ AC_CACHE_CHECK([for -no-pie option],
@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option],
[gcc_cv_no_pie=yes],
[gcc_cv_no_pie=no])
LDFLAGS="$saved_LDFLAGS"])
@ -67,7 +71,7 @@ Subject: [PATCH 13/35] nopie
if test x$enable_host_shared = xyes; then
PICFLAG=-fPIC
@@ -7838,6 +7847,8 @@ if test x$enable_host_pie = xyes; then
@@ -7819,6 +7828,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
@ -76,3 +80,6 @@ Subject: [PATCH 13/35] nopie
else
LD_PICFLAG=
fi
--
2.50.1

View file

@ -1,14 +1,14 @@
From dd5bb97c31a9f57034c70a7a18ba6e2e133084c7 Mon Sep 17 00:00:00 2001
From 8ac6aeca5d6192ee16b959bd8c1903a52d408a55 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:16 +0000
Subject: [PATCH 14/35] ada: fix shared linking
Subject: [PATCH] ada: fix shared linking
---
gcc/ada/link.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
index f2126441208..22cfa9c641f 100644
index 9e3385ca94f..2c0cca6e480 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
@ -38,5 +38,5 @@ index f2126441208..22cfa9c641f 100644
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
--
2.41.0
2.50.1

View file

@ -1,12 +1,14 @@
From 6bb5b7d9161d05f31b001d8211a9c63caf63fd2f Mon Sep 17 00:00:00 2001
From 7323d68ae46fc8e33c0746799d820a4e4c8c8b72 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:43 +0000
Subject: [PATCH 15/35] build: fix CXXFLAGS_FOR_BUILD passing
Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing
---
Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.in b/Makefile.in
index b1ed67d3d4f..1e039c20550 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
@ -17,3 +19,6 @@ Subject: [PATCH 15/35] build: fix CXXFLAGS_FOR_BUILD passing
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
--
2.50.1

View file

@ -1,14 +1,14 @@
From f0d9e00cac06689f64b214de7aee80d7116ef084 Mon Sep 17 00:00:00 2001
From eaf89c8c91806905c6e1ec9519cbfb56296204b0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:01:06 +0000
Subject: [PATCH 16/35] add fortify-headers paths
Subject: [PATCH] add fortify-headers paths
---
gcc/config/linux.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index e3aca79cccc..b3537b8fbeb 100644
index d6280a4d4dd..ba69fb9fad7 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -159,6 +159,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -21,5 +21,5 @@ index e3aca79cccc..b3537b8fbeb 100644
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else
--
2.41.0
2.50.1

View file

@ -1,9 +1,9 @@
From 857db04f4f1a06e866551b4172fe8f27363f4a92 Mon Sep 17 00:00:00 2001
From bdedcd9db7b8291637c5147dd82e8a9e3f5f9c87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 21 Aug 2020 07:03:00 +0000
Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
link to it unconditionally, as otherwise we get link failures if some objects
are -fstack-protector built and final link happens with -fno-stack-protector.
Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to
it unconditionally, as otherwise we get link failures if some objects are
-fstack-protector built and final link happens with -fno-stack-protector.
This seems to be the common case when bootstrapping gcc, the piepatches do
not seem to fully fix the crosstoolchain and bootstrap sequence wrt.
stack-protector flag usage.
@ -12,9 +12,11 @@ Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
gcc/gcc.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 7b0d3d2743b..e46e976a2e8 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1008,8 +1008,7 @@ proper position among the other output files. */
@@ -1017,8 +1017,7 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
@ -24,3 +26,6 @@ Subject: [PATCH 17/35] Alpine musl package provides libssp_nonshared.a. We
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
--
2.50.1

View file

@ -1,16 +1,18 @@
From 5a8347e23ab13912b6edec2c6c6e3a101b017c79 Mon Sep 17 00:00:00 2001
From 586ce3614d4fc3fbeccf01659114a4643c1879c8 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:03:42 +0000
Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when
linking libtsan.
---
gcc/gcc.cc | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index e46e976a2e8..607c8ca1d42 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -772,10 +772,10 @@ proper position among the other output files. */
@@ -775,10 +775,10 @@ proper position among the other output files. */
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
@ -23,7 +25,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -811,10 +811,10 @@ proper position among the other output files. */
@@ -814,10 +814,10 @@ proper position among the other output files. */
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
@ -36,7 +38,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -832,10 +832,10 @@ proper position among the other output files. */
@@ -835,10 +835,10 @@ proper position among the other output files. */
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
@ -49,7 +51,7 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -851,10 +851,10 @@ proper position among the other output files. */
@@ -854,10 +854,10 @@ proper position among the other output files. */
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
@ -62,3 +64,6 @@ Subject: [PATCH 18/35] DP: Use --push-state/--pop-state for gold as well when
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.50.1

View file

@ -1,7 +1,7 @@
From 41d00a2eb0754acf71958808bd17dbebeb517b84 Mon Sep 17 00:00:00 2001
From 0ca7f92018d0bc04a72655f3b130c9aaeea1b771 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:12:55 +0000
Subject: [PATCH 19/35] aarch64: disable multilib support
Subject: [PATCH] aarch64: disable multilib support
multilib is unsupported on Alpine GCC
---
@ -9,7 +9,7 @@ multilib is unsupported on Alpine GCC
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index 57bf4100fcd..172894b57ef 100644
index 70e36b3299e..e00c3becd3f 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
@ -22,5 +22,5 @@ index 57bf4100fcd..172894b57ef 100644
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 85b42bfbba71616831d14360b16998acb28790fd Mon Sep 17 00:00:00 2001
From b48898c8fbd7828b81f407c74c25cf8e07fb73a4 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:13:59 +0000
Subject: [PATCH 20/35] s390x: disable multilib support
Subject: [PATCH] s390x: disable multilib support
multilib is not supported on Alpine GCC at present
---
@ -21,5 +21,5 @@ index cc6ab367072..7f498ee1cdc 100644
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 7b53df284242638e940c0155b6c21e88cea1f55b Mon Sep 17 00:00:00 2001
From 158d93ce86f3d311ce489d0740326027068ca721 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:14:33 +0000
Subject: [PATCH 21/35] ppc64[le]: disable multilib support
Subject: [PATCH] ppc64[le]: disable multilib support
multilib is not presently supported on Alpine GCC
---
@ -36,7 +36,7 @@ index 4e371255533..128c75c7d39 100644
endif
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 01a94242308..b3a76379c03 100644
index f56b47c268e..c5f757a6284 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -28,8 +28,8 @@
@ -77,5 +77,5 @@ index 2e63bdb9fc9..c6e1c5db65d 100644
+MULTILIB_OSDIRNAMES += m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 96e7e1e9a899d9bb5fcbdf788bd529d0390c626f Mon Sep 17 00:00:00 2001
From 6957fc21caca80f5e01db15df6dc8de46c85167b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Thu, 6 Jan 2022 03:14:54 +0000
Subject: [PATCH 22/35] x86_64: disable multilib support
Subject: [PATCH] x86_64: disable multilib support
multilib is not presently supported on Alpine GCC
---
@ -9,7 +9,7 @@ multilib is not presently supported on Alpine GCC
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 138956b0962..bc03dab874f 100644
index 64a4a20e64f..9a8eb8dd8d1 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -33,6 +33,6 @@
@ -22,5 +22,5 @@ index 138956b0962..bc03dab874f 100644
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From b26224acf342eacb33491f6ea0da1faf73d35715 Mon Sep 17 00:00:00 2001
From fdcbe7ee4ce81cdf247966385c8d521ac3f5a38c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 3 Jan 2022 07:14:48 +0100
Subject: [PATCH 23/35] riscv: disable multilib support
Subject: [PATCH] riscv: disable multilib support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -42,6 +42,8 @@ library.
gcc/config/riscv/t-linux | 7 +++++--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 282c77b6a7b..07adae3d59c 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
@ -56,6 +58,8 @@ library.
- "/usr/lib/ "
-
-#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index a6f64f88d25..f88776ec520 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,5 +1,8 @@
@ -69,3 +73,6 @@ library.
+MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc
MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu)
--
2.50.1

View file

@ -1,135 +0,0 @@
From 3ee8cbc1cad261b30d4a7a66d31496d5f243ce2f Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:06:30 +0000
Subject: [PATCH 25/35] ada: libgnarl compatibility for musl
---
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 a5e645d334d..32165347071 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 821ceef30e4..ae95b58e01e 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.41.0

View file

@ -1,7 +1,7 @@
From a72e0613f79f6b6867819317accb7a714031a08c Mon Sep 17 00:00:00 2001
From 6f63901256443978a2c3746e72bd5762166a7790 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:05:41 +0000
Subject: [PATCH 24/35] always build libgcc_eh.a
Subject: [PATCH] always build libgcc_eh.a
highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
@ -9,9 +9,11 @@ highly inspired by:
libgcc/Makefile.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 0719fd0615d..80bb8f1622f 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -967,8 +967,9 @@ ifneq ($(LIBUNWIND),)
@@ -971,8 +971,9 @@ ifneq ($(LIBUNWIND),)
all: libunwind.a
endif
@ -22,7 +24,7 @@ highly inspired by:
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1173,10 +1174,6 @@ install-libunwind:
@@ -1177,10 +1178,6 @@ install-libunwind:
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
@ -33,7 +35,7 @@ highly inspired by:
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -1193,6 +1190,10 @@ ifeq ($(enable_gcov),yes)
@@ -1197,6 +1194,10 @@ ifeq ($(enable_gcov),yes)
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
endif
@ -44,3 +46,6 @@ highly inspired by:
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
--
2.50.1

View file

@ -0,0 +1,59 @@
From a365def37f5de93ad85588d8e2c02c0df28e88d6 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:09:02 -0700
Subject: [PATCH] ada: libgnarl: remove use of glibc-specific
pthread_rwlockattr_setkind_np
musl's thread library does not implement it
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/libgnarl/s-osinte__linux.ads | 10 ----------
gcc/ada/libgnarl/s-taprop__linux.adb | 7 -------
2 files changed, 17 deletions(-)
diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads
index 7aeb15da523..5551b701e5a 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -402,16 +402,6 @@ package System.OS_Interface is
(attr : access pthread_rwlockattr_t) return int;
pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy");
- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0;
- 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;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 8f4c835baa7..6df36c7d8f4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is
Result : C.int;
begin
- -- Set the rwlock to prefer writer to avoid writers starvation
-
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.50.1

View file

@ -1,239 +0,0 @@
From 3df4788c79c7429b196c7b284af2b4cf9a4b4f8d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 26/35] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 16 ++++++++--------
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 35 insertions(+), 33 deletions(-)
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1558,7 +1558,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 \
@@ -2145,7 +2145,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
$(GNATRTL_128BIT_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-loongarch.ads
@@ -2233,7 +2233,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
@@ -2268,7 +2268,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 \
@@ -2312,7 +2312,7 @@ ifeq ($(strip $(filter-out aarch64% linux%,$(target_cpu) $(target_os))),)
s-intman.adb<libgnarl/s-intman__posix.adb \
s-linux.ads<libgnarl/s-linux.ads \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
s-mudido.adb<libgnarl/s-mudido__affinity.adb \
s-osinte.ads<libgnarl/s-osinte__linux.ads \
s-osinte.adb<libgnarl/s-osinte__posix.adb \
@@ -2489,7 +2489,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) \
@@ -2593,7 +2593,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) \
@@ -2638,7 +2638,7 @@ ifeq ($(strip $(filter-out %x32 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) \
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -94,6 +94,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
+
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3465,7 +3470,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
@@ -3475,7 +3479,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
-cpu_set_t *
+void *
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3488,33 +3492,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
@@ -3524,23 +3528,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__ */
--- 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)
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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)

View file

@ -0,0 +1,50 @@
From e1572457f94a26da9a588a36afa3eb0e74122c34 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:13:19 -0700
Subject: [PATCH] ada: libgnarl: use posix_openpt instead of glibc-specific
getpt to open a pty
musl only implements posix_openpt(3), not the older glibc-specific getpt()
and glibc implements both for ages.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/terminals.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 89f887556c0..93557fe2631 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1134,7 +1134,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
@@ -1148,7 +1148,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)
@@ -1197,8 +1197,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.50.1

View file

@ -0,0 +1,54 @@
From 4f26d4bfedb7f942b69ca4743f053c3a690a0b4a Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Fri, 25 Jul 2025 02:18:49 -0700
Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/adaint.c | 6 +++++-
gcc/ada/adaint.h | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 1fcfae165a7..67318e647ed 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -95,6 +95,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
@@ -3476,7 +3481,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
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 3df12b5f956..26a489f2b78 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -40,6 +40,11 @@ extern "C" {
#include "mingw32.h"
#endif
+#if defined (linux) || defined(__linux__)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
+
#include <dirent.h>
/* Constants used for the form parameter encoding values */
--
2.50.1

View file

@ -1,14 +1,14 @@
From 7b50823d8a4131e5a55d2499a0f5a52b3d91eed2 Mon Sep 17 00:00:00 2001
From 6592e702844d31bcef17c340bfc13e0e1be9f132 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Wed, 9 Dec 2020 07:42:06 +0000
Subject: [PATCH 27/35] configure: Add --enable-autolink-libatomic, use in
Subject: [PATCH] configure: Add --enable-autolink-libatomic, use in
LINK_GCC_C_SEQUENCE_SPEC [PR81358]
This fixes issues with RISC-V.
---
Makefile.in | 1 +
gcc/config/gnu-user.h | 12 +++++++++++-
gcc/config.in | 6 ++++++
gcc/config/gnu-user.h | 12 +++++++++++-
gcc/configure | 31 ++++++++++++++++++++++++++++++-
gcc/configure.ac | 21 +++++++++++++++++++++
gcc/doc/install.texi | 8 ++++++++
@ -17,9 +17,11 @@ This fixes issues with RISC-V.
gcc/gcc.cc | 12 +++++++++++-
9 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 1e039c20550..20f535a306a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -237,6 +237,7 @@ HOST_EXPORTS = \
@@ -238,6 +238,7 @@ HOST_EXPORTS = \
RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
@ -27,6 +29,25 @@ This fixes issues with RISC-V.
HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
diff --git a/gcc/config.in b/gcc/config.in
index 8a531ed591c..40045ff35a5 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,12 @@
#endif
+/* Define if libatomic should always be linked. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_AUTOLINK_LIBATOMIC
+#endif
+
+
/* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
#ifndef USED_FOR_TARGET
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 3c17ac6eade..0426efdb8c3 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -109,8 +109,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -49,24 +70,11 @@ This fixes issues with RISC-V.
%{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
#undef LINK_GCC_C_SEQUENCE_SPEC
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -131,6 +131,12 @@
#endif
+/* Define if libatomic should always be linked. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_AUTOLINK_LIBATOMIC
+#endif
+
+
/* Define to 1 to specify that we are using the BID decimal floating point
format instead of DPD */
#ifndef USED_FOR_TARGET
diff --git a/gcc/configure b/gcc/configure
index 343563c8948..54300a2a867 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1002,6 +1002,7 @@ with_changes_root_url
@@ -1003,6 +1003,7 @@ with_changes_root_url
enable_languages
with_multilib_list
with_multilib_generator
@ -74,7 +82,7 @@ This fixes issues with RISC-V.
with_zstd
with_zstd_include
with_zstd_lib
@@ -1739,6 +1740,9 @@ Optional Features:
@@ -1742,6 +1743,9 @@ Optional Features:
--disable-shared don't provide a shared libgcc
--disable-gcov don't provide libgcov and related host tools
--enable-languages=LIST specify which front-ends to build
@ -84,7 +92,7 @@ This fixes issues with RISC-V.
--disable-rpath do not hardcode runtime library paths
--enable-sjlj-exceptions
arrange to use setjmp/longjmp exception handling
@@ -8380,7 +8384,6 @@ else
@@ -8400,7 +8404,6 @@ else
fi
@ -92,7 +100,7 @@ This fixes issues with RISC-V.
# Check whether --with-multilib-generator was given.
if test "${with_multilib_generator+set}" = set; then :
withval=$with_multilib_generator; :
@@ -8388,6 +8391,32 @@ else
@@ -8408,6 +8411,32 @@ else
with_multilib_generator=default
fi
@ -125,9 +133,11 @@ This fixes issues with RISC-V.
# -------------------------
# Checks for other programs
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b3948469d17..81c070830e2 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1215,6 +1215,27 @@ AC_ARG_WITH(multilib-generator,
@@ -1227,6 +1227,27 @@ AC_ARG_WITH(multilib-generator,
:,
with_multilib_generator=default)
@ -155,9 +165,11 @@ This fixes issues with RISC-V.
# -------------------------
# Checks for other programs
# -------------------------
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 3e9e09b4ae3..6e7b756be61 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -2525,6 +2525,14 @@ files, but these changed header paths may conflict with some compilation
@@ -2617,6 +2617,14 @@ files, but these changed header paths may conflict with some compilation
environments. Enabled by default, and may be disabled using
@option{--disable-canonical-system-headers}.
@ -172,6 +184,8 @@ This fixes issues with RISC-V.
@item --with-glibc-version=@var{major}.@var{minor}
Tell GCC that when the GNU C Library (glibc) is used on the target it
will be version @var{major}.@var{minor} or later. Normally this can
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index a96700c0d38..16deedca64d 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
@ -189,6 +203,8 @@ This fixes issues with RISC-V.
@end defmac
@defmac POST_LINK_SPEC
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index eccc4d88493..4ca4c610571 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search.
@ -206,9 +222,11 @@ This fixes issues with RISC-V.
@end defmac
@defmac POST_LINK_SPEC
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 607c8ca1d42..e9f78f0f4c1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -991,13 +991,23 @@ proper position among the other output files. */
@@ -1000,13 +1000,23 @@ proper position among the other output files. */
# define ASM_DEBUG_OPTION_SPEC ""
#endif
@ -233,3 +251,6 @@ This fixes issues with RISC-V.
#endif
#ifdef ENABLE_DEFAULT_SSP
--
2.50.1

View file

@ -1,8 +1,8 @@
From 5bbbd320e54ab5341cfba83e8af98685131caba1 Mon Sep 17 00:00:00 2001
From 952070c1616f231a810af2da50264713d7587b48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 29 Aug 2021 12:23:34 +0200
Subject: [PATCH 28/35] configure: fix detection of atomic builtins in
libatomic configure script
Subject: [PATCH] configure: fix detection of atomic builtins in libatomic
configure script
Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by
default) causes the libatomic configure script to incorrectly detect
@ -22,7 +22,7 @@ See:
1 file changed, 20 insertions(+)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index a92ae9e8309..90b579ca4d8 100644
index 6db039d6e8b..2751b5c1387 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -30,6 +30,26 @@
@ -53,5 +53,5 @@ index a92ae9e8309..90b579ca4d8 100644
alpha*)
# fenv.c needs this option to generate inexact exceptions.
--
2.41.0
2.50.1

View file

@ -1,15 +1,15 @@
From 430c701a3cefbe09a9c7c8a2f5bbe957f9b2ecb2 Mon Sep 17 00:00:00 2001
From 896b002a2afacb4d75d573aca4ae53b499df19cd Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Thu, 30 Jun 2022 16:44:51 +0000
Subject: [PATCH 29/35] libstdc++: do not throw exceptions for non-C locales on
musl targets
Subject: [PATCH] libstdc++: do not throw exceptions for non-C locales on musl
targets
---
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 8849d78fdfa..aff467f98fe 100644
index bfd02b5c2c6..16f9e84d66f 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
@ -23,5 +23,5 @@ index 8849d78fdfa..aff467f98fe 100644
void
--
2.41.0
2.50.1

View file

@ -1,17 +1,18 @@
From 05f0043755f341a2ff4f845379327076b3e0203d Mon Sep 17 00:00:00 2001
From 22d69ae3e2768d301ef5a1f1b362c25cf8bf27b9 Mon Sep 17 00:00:00 2001
From: Mathias LANG <pro.mathias.lang@gmail.com>
Date: Mon, 17 Jan 2022 03:49:21 +0000
Subject: [PATCH 30/35] gdc: unconditionally link libgphobos against
libucontext
Subject: [PATCH] gdc: unconditionally link libgphobos against libucontext
ref: alpine/aports#13422
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 20f535a306a..c087bfe7cd4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54362,7 +54362,7 @@ configure-target-libphobos:
@@ -54382,7 +54382,7 @@ configure-target-libphobos:
esac; \
module_srcdir=libphobos; \
rm -f no-such-file || : ; \
@ -20,3 +21,6 @@ ref: alpine/aports#13422
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--
2.50.1

View file

@ -1,7 +1,7 @@
From 0b89a74fbf77ae6917f043c79cd03db0d6ef0212 Mon Sep 17 00:00:00 2001
From dc66835022cf68085400f2eed30614c5afdc28a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 16 Jul 2022 09:21:11 +0200
Subject: [PATCH 31/35] druntime: link against libucontext on all platforms
Subject: [PATCH] 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
@ -11,9 +11,11 @@ an external library for these functions.
libphobos/m4/druntime/libraries.m4 | 8 --------
2 files changed, 16 deletions(-)
diff --git a/libphobos/configure b/libphobos/configure
index 4f5be7d4ff4..0a48032edb4 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -15375,14 +15375,6 @@ fi
@@ -15420,14 +15420,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
@ -28,6 +30,8 @@ an external library for these functions.
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 8dd9c7da107..b61bf528a14 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT],
@ -45,3 +49,6 @@ an external library for these functions.
if test "$druntime_fiber_asm_external" = no; then
AC_SEARCH_LIBS([swapcontext], [c ucontext], [],
AC_MSG_ERROR([swapcontext required but not found]))
--
2.50.1

View file

@ -1,44 +0,0 @@
From b71d21b87e6946c763edad5e420bf22d8a453077 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 29 May 2023 15:33:11 +0000
Subject: [PATCH 33/35] libphobos: do not use LFS64 symbols
musl does not have these since 1.2.4, we can't use the compat interfaces.
---
libphobos/libdruntime/core/sys/posix/config.d | 2 +-
libphobos/libdruntime/core/sys/posix/sys/mman.d | 6 +-----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d
index ae6752f220e..6b80d1ff0e6 100644
--- a/libphobos/libdruntime/core/sys/posix/config.d
+++ b/libphobos/libdruntime/core/sys/posix/config.d
@@ -88,7 +88,7 @@ else version (CRuntime_Musl)
enum __REDIRECT = false;
// Those three are irrelevant for Musl as it always uses 64 bits off_t
- enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64;
+ enum __USE_FILE_OFFSET64 = false;
enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index 0d3d517d69a..323aa0af72d 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.41.0

View file

@ -1,15 +1,17 @@
From eeec799f43fbd0bfffc13594585b39d708972511 Mon Sep 17 00:00:00 2001
From ab88348da140c68e5e1142041dbe1c7b7d9c9a07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Tue, 19 Jul 2022 14:54:07 +0200
Subject: [PATCH 32/35] libgnat: time_t is always 64-bit on musl libc
Subject: [PATCH] libgnat: time_t is always 64-bit on musl libc
---
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 98284a4d13e..0d14f116a10 100644
--- a/gcc/ada/libgnat/s-parame.ads
+++ b/gcc/ada/libgnat/s-parame.ads
@@ -100,7 +100,7 @@ package System.Parameters is
@@ -101,7 +101,7 @@ package System.Parameters is
-- Characteristics of time_t type --
------------------------------------
@ -18,3 +20,6 @@ Subject: [PATCH 32/35] libgnat: time_t is always 64-bit on musl libc
-- Number of bits in type time_t
----------------------------------------------
--
2.50.1

View file

@ -0,0 +1,30 @@
From f865fb0a27252bd3a01fc4596f101d389929311c Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 29 May 2023 15:33:11 +0000
Subject: [PATCH] libphobos: do not use LFS64 symbols
musl does not have these since 1.2.4, we can't use the compat interfaces.
---
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 b1eb9fa8107..3aee0d96319 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.50.1

View file

@ -1,7 +1,7 @@
From 4bfcb35bc43d3e3b7510620362d7c28d9e4c17ca Mon Sep 17 00:00:00 2001
From cf6ba089ba26cd970962e874a3e35f020c3e921c Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Mon, 10 Jul 2023 23:23:29 +0000
Subject: [PATCH 34/35] libgo: fix lfs64 use
Subject: [PATCH] libgo: fix lfs64 use
---
.../go/internal/syscall/unix/at_largefile.go | 2 +-
@ -191,5 +191,5 @@ index 180f5c31d74..1d717d55c0e 100644
EREF(PRIO_USER);
EREF(RUSAGE_SELF);
--
2.41.0
2.50.1

View file

@ -1,87 +0,0 @@
From: Celeste <cielesti@protonmail.com>
Date: Mon, 2 Sep 2024 02:54:17 +0000
Subject: [PATCH] libphobos: add riscv64 and loongarch64 support
Add musl support for these 2 architectures based on fenv.h and signal.h from:
https://git.musl-libc.org/cgit/musl/tree/arch/riscv64/bits?h=v1.2.5
https://git.musl-libc.org/cgit/musl/tree/arch/loongarch64/bits?h=v1.2.5
---
libphobos/libdruntime/core/stdc/fenv.d | 13 +++++++++++++
libphobos/libdruntime/core/sys/posix/signal.d | 10 ++++++++++
2 files changed, 23 insertions(+)
diff --git a/libphobos/libdruntime/core/stdc/fenv.d b/libphobos/libdruntime/core/stdc/fenv.d
index a7364c0a..5b327e4a 100644
--- a/libphobos/libdruntime/core/stdc/fenv.d
+++ b/libphobos/libdruntime/core/stdc/fenv.d
@@ -436,20 +436,33 @@ else version (CRuntime_Musl)
ushort __cs_selector;
ushort __opcode;
uint __data_offset;
ushort __data_selector;
ushort __unused5;
version (X86_64)
uint __mxcsr;
}
alias ushort fexcept_t;
}
+ else version (RISCV64)
+ {
+ alias uint fenv_t;
+ alias uint fexcept_t;
+ }
+ else version (LoongArch64)
+ {
+ struct fenv_t
+ {
+ uint __cw;
+ }
+ alias uint fexcept_t;
+ }
else
{
static assert(false, "Architecture not supported.");
}
}
else version (CRuntime_Newlib)
{
version (AArch64)
{
alias fenv_t = ulong;
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index a8b7f751..78d8b3cd 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -2751,20 +2751,30 @@ else version (CRuntime_Musl)
else version (PPC_Any)
{
enum MINSIGSTKSZ = 4096;
enum SIGSTKSZ = 10240;
}
else version (X86_Any)
{
enum MINSIGSTKSZ = 2048;
enum SIGSTKSZ = 8192;
}
+ else version (RISCV64)
+ {
+ enum MINSIGSTKSZ = 2048;
+ enum SIGSTKSZ = 8192;
+ }
+ else version (LoongArch64)
+ {
+ enum MINSIGSTKSZ = 4096;
+ enum SIGSTKSZ = 16384;
+ }
else
static assert(0, "unimplemented");
//ucontext_t (defined in core.sys.posix.ucontext)
//mcontext_t (defined in core.sys.posix.ucontext)
version (MIPS_Any)
{
struct stack_t
{

View file

@ -1,15 +1,15 @@
From c4f484f465a32e796ae384aa3f90e79fa218b4e9 Mon Sep 17 00:00:00 2001
From a809e7b909e16fcf3379571417d33574e9c1dbff Mon Sep 17 00:00:00 2001
From: Jingyun Hua <huajingyun@loongson.cn>
Date: Mon, 7 Aug 2023 15:25:58 +0800
Subject: [PATCH] loongarch disable multilib support
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
---
gcc/config/loongarch/t-linux | 11 +++--------
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
index 45862048abf..73155acd832 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)
@ -28,5 +28,5 @@ index 23e1fb979..c2753abb8 100644
+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib
+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib
--
2.41.0
2.50.1

View file

@ -1,17 +1,26 @@
Patch-Source: https://github.com/richfelker/musl-cross-make/blob/6f3701d08137496d5aac479e3a3977b5ae993c1f/patches/gcc-14.2.0/0004-static-pie.diff
From 72606254a2456763cb252b4d729a9505e77e449d Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Fri, 25 Jul 2025 02:41:46 -0700
Subject: [PATCH] static PIE: ensure -static reaches the linker
gcc doesn't enable static-pie for all arches. As of this writing arm
32-bit is missing. musl supports static-pie on all arches so this
should be allowed on all arches.
on some targets, the logic for the compiler option -static seems not
to be processed when -pie is present. rather than playing
whack-a-mole, just ensure LD_PIE_SPEC specs always pass -static to ld
if either -static or -static-pie is present on the compiler driver
command line.
Without this patch binaries with (only) -static-pie are broken on some
arches.
this may produce redundant -static arguments but it doesn't matter.
---
gcc/common.opt | 4 ++--
gcc/config/gnu-user.h | 17 ++++++++---------
gcc/gcc.cc | 6 +++---
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index a75b44ee47e..7c564818b49 100644
index e65a575d9f8..7ad38711f6e 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3473,11 +3473,11 @@ Driver
@@ -3968,11 +3968,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
@ -26,7 +35,7 @@ index a75b44ee47e..7c564818b49 100644
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 5ebbf42a13d..bb907d8e89a 100644
index 0426efdb8c3..866c8bd77f2 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -70,12 +79,12 @@ index 5ebbf42a13d..bb907d8e89a 100644
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 3c81c5798d8..cd96eac5d12 100644
index e9f78f0f4c1..767ff65f348 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1010,7 +1010,7 @@ proper position among the other output files. */
@@ -1056,7 +1056,7 @@ proper position among the other output files. */
#define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC
#define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;"
#else
@ -84,12 +93,12 @@ index 3c81c5798d8..cd96eac5d12 100644
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -1034,12 +1034,12 @@ proper position among the other output files. */
@@ -1080,12 +1080,12 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic %{static-pie:-static}}"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif
#else
#define LD_PIE_SPEC ""
@ -99,3 +108,6 @@ index 3c81c5798d8..cd96eac5d12 100644
#endif
#ifndef LINK_BUILDID_SPEC
--
2.50.1

View file

@ -1,4 +1,4 @@
From 49926c2c657dd867f7329df6e250913fd1425475 Mon Sep 17 00:00:00 2001
From d984c5c9ed973bb7072b48399e5d9bb1f35c3123 Mon Sep 17 00:00:00 2001
From: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri, 28 Mar 2025 17:25:56 -0700
Subject: [PATCH] except: Don't use the cached value of the gcc_except_table
@ -73,5 +73,5 @@ index 00000000000..50afa75a43f
+// There should be 3 exception tables,
+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } }
--
2.49.0
2.50.1

View file

@ -0,0 +1,164 @@
From 57eb290b3c8fc36da99213f5050b46cd93575234 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 02:59:45 -0700
Subject: [PATCH] ada: libgnat: use stub symbolic module name functions
The "linux" implementation depends on glibc internals and accordingly
does not work on musl.
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
---
gcc/ada/Makefile.rtl | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index cb41e6887cd..152ba70db4d 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1642,7 +1642,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 \
@@ -2014,7 +2014,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-s390.ads
ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
@@ -2359,7 +2359,7 @@ ifeq ($(strip $(filter-out loongarch% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
g-sercom.adb<libgnat/g-sercom__linux.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
$(GNATRTL_128BIT_PAIRS) \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
@@ -2407,7 +2407,7 @@ ifeq ($(strip $(filter-out mips% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-mips.ads
ifeq ($(strip $(filter-out mips64% mipsisa64%,$(target_cpu))),)
@@ -2463,7 +2463,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
@@ -2519,7 +2519,7 @@ ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(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-arm.ads
@@ -2565,7 +2565,7 @@ ifeq ($(strip $(filter-out aarch64% 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) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
$(GNATRTL_128BIT_PAIRS) \
@@ -2607,7 +2607,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
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 \
system.ads<libgnat/system-linux-sparc.ads
ifeq ($(strip $(filter-out sparc64 sparcv9,$(target_cpu))),)
@@ -2660,7 +2660,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-hppa.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2697,7 +2697,7 @@ ifeq ($(strip $(filter-out m68k% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-m68k.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-gnu.adb
@@ -2734,7 +2734,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-sh4.ads
TOOLS_TARGET_PAIRS = indepsw.adb<indepsw-linux.adb
@@ -2779,7 +2779,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) \
@@ -2859,7 +2859,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.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) \
@@ -2904,7 +2904,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) \
@@ -2956,7 +2956,7 @@ ifeq ($(strip $(filter-out %x32 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) \
@@ -3000,7 +3000,7 @@ ifeq ($(strip $(filter-out riscv% linux%,$(target_cpu) $(target_os))),)
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
s-tpopsp.adb<libgnarl/s-tpopsp__posix-foreign.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
+ s-tsmona.adb<libgnat/s-tsmona.adb \
system.ads<libgnat/system-linux-riscv.ads
ifeq ($(strip $(filter-out riscv64,$(target_cpu))),)
--
2.50.1

View file

@ -0,0 +1,26 @@
From 3e246a3de14e843b7a9b322bacb4be497e1c504b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@ariadne.space>
Date: Sat, 26 Jul 2025 03:02:38 -0700
Subject: [PATCH] ada: libgnat: recognize linux-musleabi and linux-muslgnueabi
platforms for ARM
---
gcc/ada/Makefile.rtl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 152ba70db4d..89574cdfba7 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -2500,7 +2500,7 @@ endif
# ARM linux, GNU eabi
ifeq ($(SELECTED_PAIRS),PAIRS_NONE)
-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))),)
SELECTED_PAIRS=arm-linux-gnueabi
--
2.50.1

View file

@ -24,7 +24,7 @@ CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-armhf
pkgver=14.3.0
pkgver=15.1.1_git20250719
# i.e. 13.2.1, must match gcc/BASE-VER
_pkgbase="${pkgver%%_git*}"
# date component from snapshots
@ -34,7 +34,7 @@ _pkgsnap="${pkgver##*_git}"
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-armhf
pkgrel=6
pkgrel=2
pkgdesc="Stage2 cross-compiler for armhf"
url="https://gcc.gnu.org"
arch="x86_64"
@ -183,7 +183,7 @@ if $_libgomp; then
fi
case "$CTARGET_ARCH" in
riscv64|loongarch64)
riscv64)
LANG_ADA=false;;
esac
@ -241,7 +241,7 @@ fi
# 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://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
source="https://gcc.gnu.org/pub/gcc/snapshots/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-specs-turn-on-Wl-z-now-by-default.patch
@ -249,37 +249,40 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
0006-Enable-Wformat-and-Wformat-security-by-default.patch
0007-Enable-Wtrampolines-by-default.patch
0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0011-libiberty-copy-PIC-objects-during-build-process.patch
0012-libgcc_s.patch
0013-nopie.patch
0014-ada-fix-shared-linking.patch
0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0016-add-fortify-headers-paths.patch
0017-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0018-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0019-aarch64-disable-multilib-support.patch
0020-s390x-disable-multilib-support.patch
0021-ppc64-le-disable-multilib-support.patch
0022-x86_64-disable-multilib-support.patch
0023-riscv-disable-multilib-support.patch
0024-always-build-libgcc_eh.a.patch
0025-ada-libgnarl-compatibility-for-musl.patch
0026-ada-musl-support-fixes.patch
0027-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0028-configure-fix-detection-of-atomic-builtins-in-libato.patch
0029-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0030-gdc-unconditionally-link-libgphobos-against-libucont.patch
0031-druntime-link-against-libucontext-on-all-platforms.patch
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
0035-loongarch-disable-multilib-support.patch
0036-libphobos-add-riscv64-and-loongarch64-support.patch
0037-static-pie.patch
0038-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0012-libiberty-copy-PIC-objects-during-build-process.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-ada-fix-shared-linking.patch
0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0017-add-fortify-headers-paths.patch
0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0020-aarch64-disable-multilib-support.patch
0021-s390x-disable-multilib-support.patch
0022-ppc64-le-disable-multilib-support.patch
0023-x86_64-disable-multilib-support.patch
0024-riscv-disable-multilib-support.patch
0025-always-build-libgcc_eh.a.patch
0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
0033-druntime-link-against-libucontext-on-all-platforms.patch
0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
0035-libphobos-do-not-use-LFS64-symbols.patch
0036-libgo-fix-lfs64-use.patch
0037-loongarch-disable-multilib-support.patch
0038-static-PIE-ensure-static-reaches-the-linker.patch
0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
"
# secfixes:
@ -287,8 +290,8 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz
# - CVE-2023-4039
# we build out-of-tree
#builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
builddir="$srcdir"/gcc-$_pkgbase
builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap
#builddir="$srcdir"/gcc-$_pkgbase
_gcclibdir="usr/lib/gcc/$CTARGET/$_pkgbase"
_gcclibexec="usr/libexec/gcc/$CTARGET/$_pkgbase"
@ -752,43 +755,46 @@ gdb() {
}
sha512sums="
cb4e3259640721bbd275c723fe4df53d12f9b1673afb3db274c22c6aa457865dccf2d6ea20b4fd4c591f6152e6d4b87516c402015900f06ce9d43af66d3b7a93 gcc-14.3.0.tar.xz
1ecffba1b07d60e1b4422302b032bbea918b674c8e12b30aa6965b544d700ce86b61e9f7b8d402c6caf59257f491a394dd0912f0948565d6eae9335ee54f3b35 0001-posix_memalign.patch
6dd1eecbc050e30e5a0493969a0e80507d971f4ca87c06466f725fa50c9106e18aef86453fc8a80cd277438b6e79695a99cdaf2eaeb2f1add7e28f7cffd0cd2f 0002-gcc-poison-system-directories.patch
b6903b60b01187bfebc961e74d01ff5d8dc2852747663dff2b4a4f66df4b5aa412347fe92926cce1821fdd0c59d088404acbbced4b464aba9664d599a9e1bbce 0003-specs-turn-on-Wl-z-now-by-default.patch
d41a519ea5014e9ab49f017d3793e2a0a82429c2b7ded2776f2df7a2d0ac02aa294e7dbe74e027fe7c844c87525d483e0eda3846cf16340eb02e934389cfd838 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
e34d7bb51c4c413b1a10bafcdfd5729fb5980b0288277ef44ed4779700d443d2fd22129b3b22d401def140851263e803160d2f3ed8825b0bf4f3fb8606db77bd 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
83665b6adb0b8080245b253abe3344ee5106ac2bc248aad9bef713b22b644a268d75c75fbab7554e0543836903a89bc4f0bec4b6d6d4e3d5ba355dddbc5ba190 0006-Enable-Wformat-and-Wformat-security-by-default.patch
ca5757a32f02bb24bc5b42bb03dca49fb9f9e6f34776343f1c5580efd2bcacf8c5b59f4b61652fa3ea1506eb14bcd390f5fda7b4cbfd32f7d1a750d14add4739 0007-Enable-Wtrampolines-by-default.patch
e476da4c2f29a941b7f4f1dfc9a37ba82b439badc47fc3fb72630ec5620f64849bdb66d339e0182674a0ee898a75564ffaf702986b770bfd793e7fbdcaa9f21b 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
93d03afd83dee5f7129c36a7b81fa8fd323476507e2f53a4fbe40a026037e7dfafa23591145d7af5848d9a322d212497947a0f58ef828734552e6a6dabd00cfa 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
da9eaf2f0ddbec5ee14dc26053936587e6c76fbf16846db804a18cf4d318579426ebcc566aed02daf8e34f60c08b61f5d3959305886dca9bbcdc84db057258d9 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
35b9aafe7eee8138cb7aad7164a8f77c15ccdce26843cee78b5871ef91d76cad22ed0871b20f51c4b89b71afd9cfe4ba4227086e158c466558513708fe7d2a1a 0011-libiberty-copy-PIC-objects-during-build-process.patch
b40b6cbc3725ae88c506bc39a8ba10cfcdcc208fa26d667393bbb80e24346da2ccfac3ff914bb9fc4c374f022fa7f913e6873b9a66a96b79a1ac84959c9d5348 0012-libgcc_s.patch
6cc2c00b15d259289fa9831b60b58f8afdf09858410bd08ab3d839a45c6f3fb9e8e214dab851d105c61df7965f1c10255c84b5b6301630a390b27b8929a25e1e 0013-nopie.patch
0b50ad15115192699efa9fda3d4fb1c2fa95da06d7880ba34615b40c19a8256e1fe364da39f5c70dc22fbccf21db2de5900932afef68948722eeb25e435262f8 0014-ada-fix-shared-linking.patch
7640e71cd957066e2e07ffcec1f8540cd6b1bdaf976c980693bf6f5d3afaf51ca7e41c62f92cb13c86c2dea9eb9cd799b2e3ea77d74926e82bf1e12bb7a4d64e 0015-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
7f0bc42b93a389b614054e700b851abfbc53db391aa10cbdf6990d41396b293af78980bb39f1cf0967184d3fbf3d46ac7c7f096717b8f193ea34cbf7f37d7e91 0016-add-fortify-headers-paths.patch
8a8c9dc96f300f660f1a643c800352383f32db258dfcfa88a44159a38bb81a7298089a5dcb23906002c85cafc806caf6f3db0e1cb26fcac6192ae1e41d9ada3a 0017-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
6c1cbfcf9e6f54b2173af39bbbfd97e7c18ae32a690fb4c6b1e35fa183992ea0f8046d479be57b6ac7d798bf2a6dade4f9ea3e3a839dc6fb8d47203de9c89e25 0018-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
2213e07bab6f5d8d3d39c732f5385f46cc8f0c84e35054139fdaf13051252d7bf11f647f54aa8456b532166b008fff0656d8f41278e34ba868dd6fe427427a3a 0019-aarch64-disable-multilib-support.patch
a9567947471c3ba8a547a79c55e183974554bf823d9a97a165c966d7b3caad8789980e096e3b78452ece5de062bd9bb006af464bbf0c5a35b689eac3ee21e5c5 0020-s390x-disable-multilib-support.patch
f382eb5f7c2c60c5a23fac587c9629a3059d7be0898e97a1feaf9b9cbe1ef4693cc1177eb29333e8b7944fa17487478e73958be45d5782ccb9ef501961fb9a96 0021-ppc64-le-disable-multilib-support.patch
44ab86feb8e41e7c2b2e27accdf46194c9b80ee6a39543303dc04824f669d9fad182aabd40c9c7f6c265cf9bb71be830c257be115dc9d701d54eca3aa9ef174e 0022-x86_64-disable-multilib-support.patch
0ef65a344975b641343767e289578ba5b0fd381c7177ebe4558cb67d8b41e33e3b825478fa46852f1f40ec9119ff908cf75ee36307266aea13f39460e080b0b6 0023-riscv-disable-multilib-support.patch
55438233a217dc1ee58990413b8782b9bd560a1532c1e6c860f377072ed1bdf75d5dc2458ed33194040ec5427c30df3fa68948dcd26de90e3803d3f7b784becd 0024-always-build-libgcc_eh.a.patch
8fdbe0c8bf4ca60f458a33e59027de03d15ac91933fe46d8ca62119346d20b9bc2447c0bf22bceb63d0cf8613ab61512d9197f4e6c2224af473b63ef9f254295 0025-ada-libgnarl-compatibility-for-musl.patch
02e8358b8855fb49bbb2b3ef293cff67441c5fdf1f2fee4dcec86ef1fd4f701e899ea9c7e072d888b0f1e674d7874d3085138f3deb9845d1f2e35d4a1fe3f5ab 0026-ada-musl-support-fixes.patch
8eff7679140f9e39f1a0ac2e4a6cc7e131efa3d5a669696dd28300eb5d75ef3be62f10c1b91d8f8c8ba2cba1ff9cf121228b6fcd3adafa28389ac63698e7d5a7 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
458c9b121e00cec4d0dbe1d18c5e5332342eb0a3429129e5a9d9ace3247c31d85571ad9f47046c4ed3bc62e5d8a4297f48744a30424a19acbdd9aa484e3ee715 0030-gdc-unconditionally-link-libgphobos-against-libucont.patch
099103f4b0b4612ff4bd2e8721cf1593415b636bff74d4feba304bb610ced6f4951cb3ab89088111e58029a2f9bf4a5dcc91e2b2afe4dd9813d2fa6b0999a5a2 0031-druntime-link-against-libucontext-on-all-platforms.patch
21ff4d55eec48ad4a9db0cd359e760cff548f7f6b1a67759a2e87fc7e16a262d82d2f980d309a3ce5e14097665beeb5516a5f2d98869a5d28345e685c6fe689d 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
65df1d489e8d07a811f39e27fd29e3b2b4164fbc2c5fdc16a5142886d94a96e3fb28ccf4f20dd297ba6540ef8ea1ac3eb65a4279494639bf2f0f8376a3896cc3 0035-loongarch-disable-multilib-support.patch
06f64544fd8bc4b6c8b06410c5198aa8fb4e82c232afc0cad83b2c69ac5d39399968206defa78297222700cd18e7fd7e8244afa76d343406a01f657c86306453 0036-libphobos-add-riscv64-and-loongarch64-support.patch
8249ce989c1a76bcb5bbb1123ef88d88f220b709fe6ac804f18c905a7b31c4e68ef6f5cc2236f446feed89fa773a3aed996a6aba7618e73a000d73cb0b0753f6 0037-static-pie.patch
90b6148d47f39caf1b70416abf2a09f4ce048491f784f56bd659dbf99e2c9f6a44b244827f23977494ab4e42640c49c1dc79f43a4d69c2b31c4b1e25d54d8142 0038-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
a5e0082e492502385565479201bca3e9f5138a55d83540bff8b84a94d958c4d2afce474328656ee7d55fad910c04523c0068efe92382e68a327a65f6e641b88a gcc-15-20250719.tar.xz
fd5cebc5deb1d588583424acbc1b5a6d8d6f5b1bfa9f4bdbc082cfd406723f423d87011ee30e04ed18128a7ed8021cbfc9262becff5419125dc1afb6f407defa 0001-posix_memalign.patch
6634004cb9feea9ee0d063d6b6984d7db3b10c692b6139bb99169a4f2d74f0e10b5ca0ab31ce346ffef34b8eb9c3f536aa4d94bce1b27f8e0b8a9fc5cc4b7057 0002-gcc-poison-system-directories.patch
37e089791dbcbad73af866b662cda611dc0970d93e28251c7a9aa898db3b96446654e8b778d7866eb8550ba7f4a57cf22e8514d562bfed0c66613e65550d9c85 0003-specs-turn-on-Wl-z-now-by-default.patch
d4d5bfeb20a9fac968f37497d86d7eff4a9ac863e015dadbffae24c08236f5efde69b615d95191e2546672ce2d4b30d3627528c64a83fc64b715e8fa6fd4c372 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
b77cd1ee887fc52afee2fafd2d338f70a62c115017aa4fcb0ab9cf82b8a003794f75b7913cc153c767c351d2be8e1e7c113f893edee818217f20cad3cb6a2e66 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
af634de360e8b7aef285702815affb16da667719b786848ccdb9e4cca2a27826793f64c903a32a5d8ba1953965a5cc8999c58e2b6ce9ef36f74807e495cc9e42 0006-Enable-Wformat-and-Wformat-security-by-default.patch
21ad1cd4b7ef652ddaf6b9fb8071a87ec2fc694e8c420a79baf456347b8e1db5930a914c92a375943dda63d096c4823a2b8028d02a5b49c9bcdab5c170558004 0007-Enable-Wtrampolines-by-default.patch
dcd07ecf0daad8743a378abbcb921d4b17e528651a596454956563a3417fe9ea3b88dce7b15b9270f55ae2ea2a72efe8a7215236d0a21e2942c7c5ba0e8e2c39 0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch
488bd530e209e3213f83d695fb2ac529c408e3dba9024457594cfb0d266acb079447bca184fbf136bacd1f1ec5ca3607dc4998b66630af9781ea7ee41c16236b 0009-gcc-params-set-default-ssp-buffer-size-to-4.patch
7229a3fe655e8460148e0cd4c39d7362e713d1a6215530547f346371a5e3647245123637e8b075c58c5e7e35c823d96a0b3cdbedb6c07b5095507b4499bc053a 0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
f7c1870bda4d418380f471b520b7cf20fde743f57415323c1a8898a815f8c7023adc3882e1d0453c5b6fcb65a27a9534fdeb297bf451453a95d90c0395e42c3b 0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch
140c8165726404da0fc0ea01add2a7fa307377817968177334c520bdaabc23e8ec5d76f80337b89ff03edfd52dead7119433a03d2165e24780dc944633a9c2a3 0012-libiberty-copy-PIC-objects-during-build-process.patch
af848ef58b63a7592ad0f549be65fbe8dcd3c1e5ea9f30cfa65be02519ca9826d7612131c3b0042615b7537683d74eeb6849aba61810b0d8ed1c79f968188260 0013-libgcc_s.patch
c97b473c08b46090b48764af55b244ec70a13d26f2d881c57761abbc4a1c481da9766f33e59daee7188bc06c4631e53becbaf8801d0b35ca0b5fe84cb6a840f7 0014-nopie.patch
9c37cc38bb7238058751d3ff60712acd4134aa4c28d946c453b8b230bd6ba34c45c47a4b4d7e74aa7e3ed8dfc74cbb1d5a328bda706dd3037320e02a15421b86 0015-ada-fix-shared-linking.patch
b4afb30431ecdfd86acfd66ba857c275628b55e91cc9b21c18ca0e795b2fadfe895da801978a8e818ff9c93144075e72cf0521f3bce5c6c1d44e47e1b77b8ba4 0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
6260341ed13926ce449cf351ada85d8e28fc7da63a4ae73b69c24fb2e8d0e3003ffacb1bb0f957185b8d5d7e013f777f7f696c9a1c94b2204a9b3e8274ec2f43 0017-add-fortify-headers-paths.patch
8fe954daf7e9b1d221f0536f54186bc1715e23cf3c74dfd0956c0fa22ce3b5b5e30b5e17ea584db1cc193ac7fdc72daff68c9163dbc46a837e01d25a7a4a90e0 0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
fc5ce12cd70382b15317931ff0f57ae1ed10e8c09dbf2fee627bc55a268f55ebbf9ae32b89b4ef6f51e9a9b7ca32eed201245d481cde88f6eb572d40134f5f4c 0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
e0d4fd0e0bf4ecfb517b60b55d73f326deda0faa75bfd07d1fcae116f91088a96caaa2dd20e2e38a93cc8ffed0aef422c0c861879c8de406364faef0cbcd50ff 0020-aarch64-disable-multilib-support.patch
7af318ea6fe14dce98b8db1f8f46a2dc9f75c2f27e63a52c62c7b47d6d62cb64748d5c2690eba772d931ff96ac089e3f03bf46b49122ffb5a03a1c186f01ae11 0021-s390x-disable-multilib-support.patch
b96dbbd0e1aa98ebc2e7eaa2a44912681e4c8bc9a129fafa53a943d67b62451b6d4fad53f92429cd4346a753527359c8c09d58836cf0968a56f5fe933496a412 0022-ppc64-le-disable-multilib-support.patch
60106cb08f27c89509ba46dc2ff0edecc1f4c7973874c85047dfdd67eabe50e3a852d7540002a09bcb6185c786a5daeba7915958c441fc92d7f16a0cce5bcdea 0023-x86_64-disable-multilib-support.patch
d55d65242af9341eef7f1e3d03fec2e2de75632a23ed83df4fe6304619f62127b42eba9d9286f7f3647e3b9bd95aaeb79023263e71ff9d58c47f3051b73d8bc2 0024-riscv-disable-multilib-support.patch
b6dda179cafbd9e7f3ef7e137b303a76491a0157d68f1504dee6611cecdca16d27ca32cbd2298da2f6301e7167b8730d70a775ee5ba88ae3773adef8421efa98 0025-always-build-libgcc_eh.a.patch
95245b6548ddca5065bac06131294028767a32740c80f707a4d1cf8653a0398305ec68e7c44a3f2912741b792d41048f03729657b0a1c1a2a7bff097c6b2fdc7 0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch
ff6b8b9e1ab9b45d1853e74befb5c904cf7cd83dadb5a4b6f8c94a75e6249d1cdaa72aef73d6b1045beabc2d9012ea869d886015ec3aae561eb4ba8b9d00c2d7 0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch
0582f00e8801df06e51fca45a8dc3ee62e9b6ce9245af98937f435c90c709edc7eb9071569c0e59c9a143d964fe5731b9e11b011174443b97043abddc9db1cce 0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch
8683314212c0a6f49ed45ea8c74908f59d863822fa8c99e94c7e39ba3a642ca6a3167543e1ae4b58d8acd1ff97824d6e60cc432b19e6580cad2027e3a5c37603 0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch
60bb67f6cf4b92243dec861fba702aa5847925bf413c2c83705a0ee4ebe4c523cc295cce29666c69c9b2dec70d63def83cd9074e613b4f46e014248f53c87db4 0030-configure-fix-detection-of-atomic-builtins-in-libato.patch
b49f72cce409f74407761fe64b028e97d58e4f236af7d9099189a8553f2ece3f30559760fab768f3d1fc4c7f89ae3ee6d687018251f3df52c9a43817c9c7c93e 0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch
0bd3aa81590d5f47205e193d2998bb5986cbb82adb75e3d39dcf820625bb358d380d1695ebbb18437fdd935ce350b0f5b7364a5fa7c8e07ebe8f972c8cd46cd1 0032-gdc-unconditionally-link-libgphobos-against-libucont.patch
e8d5c4159f41fcb09e76758768d127ff366c93095137b694a405e9dbba88f2036ba64b69ac6c5c75e488be3281a1227cccbadcea2bef6f60ba0be7fc3d7db754 0033-druntime-link-against-libucontext-on-all-platforms.patch
6f530cdb1935296925ec29be7a30e4d69cebc155695db6ea30ee95ce65de7e8917e2a6148d3668974715120e7f13f734e5c36bfd35f707f4725a7556cbc1caa5 0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch
1dabb0c8d581ec86d8758dfa3d2f1713d915f6d927639f56b3590ed9b0885dfdf452e30ca87edac49721d2dc43d4fbdb4d178f8448e8ba5cc595457f216bf210 0035-libphobos-do-not-use-LFS64-symbols.patch
b915a0eaf7cc3e48f41f31ebbd9142760891b9ede304ff3f1dc7166f85a9e3f82017a17bb7e65824d3da07445b2c8bcd156a992eed92633362c08329b04b6cb4 0036-libgo-fix-lfs64-use.patch
0164467e66719187b6041c8d2d717a9bcd5b8c801dab6391b0e503c41e26518cc78389c97bdd2b2bc64f660f95410439aaa8a20799ec01eab17e7ba415ac1dd9 0037-loongarch-disable-multilib-support.patch
2cae2cb470b2cf469973c0ff3a7a020960cf4325502ff6c84c6b1b3514c8cacfae8452b5c79b55e657b0877fc9d81cc68db6f650156ca6d1376c1bd1a2290d8b 0038-static-PIE-ensure-static-reaches-the-linker.patch
7d73041566678fc86885877d8315481bf358858cbe54227356d5ab48623e435426ac7ff6e54d21b9fee4cc73e3f4bc7ef646d3e4ab1970e524c890cd1f735905 0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch
4556ead97907ec76aaa7dde450e4b6068f87268c49168eeb2af0c3df1dfa312b0a4a947b65b11fd413dae9af0beb3ef002d077c0d7f43b0bc466d3cd4348e657 0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch
389eacbeba976a461af3d087d732d1c4f2a38bc5db91b935149e60ad4b210286ba76688b8a947d00f324566b6789152bf3b93a188fa2fb7ee8042786df483fed 0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch
"

View file

@ -1,14 +1,14 @@
From 47b4bd4deb2c356bb07d2a96f22127aefafec3a4 Mon Sep 17 00:00:00 2001
From 94cf7d2b3514ed3a4401861a519ead450e022afc Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 01/35] posix_memalign
Subject: [PATCH] posix_memalign
---
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 3527283693b..c4071b64b53 100644
index d1d79a32fc9..069c3bb8324 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
@ -38,5 +38,5 @@ index 3527283693b..c4071b64b53 100644
else
return NULL;
--
2.41.0
2.50.1

View file

@ -1,7 +1,7 @@
From 4fa620d8c3e6730211bfb071eb4c817320491bd0 Mon Sep 17 00:00:00 2001
From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:59:00 +0400
Subject: [PATCH 02/35] gcc: poison-system-directories
Date: Thu, 23 Jan 2025 17:12:51 -0800
Subject: [PATCH] gcc: poison-system-directories
Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for
@ -11,23 +11,25 @@ aborted.
Instead, we add the two missing items to the current scan. If the user
wants this to be a failure, they can add "-Werror=poison-system-directories".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: sunil dora <sunilkumar.dora@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
gcc/configure | 16 ++++++++++++++++
gcc/configure.ac | 10 ++++++++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 2 ++
gcc/incpath.cc | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
gcc/gcc.cc | 12 ++++++++++--
gcc/incpath.cc | 25 +++++++++++++++++++++++++
7 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index e3fa0dacec4..bea1adc0940 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -715,6 +715,10 @@ Wreturn-local-addr
@@ -729,6 +729,10 @@ Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable.
@ -38,9 +40,11 @@ Upstream-Status: Pending
Wshadow
Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global.
diff --git a/gcc/config.in b/gcc/config.in
index a79c51adb2b..8a531ed591c 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -249,6 +249,12 @@
@@ -249,6 +249,16 @@
#endif
@ -48,14 +52,20 @@ Upstream-Status: Pending
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index 16965953f05..0f4a5d52c30 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1050,6 +1050,7 @@ enable_maintainer_mode
@@ -1051,6 +1051,7 @@ enable_maintainer_mode
enable_link_mutex
enable_link_serialization
enable_version_specific_runtime_libs
@ -63,7 +73,7 @@ Upstream-Status: Pending
enable_plugin
enable_host_shared
enable_host_pie
@@ -1823,6 +1824,8 @@ Optional Features:
@@ -1828,6 +1829,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@ -72,7 +82,7 @@ Upstream-Status: Pending
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--enable-host-pie build host code as PIE
@@ -34082,6 +34085,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
@@ -34027,6 +34030,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
@ -83,47 +93,60 @@ Upstream-Status: Pending
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+if test "x${enable_poison_system_directories}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9f67e62950a..b0e3615e5aa 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7555,6 +7555,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
@@ -7502,6 +7502,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [warn for use of native system header directories (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 72009c33cd0..29aea724731 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -391,6 +391,7 @@ Objective-C and Objective-C++ Dialects}.
@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
-Wrestrict -Wno-return-local-addr -Wreturn-type
-Wno-scalar-storage-order -Wsequence-point
@@ -8861,6 +8862,14 @@ made up of data only and thus requires no special treatment. But, for
most targets, it is made up of code and thus requires the stack to be
made executable in order for the program to work properly.
-Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor
-Wno-psabi
-Wredundant-decls -Wrestrict
@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default.
Suppress warnings from casts from a pointer to an integer type of a
different size.
+@opindex Wno-poison-system-directories
+@item -Wno-poison-system-directories
@ -133,12 +156,27 @@ Upstream-Status: Pending
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@opindex Wfloat-equal
@opindex Wno-float-equal
@item -Wfloat-equal
@opindex Winvalid-pch
@opindex Wno-invalid-pch
@item -Winvalid-pch
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4fd87f2c4a1..79d4920a047 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1163,6 +1163,8 @@ proper position among the other output files. */
@@ -909,6 +909,12 @@ proper position among the other output files. */
#define ASM_MAP ""
#endif
+#ifdef POISON_BY_DEFAULT
+#define POISON_IS_ERROR " -Werror=poison-system-directories"
+#else
+#define POISON_IS_ERROR
+#endif
+
/* Assembler options for compressed debug sections. */
#if HAVE_LD_COMPRESS_DEBUG == 0
/* Reject if the linker cannot write compressed debug sections. */
@@ -1166,6 +1172,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@ -147,6 +185,26 @@ Upstream-Status: Pending
%{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1268,7 +1276,7 @@ static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
%{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
@@ -1297,7 +1305,7 @@ static const char *cc1_options =
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
- %{pthread:-fprofile-update=prefer-atomic}}}";
+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
static const char *asm_options =
"%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index c1bbfd3872a..2cdbebc4c50 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -26,6 +26,7 @@
@ -157,9 +215,20 @@ Upstream-Status: Pending
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head,
cur->name, xstrerror (errno));
reason = REASON_NOENT;
}
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ pcur = &cur->next;
+ continue;
+#endif
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0,
@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
fprintf (stderr, _("End of #embed search list.\n"));
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
@ -168,19 +237,22 @@ Upstream-Status: Pending
+ struct cpp_dir *p;
+
+ for (p = heads[INC_QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.50.1

View file

@ -1,7 +1,7 @@
From ff4dd4ce33133e675b7bedc86b73357c04631cb9 Mon Sep 17 00:00:00 2001
From 90e8697dd88fd99ce2cf8739e95494853005377e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:45:49 +0000
Subject: [PATCH 03/35] specs: turn on -Wl,-z,now by default
Subject: [PATCH] specs: turn on -Wl,-z,now by default
Previously, we also used to turn on -z relro here, but we now build
binutils with --enable-relro, which is functionally equivalent.
@ -13,9 +13,11 @@ now by default.
gcc/gcc.cc | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 29aea724731..6fb3ab70cc7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -18935,6 +18935,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
@@ -19477,6 +19477,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
@ -25,9 +27,11 @@ now by default.
@opindex u
@item -u @var{symbol}
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 79d4920a047..74a356fdf5e 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1161,6 +1161,7 @@ proper position among the other output files. */
@@ -1170,6 +1170,7 @@ proper position among the other output files. */
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
@ -35,3 +39,6 @@ now by default.
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{Wno-poison-system-directories:--no-poison-system-directories} \
--
2.50.1

View file

@ -1,17 +1,19 @@
From 1b315235433701e4a974da259b8d651169ddc7ac Mon Sep 17 00:00:00 2001
From 17c9cf9272077bc7ac784daffd4c68ba1ce67a0d Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:22 +0000
Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC,
ObjC++, if the optimization level is > 0
---
gcc/c-family/c-cppbuiltin.cc | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc
index 4589ee4a3a6..9edf095384c 100644
--- a/gcc/c-family/c-cppbuiltin.cc
+++ b/gcc/c-family/c-cppbuiltin.cc
@@ -1570,6 +1570,10 @@ c_cpp_builtins (cpp_reader *pfile)
@@ -1581,6 +1581,10 @@ c_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
@ -22,9 +24,11 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 6fb3ab70cc7..799ce073dbf 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -12496,6 +12496,12 @@ also turns on the following optimization flags:
@@ -12840,6 +12840,12 @@ also turns on the following optimization flags:
Please note the warning under @option{-fgcse} about
invoking @option{-O2} on programs that use computed gotos.
@ -37,3 +41,6 @@ Subject: [PATCH 04/35] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
@opindex O3
@item -O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.50.1

View file

@ -1,8 +1,8 @@
From 67c0f5789630b27149f60ff831999ef7c1dba5d5 Mon Sep 17 00:00:00 2001
From a59da582e83071de0566274d912ca6f05f4b75d0 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:46:56 +0000
Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
Subject: [PATCH] On linux targets pass --as-needed by default to the linker,
but always link the sanitizer libraries with --no-as-needed.
---
gcc/config/aarch64/aarch64-linux.h | 1 +
@ -21,9 +21,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
gcc/gcc.cc | 28 ++++++++++++++++++++--------
14 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 116bb4e69f3..daf99f8dce9 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
@@ -39,6 +39,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
@ -31,6 +33,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index 3fd3b831166..0b4c2dccebe 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see
@ -42,6 +46,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index d4d389e2aa8..adccc0b11c2 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
@ -52,6 +58,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 4c4e31efa39..3c17ac6eade 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -78,6 +86,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
#endif
#undef TARGET_F951_OPTIONS
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index 7abfda53049..ceb8f855b7d 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
@ -89,6 +99,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{!static-pie: \
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index abe714711bf..3ca128a79f5 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@ -99,6 +111,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index a2494c214c4..e1a5d530cdf 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
@ -110,6 +124,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5a82508c113..6eee7cdc603 100644
--- a/gcc/config/mips/gnu-user.h
+++ b/gcc/config/mips/gnu-user.h
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see
@ -120,6 +136,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 9060c940a44..282c77b6a7b 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
@ -130,6 +148,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
-melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
-X \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 0316d8cb65d..139e1b6796c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -378,13 +378,13 @@ extern int dot_symbols;
@ -148,6 +168,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index afb5c6ad867..b64638fb25b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -781,7 +781,7 @@ GNU_USER_TARGET_CC1_SPEC
@ -159,6 +181,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 2c3bca5dfcb..b90661247a4 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see
@ -170,6 +194,8 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{shared:-shared} \
%{!shared: \
%{static:-static} \
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 6d928846895..3cc05bb7240 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
@ -181,9 +207,11 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 74a356fdf5e..fc9c7d15b04 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -771,8 +771,11 @@ proper position among the other output files. */
@@ -774,8 +774,11 @@ proper position among the other output files. */
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -197,7 +225,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -807,8 +810,11 @@ proper position among the other output files. */
@@ -810,8 +813,11 @@ proper position among the other output files. */
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -211,7 +239,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -825,8 +831,11 @@ proper position among the other output files. */
@@ -828,8 +834,11 @@ proper position among the other output files. */
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
@ -225,7 +253,7 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -841,8 +850,11 @@ proper position among the other output files. */
@@ -844,8 +853,11 @@ proper position among the other output files. */
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
@ -239,3 +267,6 @@ Subject: [PATCH 05/35] On linux targets pass --as-needed by default to the
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.50.1

View file

@ -1,15 +1,17 @@
From bb25e8489384504cd59e4a2538720863da1fb29c Mon Sep 17 00:00:00 2001
From 35c02ea8267e193b92f30495c94ee1e8e5c2be8e Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:47:43 +0000
Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Subject: [PATCH] Enable -Wformat and -Wformat-security by default.
---
gcc/c-family/c.opt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 75b6531860e..78830ce4b42 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -774,7 +774,7 @@ Warn about function calls with format strings that write past the end
@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end
of the destination region.
Wformat-security
@ -18,7 +20,7 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about possible security problems with format functions.
Wformat-signedness
@@ -799,7 +799,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
@@ -830,7 +830,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
@ -27,3 +29,6 @@ Subject: [PATCH 06/35] Enable -Wformat and -Wformat-security by default.
Warn about printf/scanf/strftime/strfmon format string anomalies.
Wframe-address
--
2.50.1

Some files were not shown because too many files have changed in this diff Show more