cross/gcc-*: upgrade to 10.2.0-r1

This commit is contained in:
Oliver Smith 2020-08-21 12:18:02 +02:00
parent ffec01ac09
commit c9d1d5e53b
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
150 changed files with 3087 additions and 8499 deletions

View File

@ -1,14 +1,14 @@
From 65eb86f3e110998d30489df009d44b4bc1043adc Mon Sep 17 00:00:00 2001
From 399f9e74a691ca6272d460d72d1b47afcad84752 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 02/12] posix_memalign
Subject: [PATCH 01/28] 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 ffbb7f82cf5..b0b890d2403 100644
index 87344d9383f..ece428df487 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
@ -38,5 +38,5 @@ index ffbb7f82cf5..b0b890d2403 100644
else
return NULL;
--
2.17.1
2.27.0

View File

@ -1,11 +1,20 @@
From 48c670d2678e0323d88eb72205e039f393cabe05 Mon Sep 17 00:00:00 2001
From 0e993b1b9a33910193862d76facf34bdbe58ed01 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 03/39] gcc: poison-system-directories
Subject: [PATCH 02/28] 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
/usr/include, /sw/include and /opt/include and then triggered a failure and
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".
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [distribution: codesourcery]
Upstream-Status: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
@ -13,14 +22,14 @@ Upstream-Status: Inappropriate [distribution: codesourcery]
gcc/configure.ac | 10 ++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.c | 2 ++
gcc/incpath.c | 19 +++++++++++++++++++
7 files changed, 66 insertions(+)
gcc/incpath.c | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
diff --git a/gcc/common.opt b/gcc/common.opt
index d6ef85928f3..7b29efe3882 100644
index 3ec7743eae8..d3c3e51dcb0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -679,6 +679,10 @@ Wreturn-local-addr
@@ -682,6 +682,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.
@ -32,10 +41,10 @@ index d6ef85928f3..7b29efe3882 100644
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 5bccb408016..1c784a8276b 100644
index 364eba47737..9551c0dfdf9 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -194,6 +194,12 @@
@@ -224,6 +224,12 @@
#endif
@ -49,10 +58,10 @@ index 5bccb408016..1c784a8276b 100644
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 5c345ce0fd7..cafd05fd150 100755
index eb6061c1631..90e3be864f8 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -953,6 +953,7 @@ with_system_zlib
@@ -1010,6 +1010,7 @@ with_system_zlib
enable_maintainer_mode
enable_link_mutex
enable_version_specific_runtime_libs
@ -60,7 +69,7 @@ index 5c345ce0fd7..cafd05fd150 100755
enable_plugin
enable_host_shared
enable_libquadmath_support
@@ -1696,6 +1697,8 @@ Optional Features:
@@ -1766,6 +1767,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@ -69,7 +78,7 @@ index 5c345ce0fd7..cafd05fd150 100755
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--disable-libquadmath-support
@@ -29715,6 +29718,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
@@ -30266,6 +30269,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
@ -90,10 +99,10 @@ index 5c345ce0fd7..cafd05fd150 100755
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 65dbf1f2f80..dd5b38195ce 100644
index 715fcba0482..f42006e5476 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6341,6 +6341,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
@@ -6600,6 +6600,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
@ -111,18 +120,18 @@ index 65dbf1f2f80..dd5b38195ce 100644
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 255149fcfb8..cb71b60fe3c 100644
index a2794a67d1e..dfed8fd25a8 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -303,6 +303,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
-Wparentheses -Wno-pedantic-ms-format @gol
-Wplacement-new -Wplacement-new=@var{n} @gol
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol
-Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
-Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
@@ -5712,6 +5713,14 @@ made up of data only and thus requires no special treatment. But, for
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
-Wrestrict -Wno-return-local-addr -Wreturn-type @gol
-Wno-scalar-storage-order -Wsequence-point @gol
@@ -6924,6 +6925,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.
@ -138,11 +147,11 @@ index 255149fcfb8..cb71b60fe3c 100644
@opindex Wfloat-equal
@opindex Wno-float-equal
diff --git a/gcc/gcc.c b/gcc/gcc.c
index a716f708259..02b3cd39fc2 100644
index 9f790db0daf..b2200c5185a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1061,6 +1060,8 @@
"-z relro -z now " \
@@ -1041,6 +1041,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}}} \
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
@ -151,7 +160,7 @@ index a716f708259..02b3cd39fc2 100644
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
diff --git a/gcc/incpath.c b/gcc/incpath.c
index b11c6a57939..e3b7a21966f 100644
index 8a2bda00f80..9098ab044ab 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -26,6 +26,7 @@
@ -190,5 +199,5 @@ index b11c6a57939..e3b7a21966f 100644
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.17.0
2.27.0

View File

@ -0,0 +1,39 @@
From a35a55940c3402f8ebb510ec7d8bc67e85051277 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/28] Turn on -Wl,-z,relro,-z,now by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index dfed8fd25a8..ca56d52cb05 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14638,6 +14638,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}.
+NOTE: In Alpine Linux, for LDFLAGS, the option
+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b2200c5185a..625c9ab7902 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1039,6 +1039,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 \
+ "-z relro -z now " \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{Wno-poison-system-directories:--no-poison-system-directories} \
--
2.27.0

View File

@ -1,16 +1,34 @@
# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
# DP: if the optimization level is > 0
From d2865d0a184ef59be8893dd34edf5037c4bf48f7 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/28] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
---
gcc/doc/invoke.texi | 6 ++++++
gcc/c-family/c-cppbuiltin.c | 3 +
2 files changed, 9 insertions(+), 0 deletions(-)
gcc/c-family/c-cppbuiltin.c | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
Index: b/gcc/doc/invoke.texi
===================================================================
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index db91a36794a..ed976c71404 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1385,6 +1385,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);
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
+
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ca56d52cb05..f5d5a1d1542 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7840,6 +7840,12 @@ also turns on the following optimization
@@ -9228,6 +9228,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.
@ -23,18 +41,6 @@ Index: b/gcc/doc/invoke.texi
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified
Index: b/gcc/c-family/c-cppbuiltin.c
===================================================================
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1176,6 +1176,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);
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
+
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
--
2.27.0

View File

@ -1,71 +1,68 @@
# DP: On linux targets pass --as-needed by default to the linker, but always
# DP: link the sanitizer libraries with --no-as-needed.
From 872e0a15a2b74cd6b6ba58e2e7e1605543ea36bd 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/28] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -692,8 +692,11 @@ proper position among the other output f
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lasan " \
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -710,8 +713,11 @@ proper position among the other output f
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -ltsan " \
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -728,8 +734,11 @@ proper position among the other output f
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -llsan " \
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -744,8 +753,11 @@ proper position among the other output f
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lubsan " \
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
Index: b/gcc/config/gnu-user.h
===================================================================
---
gcc/config/aarch64/aarch64-linux.h | 1 +
gcc/config/alpha/linux-elf.h | 2 +-
gcc/config/arm/linux-elf.h | 1 +
gcc/config/gnu-user.h | 6 +++---
gcc/config/i386/gnu-user.h | 2 +-
gcc/config/i386/gnu-user64.h | 1 +
gcc/config/ia64/linux.h | 2 +-
gcc/config/mips/gnu-user.h | 1 +
gcc/config/riscv/linux.h | 1 +
gcc/config/rs6000/linux64.h | 4 ++--
gcc/config/rs6000/sysv4.h | 2 +-
gcc/config/s390/linux.h | 2 +-
gcc/config/sparc/linux.h | 2 +-
gcc/gcc.c | 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 e587e2e9ad6..1d1017aa523 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
+ --as-needed \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index e25fcac3c59..22b2f7b0d14 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
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index 0ec3aa53189..f8bda84de2a 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
%{rdynamic:-export-dynamic} \
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
+ --as-needed \
%{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 ff2e880b1fa..7f30c363e4a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -161,15 +161,15 @@ see the files COPYING3 and COPYING.RUNTI
@@ -136,17 +136,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
"%{static-libasan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
@ -84,20 +81,35 @@ Index: b/gcc/config/gnu-user.h
- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#endif
Index: b/gcc/config/aarch64/aarch64-linux.h
===================================================================
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
+ --as-needed \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
Index: b/gcc/config/ia64/linux.h
===================================================================
#undef TARGET_F951_OPTIONS
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index ae4aa844f02..54b91c0492a 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3. If not see
{ "link_emulation", GNU_USER_LINK_EMULATION },\
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
%{!shared: \
%{!static: \
%{!static-pie: \
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 785c68220b8..21dd66b412a 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
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
+ --as-needed \
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index ee38e218aec..0325971d818 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
@ -109,37 +121,35 @@ Index: b/gcc/config/ia64/linux.h
%{shared:-shared} \
%{!shared: \
%{!static: \
Index: b/gcc/config/sparc/linux.h
===================================================================
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5d0782100bb..4be5fbb2191 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
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips*} %{shared} \
+ -as-needed \
%{!shared: \
%{!static: \
Index: b/gcc/config/s390/linux.h
===================================================================
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3.
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 4afef7c228c..ba1a6e60e05 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
"%{mabi=ilp32:_ilp32}"
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
Index: b/gcc/config/rs6000/linux64.h
===================================================================
#define LINK_SPEC "\
+-as-needed \
-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
%{shared} \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 2ded3301282..a1e44ddcc0d 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -490,13 +490,13 @@ extern int dot_symbols;
@@ -457,13 +457,13 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
@ -155,90 +165,105 @@ Index: b/gcc/config/rs6000/linux64.h
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
Index: b/gcc/config/rs6000/sysv4.h
===================================================================
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 9ade72114e9..9490b84a153 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -811,7 +811,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
MUSL_DYNAMIC_LINKER)
@@ -789,7 +789,7 @@ GNU_USER_TARGET_CC1_SPEC
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
#endif
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
Index: b/gcc/config/i386/gnu-user64.h
===================================================================
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -56,6 +56,7 @@
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
+ --as-needed \
%{shared:-shared} \
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 6919b468f06..56d52d41b31 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
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 81201e67a2f..6477d7ec52e 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -87,7 +87,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
Index: b/gcc/config/i386/gnu-user.h
===================================================================
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.
{ "link_emulation", GNU_USER_LINK_EMULATION },\
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
%{!shared: \
%{!static: \
%{!static-pie: \
Index: b/gcc/config/alpha/linux-elf.h
===================================================================
--- 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.
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
Index: b/gcc/config/arm/linux-elf.h
===================================================================
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
%{rdynamic:-export-dynamic} \
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
+ --as-needed \
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
Index: b/gcc/config/mips/gnu-user.h
===================================================================
--- 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.
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips*} %{shared} \
+ -as-needed \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
Index: b/gcc/config/riscv/linux.h
===================================================================
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -58,6 +58,7 @@
"%{mabi=ilp32:_ilp32}"
#define LINK_SPEC "\
+-as-needed \
-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
%{shared} \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 625c9ab7902..7aec9d3a016 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -695,8 +695,11 @@ proper position among the other output files. */
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lasan " \
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -713,8 +716,11 @@ proper position among the other output files. */
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -ltsan " \
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -731,8 +737,11 @@ proper position among the other output files. */
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -llsan " \
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -747,8 +756,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
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lubsan " \
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.27.0

View File

@ -1,9 +1,18 @@
Enable -Wformat and -Wformat-security by default.
From 5e20872b8cc916cb457c63c6cd970c4fcba47bbb 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/28] Enable -Wformat and -Wformat-security by default.
--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.000000000 +0100
+++ b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200
@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit
Warn about format strings that are not literals.
---
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 c49da99d395..93f25319005 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -599,7 +599,7 @@ Warn about function calls with format strings that write past the end
of the destination region. Same as -Wformat-overflow=1.
Wformat-security
-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
@ -11,7 +20,7 @@ Enable -Wformat and -Wformat-security by default.
Warn about possible security problems with format functions.
Wformat-signedness
@@ -475,7 +475,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_l
@@ -620,7 +620,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
@ -19,4 +28,7 @@ Enable -Wformat and -Wformat-security by default.
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
Warn about printf/scanf/strftime/strfmon format string anomalies.
Wignored-qualifiers
Wformat-overflow=
--
2.27.0

View File

@ -0,0 +1,25 @@
From 1bcf7e30226852db956becebaffdfe2738923423 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/28] 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 d3c3e51dcb0..7b68397c232 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -774,7 +774,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtype-limits
--
2.27.0

View File

@ -0,0 +1,53 @@
From 23fd86ff34670873dd294bd87b93f45c3624903a 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/28] Disable ssp on -nostdlib, -nodefaultlibs and
-ffreestanding Change the buffer size.
---
gcc/gcc.c | 8 +++++++-
gcc/params.opt | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7aec9d3a016..daeb4d0c8ea 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -886,6 +886,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" \
@@ -1170,7 +1176,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
diff --git a/gcc/params.opt b/gcc/params.opt
index 4aec480798b..eaecfab37ad 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -853,7 +853,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.27.0

View File

@ -1,26 +0,0 @@
From b693804c8dba92fea7beee98f0aa520853a0532b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Thu, 22 Dec 2016 11:22:28 +0000
Subject: [PATCH 08/12] s390x muslldso
---
gcc/config/s390/linux.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 525c17c2c9f..2d4f4a0654e 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -76,6 +76,9 @@ along with GCC; see the file COPYING3. If not see
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
+
#undef LINK_SPEC
#define LINK_SPEC \
"%{m31:-m elf_s390}%{m64:-m elf64_s390} \
--
2.17.1

View File

@ -1,4 +1,8 @@
Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
From d27d7936ecd9f357a3c6ee05e6548f8a68fdd4b7 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/28] Ensure that msgfmt doesn't encounter problems during
gcc bootstrapping.
Solves error messages like the following:
@ -16,10 +20,16 @@ library path, will make it work as expected here.
References:
https://bugs.gentoo.org/372377
https://bugs.gentoo.org/295480
---
libstdc++-v3/po/Makefile.am | 1 +
libstdc++-v3/po/Makefile.in | 1 +
2 files changed, 2 insertions(+)
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
@@ -39,6 +39,7 @@ MSGFMT = msgfmt
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
index a9391d8d167..f7eee24dc8c 100644
--- a/libstdc++-v3/po/Makefile.am
+++ b/libstdc++-v3/po/Makefile.am
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
.po.mo:
@ -27,9 +37,11 @@ https://bugs.gentoo.org/295480
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index a0f84b0cfa0..ab24a47a2fd 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -548,6 +548,7 @@ uninstall-am:
.po.mo:
@ -37,3 +49,6 @@ https://bugs.gentoo.org/295480
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--
2.27.0

View File

@ -0,0 +1,28 @@
From 2ec258d6d31e2c0c614c5086acee84a87768a67c 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/28] 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 141cb886a85..fa0e78eb62f 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -645,8 +645,11 @@ extern int pwait (int, int *, int);
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
+#ifndef asprintf
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
+#endif
/* Like asprintf but allocates memory without fail. This works like
xmalloc. */
--
2.27.0

View File

@ -1,76 +0,0 @@
From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 28 Feb 2018 00:54:05 +0000
Subject: [PATCH 10/12] ldbl128 config
---
gcc/configure | 13 +++++++++++++
gcc/configure.ac | 16 ++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..07ff8597d48 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
else
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)
+
if test $glibc_version_major -gt 2 \
|| ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
gcc_cv_target_ldbl128=yes
@@ -29320,6 +29329,10 @@ else
&& gcc_cv_target_ldbl128=yes
fi
+
+ ;;
+ esac
+
fi
;;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..6c15ed898c0 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5971,13 +5971,25 @@ case "$target" in
AC_ARG_WITH(long-double-128,
[AS_HELP_STRING([--with-long-double-128],
[use 128-bit long double by default])],
- gcc_cv_target_ldbl128="$with_long_double_128",
+ gcc_cv_target_ldbl128="$with_long_double_128", [
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)]
[GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
[gcc_cv_target_ldbl128=no
grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
$target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
&& gcc_cv_target_ldbl128=yes
- ]])])
+ ]])]
+ [
+ ;;
+ esac
+ ])
;;
esac
if test x$gcc_cv_target_ldbl128 = xyes; then
--
2.17.1

View File

@ -0,0 +1,24 @@
From 4f6fd2272f57620da399d0f841fce12b9db3b2d1 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/28] 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 d6b302e02fd..fd39928546f 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -263,6 +263,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi
--
2.27.0

View File

@ -1,14 +1,17 @@
https://bugs.gentoo.org/508852
https://gcc.gnu.org/PR61164
From cef5e0336cfdf4afd0e01fa9e562f686b234697a Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:53:36 +0000
Subject: [PATCH 12/28] libitm: disable FORTIFY
2014-04-27 Magnus Granberg <zorry@gentoo.org>
#508852
* libitm/configure.tgt: Disable FORTIFY
---
libitm/configure.tgt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 04109160e91..107b957ece3 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
@@ -46,6 +46,16 @@ if test "$gcc_cv_have_tls" = yes ; then
esac
fi
@ -25,3 +28,6 @@ https://gcc.gnu.org/PR61164
# Map the target cpu to an ARCH sub-directory. At the same time,
# work out any special compilation flags as necessary.
case "${target_cpu}" in
--
2.27.0

View File

@ -1,107 +0,0 @@
From a4aa319f7c19e564dced3daeb7222c9315af936c Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 18 Aug 2018 23:58:45 +0000
Subject: [PATCH 12/12] static-pie
in gcc-8 -static means static non-pie, even if -pie or -static-pie
are specified, -static-pie can be used to build static pie.
in musl toolchains -static -pie always meant static pie, so this
patch fixes the link specs accordingly, the new -static-pie is just
an alias to -static -pie.
---
gcc/common.opt | 4 ++--
gcc/config/gnu-user.h | 12 +++++-------
gcc/config/rs6000/sysv4.h | 11 +++++------
gcc/gcc.c | 6 +++---
4 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index b52ef0b38c8..0ce5857e01d 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3197,11 +3197,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 8620de3e42d..235328a2642 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -76,8 +75,7 @@
"%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
fvtable-verify=std:vtv_end.o%s} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -133,7 +131,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#undef LINK_GCC_C_SEQUENCE_SPEC
diff --git a/gcc/gcc.c b/gcc/gcc.c
index eb1610ba8b0..87560afb03c 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -900,7 +900,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
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -924,12 +924,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}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC
--
2.17.1

View File

@ -1,19 +1,19 @@
From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001
From d31721459e363e49dfe0a7797300864d9cef92f0 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 3/6] libgcc_s
Subject: [PATCH 13/28] libgcc_s
---
gcc/config/i386/i386.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
gcc/config/i386/i386-expand.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3d044e8..82523e1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 6c759b01edf..8cf0e069e1c 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10948,10 +10948,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
@ -27,10 +27,10 @@ index 3d044e8..82523e1 100644
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 8c2248d..6c82f15 100644
index cf5f0884bb4..ed0381e7744 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
@@ -510,7 +510,7 @@ __cpu_indicator_init (void)
return 0;
}
@ -42,7 +42,7 @@ index 8c2248d..6c82f15 100644
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 11bb46e..4f47f7b 100644
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
@ -53,5 +53,5 @@ index 11bb46e..4f47f7b 100644
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
--
2.8.1
2.27.0

View File

@ -1,7 +1,7 @@
From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001
From f64f853eae3b390adbbc9b74a336d93918e6dca4 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 7 Nov 2015 02:08:05 +0000
Subject: [PATCH 5/6] nopie
Subject: [PATCH 14/28] nopie
---
gcc/configure | 27 +++++++++++++++++++++++++++
@ -9,10 +9,10 @@ Subject: [PATCH 5/6] nopie
2 files changed, 40 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 1c6e340..7e8b5d6 100755
index 90e3be864f8..951a093b459 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29390,6 +29390,33 @@ fi
@@ -30774,6 +30774,33 @@ fi
$as_echo "$gcc_cv_no_pie" >&6; }
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
@ -47,10 +47,10 @@ index 1c6e340..7e8b5d6 100755
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6c1dcd9..0ca7647 100644
index f42006e5476..fe392298016 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option],
@@ -6858,6 +6858,19 @@ AC_CACHE_CHECK([for -no-pie option],
LDFLAGS="$saved_LDFLAGS"])
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
@ -71,5 +71,5 @@ index 6c1dcd9..0ca7647 100644
AC_SUBST([NO_PIE_FLAG])
--
2.8.1
2.27.0

View File

@ -0,0 +1,25 @@
From 37dace030c1402a8e6734a0fc59e18717ce1a2ef Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:57:09 +0000
Subject: [PATCH 15/28] libffi: use __linux__ instead of __gnu_linux__ for musl
---
libffi/src/closures.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libffi/src/closures.c b/libffi/src/closures.c
index 721ff00ea43..22a699c6340 100644
--- a/libffi/src/closures.c
+++ b/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it
--
2.27.0

View File

@ -1,6 +1,16 @@
diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
--- a/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
From 7fc386a2e629e859968da4eb4d0ff4983cb3b76f Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:57:51 +0000
Subject: [PATCH 16/28] dlang: update zlib binding
---
libphobos/src/std/zlib.d | 266 ++++++++++++++++++++++++++++-----------
1 file changed, 196 insertions(+), 70 deletions(-)
diff --git a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
index e6cce240fd5..bd2fe37ebec 100644
--- a/libphobos/src/std/zlib.d
+++ b/libphobos/src/std/zlib.d
@@ -1,7 +1,7 @@
// Written in the D programming language.
@ -62,7 +72,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
*
* See_Also:
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] b
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] buf)
* buf = buffer containing input data
*
* Returns:
@ -89,7 +99,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
if (err)
{
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf,
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf, size_t destlen = 0u, int winbits = 15)
throw new ZlibException(err);
}
}
@ -172,7 +182,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
if (!inited)
{
@@ -598,26 +607,152 @@ class UnCompress
if (!destbufsize)
destbufsize = to!uint(buf.length) * 2;
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
@ -334,7 +344,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
/**
* Decompress and return any remaining data.
* The returned data should be appended to that returned by uncompress().
@@ -626,48 +761,39 @@ class UnCompress
@@ -626,49 +761,40 @@ class UnCompress
void[] flush()
in
{
@ -409,3 +419,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
+ assert(decompressor.empty, "The UnCompressor reports not being done");
}
}
--
2.27.0

View File

@ -1,29 +0,0 @@
Fixes errors such as:
GEGL-Message: 16:04:13.794: Module '/usr/lib/gegl-0.4/raw-load.so' load error: Error relocating /usr/lib/libgomp.so.1: __cxa_finalize: initial-exec TLS resolves to dynamic definition in /usr/lib/libgomp.so.1
--- a/libgomp/configure.tgt 2018-11-08 18:13:04.000000000 +0100
+++ b/libgomp/configure.tgt 2019-06-29 20:06:31.972950350 +0200
@@ -10,23 +10,6 @@
# XCFLAGS Add extra compile flags to use.
# XLDFLAGS Add extra link flags to use.
-# Optimize TLS usage by avoiding the overhead of dynamic allocation.
-if test $gcc_cv_have_tls = yes ; then
- case "${target}" in
-
- *-*-k*bsd*-gnu*)
- ;;
-
- *-*-linux* | *-*-gnu*)
- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
- ;;
-
- *-*-rtems*)
- XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
- ;;
- esac
-fi
-
# Since we require POSIX threads, assume a POSIX system by default.
config_path="posix"

View File

@ -0,0 +1,51 @@
From ef5f7880cff27a2b92952ce53a207d5dd896923b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:58:22 +0000
Subject: [PATCH 17/28] dlang: fix fcntl on mips, add libucontext dep
---
libphobos/configure.tgt | 1 +
libphobos/libdruntime/core/sys/posix/fcntl.d | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 94e42bf5509..73f2e4b7f01 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -35,6 +35,7 @@ case "${target}" in
;;
mips*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
power*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
index 9febcff849b..cb34e2108bd 100644
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -870,6 +870,21 @@ else version (CRuntime_Musl)
F_SETLKW = 7,
}
}
+ else version (MIPS_Any)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x008000, // octal 0100000
+ O_LARGEFILE = 0x002000, // octal 0020000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 33,
+ F_SETLK = 34,
+ F_SETLKW = 35,
+ }
+ }
else
static assert(0, "Platform not supported");
--
2.27.0

View File

@ -1,10 +1,19 @@
Index: b/gcc/ada/link.c
===================================================================
From b675e0383262d6d702f5b732e4459d3e2c2a4891 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:16 +0000
Subject: [PATCH 18/28] 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 02c413a412f..f0e52a87d6e 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -105,9 +105,9 @@
#elif defined (__FreeBSD__)
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|| defined (__NetBSD__) || defined (__OpenBSD__) \
|| defined (__QNX__)
const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
@ -15,9 +24,9 @@ Index: b/gcc/ada/link.c
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
@@ -127,9 +127,9 @@
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (linux) || defined(__GLIBC__)
#elif defined (__linux__) || defined (__GLIBC__)
const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
@ -28,3 +37,6 @@ Index: b/gcc/ada/link.c
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
--
2.27.0

View File

@ -0,0 +1,24 @@
From 0ea91dd6f8d856d5b589c2a3e95469fea06e7094 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:43 +0000
Subject: [PATCH 19/28] build: fix CXXFLAGS_FOR_BUILD passing
---
Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.in b/Makefile.in
index 36e369df6e7..63627db68cf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -170,6 +170,7 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
--
2.27.0

View File

@ -0,0 +1,32 @@
From 9684a815e1cbe854383c3c511e1d84d43c46ec94 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:00:17 +0000
Subject: [PATCH 20/28] libstdc++: futex: add time64 compatibility
---
libstdc++-v3/src/c++11/futex.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index c9de11a7ec7..7be702dbeda 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -61,7 +61,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+ struct
+ {
+ long tv_sec;
+ long tv_nsec;
+ } rt;
+#else
struct timespec rt;
+#endif
rt.tv_sec = __s.count() - tv.tv_sec;
rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
if (rt.tv_nsec < 0)
--
2.27.0

View File

@ -0,0 +1,25 @@
From a0708ec975c01b049d254dc51179898966bf8a52 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:01:06 +0000
Subject: [PATCH 21/28] 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 95654bcdb5a..d88df8f154a 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -167,6 +167,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else
--
2.27.0

View File

@ -0,0 +1,31 @@
From 740342a0e4b0b3af498964440918abba1a27ba33 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 22/28] 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.
---
gcc/gcc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index daeb4d0c8ea..6920bec0fa0 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -894,8 +894,7 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
--
2.27.0

View File

@ -1,10 +1,18 @@
# DP: Use --push-state/--pop-state for gold as well when linking libtsan.
From 775adf35d6f34f61947fc28a2bdbfa7e881c40d5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:03:42 +0000
Subject: [PATCH 23/28] DP: Use --push-state/--pop-state for gold as well when
linking libtsan.
Index: b/gcc/gcc.c
===================================================================
---
gcc/gcc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6920bec0fa0..40e07354b3d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -693,10 +693,10 @@ proper position among the other output f
@@ -696,10 +696,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 "}" \
@ -17,7 +25,7 @@ Index: b/gcc/gcc.c
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -714,10 +714,10 @@ proper position among the other output f
@@ -717,10 +717,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 "}" \
@ -30,7 +38,7 @@ Index: b/gcc/gcc.c
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -735,10 +735,10 @@ proper position among the other output f
@@ -738,10 +738,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 "}" \
@ -43,7 +51,7 @@ Index: b/gcc/gcc.c
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -754,10 +754,10 @@ proper position among the other output f
@@ -757,10 +757,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 "}" \
@ -56,3 +64,6 @@ Index: b/gcc/gcc.c
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.27.0

View File

@ -1,7 +1,7 @@
From b8c4e45d052adc247341066f748421743704b481 Mon Sep 17 00:00:00 2001
From 717090cf538f765db1730956c512a43f2d52a802 Mon Sep 17 00:00:00 2001
From: Nils Andreas Svee <me@lochnair.net>
Date: Thu, 21 Dec 2017 03:14:33 +0100
Subject: [PATCH] Pure 64-bit MIPS
Subject: [PATCH 24/28] Pure 64-bit MIPS
---
gcc/config/mips/mips.h | 8 ++++----
@ -9,10 +9,10 @@ Subject: [PATCH] Pure 64-bit MIPS
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 803ab98e7..afd74752f 100644
index 3ce0c19a29a..b9920b49167 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3330,11 +3330,11 @@ struct GTY(()) machine_function {
@@ -3424,11 +3424,11 @@ struct GTY(()) machine_function {
/* If we are *not* using multilibs and the default ABI is not ABI_32 we
need to change these from /lib and /usr/lib. */
#if MIPS_ABI_DEFAULT == ABI_N32
@ -29,7 +29,7 @@ index 803ab98e7..afd74752f 100644
/* Load store bonding is not supported by micromips and fix_24k. The
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
index 16c8adf85..bb46204db 100644
index ceb58d3b5f3..8116e23ebba 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
@ -43,5 +43,5 @@ index 16c8adf85..bb46204db 100644
+ ../lib32 \
+ ../lib
--
2.15.1
2.27.0

View File

@ -1,6 +1,36 @@
--- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000
+++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000
@@ -34,6 +34,6 @@
From f73cf8d2f8f4eee71fc2ba850672e69f509a4486 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:04:40 +0000
Subject: [PATCH 25/28] use pure 64-bit configuration where appropriate
---
gcc/config/aarch64/t-aarch64-linux | 2 +-
gcc/config/i386/t-linux64 | 4 ++--
gcc/config/rs6000/t-linux | 6 ++++--
gcc/config/rs6000/t-linux64 | 4 ++--
gcc/config/rs6000/t-linux64bele | 4 ++--
gcc/config/rs6000/t-linux64lebe | 4 ++--
gcc/config/s390/t-linux64 | 4 ++--
7 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index 83e59e33b85..6ec56fdf6a8 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 1171e218578..256f8c079ba 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -33,6 +33,6 @@
comma=,
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
@ -9,29 +39,10 @@
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
--- ./gcc/config/aarch64/t-aarch64-linux.orig
+++ ./gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
--- ./gcc/config/s390/t-linux64.orig
+++ ./gcc/config/s390/t-linux64
@@ -7,5 +7,5 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--- ./gcc/config/rs6000/t-linux.orig
+++ ./gcc/config/rs6000/t-linux
diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux
index aeb7440c492..ab14c455d8d 100644
--- a/gcc/config/rs6000/t-linux
+++ b/gcc/config/rs6000/t-linux
@@ -2,7 +2,8 @@
# or soft-float.
ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
@ -40,9 +51,9 @@
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
else
ifneq (,$(findstring spe,$(target)))
MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
@@ -14,7 +15,8 @@
MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
endif
@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target)))
MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
endif
ifneq (,$(findstring powerpc64le,$(target)))
@ -52,8 +63,10 @@
endif
endif
--- ./gcc/config/rs6000/t-linux64.orig
+++ ./gcc/config/rs6000/t-linux64
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 264a7e27524..d1e460811cc 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -28,8 +28,8 @@
MULTILIB_OPTIONS := m64/m32
MULTILIB_DIRNAMES := 64 32
@ -65,8 +78,10 @@
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
$(COMPILE) $<
--- ./gcc/config/rs6000/t-linux64bele.orig
+++ ./gcc/config/rs6000/t-linux64bele
diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele
index 97c1ee6fb4d..08d72639cb6 100644
--- a/gcc/config/rs6000/t-linux64bele
+++ b/gcc/config/rs6000/t-linux64bele
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mlittle
@ -76,8 +91,10 @@
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
--- ./gcc/config/rs6000/t-linux64lebe.orig
+++ ./gcc/config/rs6000/t-linux64lebe
diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe
index 2e63bdb9fc9..c6e1c5db65d 100644
--- a/gcc/config/rs6000/t-linux64lebe
+++ b/gcc/config/rs6000/t-linux64lebe
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mbig
@ -87,3 +104,18 @@
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64
index cc6ab367072..7f498ee1cdc 100644
--- a/gcc/config/s390/t-linux64
+++ b/gcc/config/s390/t-linux64
@@ -7,5 +7,5 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--
2.27.0

View File

@ -1,11 +1,20 @@
Highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
From 8472f6d0037dcd19c44b1e95d95fbf937b3823e6 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:05:41 +0000
Subject: [PATCH 26/28] always build libgcc_eh.a
diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
--- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100
+++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200
@@ -772,8 +772,9 @@
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
---
libgcc/Makefile.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 851e7657d07..99ec513a1a6 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -956,8 +956,9 @@ ifneq ($(LIBUNWIND),)
all: libunwind.a
endif
+all: libgcc_eh.a
@ -14,8 +23,8 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
+all: libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
@@ -950,10 +951,6 @@
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1159,10 +1160,6 @@ install-libunwind:
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
@ -26,9 +35,9 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -968,6 +965,10 @@
chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
@@ -1179,6 +1176,10 @@ ifeq ($(enable_gcov),yes)
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
endif
+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
@ -37,3 +46,6 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
--
2.27.0

View File

@ -1,7 +1,18 @@
diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads
--- gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads 2018-01-11 00:55:25.000000000 -0800
+++ gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads 2018-11-01 16:16:23.372452951 -0700
@@ -394,12 +394,6 @@ package System.OS_Interface is
From 4e1b3a26f558e7693853d3600ee677705e67406c Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:06:30 +0000
Subject: [PATCH 27/28] 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 80cb2b2a793..701b7a3aeab 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -399,12 +399,6 @@ package System.OS_Interface is
PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
@ -14,7 +25,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
function pthread_rwlock_init
(mutex : access pthread_rwlock_t;
attr : access pthread_rwlockattr_t) return int;
@@ -464,11 +458,6 @@ package System.OS_Interface is
@@ -466,11 +460,6 @@ package System.OS_Interface is
protocol : int) return int;
pragma Import (C, pthread_mutexattr_setprotocol);
@ -26,10 +37,11 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
type struct_sched_param is record
sched_priority : int; -- scheduling priority
end record;
diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb
--- gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb 2018-01-11 00:55:25.000000000 -0800
+++ gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb 2018-11-13 11:28:36.433964449 -0800
@@ -202,9 +202,6 @@ package body System.Task_Primitives.Oper
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index c45559e5ba0..0b0f173e7d4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -202,9 +202,6 @@ package body System.Task_Primitives.Operations is
pragma Import
(C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
@ -39,7 +51,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
-- 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.
@@ -214,38 +211,6 @@ package body System.Task_Primitives.Oper
@@ -214,38 +211,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.
@ -78,7 +90,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
-- 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,
@@ -348,7 +313,9 @@ package body System.Task_Primitives.Oper
@@ -348,7 +313,9 @@ package body System.Task_Primitives.Operations is
-- Init_Mutex --
----------------
@ -88,7 +100,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Mutex_Attr : aliased pthread_mutexattr_t;
Result, Result_2 : C.int;
@@ -360,16 +327,7 @@ package body System.Task_Primitives.Oper
@@ -360,16 +327,7 @@ package body System.Task_Primitives.Operations is
return Result;
end if;
@ -106,7 +118,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Result := pthread_mutexattr_setprotocol
(Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Oper
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Operations is
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
pragma Assert (Result = 0);
@ -118,3 +130,6 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
pragma Assert (Result in 0 | ENOMEM);
--
2.27.0

View File

@ -1,8 +1,69 @@
From 5e3d7d2f1e2448b6c5eb207f9251c437629e43bc Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 28/28] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 55ff9b0f3d5..0fadf4e4b79 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1533,7 +1533,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 \
@@ -2083,7 +2083,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-osinte.adb<libgnarl/s-osinte__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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2112,7 +2112,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 \
@@ -2305,7 +2305,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) \
system.ads<libgnat/system-linux-ia64.ads
@@ -2401,7 +2401,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) \
system.ads<libgnat/system-linux-x86.ads
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 3b0aea9..ee0bb69 100644
index 595abf87d65..00858c24f53 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -76,6 +76,11 @@
@@ -90,6 +90,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
@ -14,7 +75,7 @@ index 3b0aea9..ee0bb69 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3255,7 +3260,6 @@ __gnat_lwp_self (void)
@@ -3308,7 +3313,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
@ -22,7 +83,7 @@ index 3b0aea9..ee0bb69 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void)
@@ -3318,7 +3322,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
@ -31,7 +92,7 @@ index 3b0aea9..ee0bb69 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3278,33 +3282,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3331,33 +3335,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
@ -73,7 +134,7 @@ index 3b0aea9..ee0bb69 100644
}
size_t
@@ -3314,23 +3318,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3367,23 +3371,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
@ -103,7 +164,7 @@ index 3b0aea9..ee0bb69 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 0d12f7e..a063b47 100644
index 311e240dfcc..1c4d0050103 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void);
@ -124,56 +185,11 @@ index 0d12f7e..a063b47 100644
#endif
#if defined (_WIN32)
--- a/gcc/ada/Makefile.rtl 2019-05-14 21:18:45.217455681 +0200
+++ b/gcc/ada/Makefile.rtl 2019-05-14 21:21:30.686464218 +0200
@@ -1521,7 +1521,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
g-sercom.adb<libgnat/g-sercom__linux.adb \
- 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 \
@@ -2073,7 +2073,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2102,7 +2102,7 @@
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 \
@@ -2297,7 +2297,7 @@
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ia64.ads
@@ -2394,7 +2394,7 @@
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 \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
system.ads<libgnat/system-linux-x86.ads
--- a/gcc/ada/terminals.c 2019-01-08 10:54:04.000000000 +0100
+++ b/gcc/ada/terminals.c 2019-05-15 13:14:09.935742526 +0200
@@ -1136,7 +1136,7 @@
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index af4417fab90..bab6bf3ca87 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1145,7 +1145,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
/* 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)
@ -182,7 +198,7 @@ index 0d12f7e..a063b47 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1150,7 +1150,7 @@
@@ -1159,7 +1159,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
@ -191,7 +207,7 @@ index 0d12f7e..a063b47 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1199,8 +1199,8 @@
@@ -1208,8 +1208,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
@ -202,3 +218,6 @@ index 0d12f7e..a063b47 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.27.0

View File

@ -1,33 +0,0 @@
# Turn on -Wl,-z,relro,-z,now by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
Index: b/gcc/doc/invoke.texi
===================================================================
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
+NOTE: In Alpine Linux, for LDFLAGS, the option
+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -890,6 +890,7 @@ proper position among the other output f
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "-z relro -z now " \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\

View File

@ -1,13 +0,0 @@
Enable -Wtrampolines by default.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -712,7 +712,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtype-limits

View File

@ -1,38 +0,0 @@
Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding
Change the buffer size.
--- a/gcc/gcc.c 2017-07-04 09:15:57.740793000 +0200
+++ b/gcc/gcc.c 2018-03-02 13:58:44.387741114 +0100
@@ -857,6 +857,12 @@ proper position among the other output f
#define LINK_GCC_C_SEQUENCE_SPEC "%G %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" \
@@ -1131,7 +1148,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fprofile-generate*|coverage:\
%{!fprofile-update=singel:\
--- a/gcc/params.def 2016-03-30 09:47:40.000000000 +0200
+++ b/gcc/params.def 2016-09-19 12:56:58.443179039 +0200
@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
DEFPARAM (PARAM_SSP_BUFFER_SIZE,
"ssp-buffer-size",
"The lower bound for a buffer to be considered for stack smashing protection.",
- 8, 1, 0)
+ 4, 1, 0)
DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
"min-size-for-stack-sharing",

View File

@ -1,18 +0,0 @@
2008-07-25 Magnus Granberg <zorry@ume.nu>
* include/libiberty.h (asprintf): Don't declare if defined as a macro
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
+#ifndef asprintf
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
+#endif
#if !HAVE_DECL_VASPRINTF
/* Like vsprintf but provides a pointer to malloc'd storage, which

View File

@ -1,10 +0,0 @@
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi

View File

@ -1,18 +0,0 @@
libatomic build failure if configured with --disable-dependency-tracking
load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory
https://bugs.gentoo.org/463463
http://gcc.gnu.org/PR55930
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
PAT_S = $(word 3,$(PAT_SPLIT))
IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_FALSE@M_DEPS =
M_SIZE = -DN=$(PAT_N)
M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
M_FILE = $(PAT_BASE)_n.c

View File

@ -1,13 +0,0 @@
diff --git a/libffi/closures.c.orig b/libffi/closures.c
index 721ff00..22a699c 100644
--- a/libffi/src/closures.c.orig
+++ b/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
--- a/libphobos/libdruntime/core/sys/posix/config.d 2019-10-29 15:54:05.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/config.d 2019-10-29 15:54:08.000000000 +0900
@@ -67,15 +67,21 @@ version (CRuntime_Glibc)
}
else version (CRuntime_Musl)
{
+ // off_t is always 64 bits on Musl
enum _FILE_OFFSET_BITS = 64;
+ // Not present in Musl sources
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_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
- enum __WORDSIZE=64;
+ version (D_LP64)
+ enum __WORDSIZE = 64;
+ else
+ enum __WORDSIZE = 32;
}
else version (CRuntime_UClibc)
{

View File

@ -1,448 +0,0 @@
diff -Nurp a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
@@ -779,7 +779,102 @@ else version (CRuntime_Bionic)
}
else version (CRuntime_Musl)
{
- enum {
+ version (X86_64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0,
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ // Note: Definitions for i386 are in arch/generic/bits/fcntl.h
+ else version (X86)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0x008000, // octal 0100000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 12,
+ F_SETLK = 13,
+ F_SETLKW = 14,
+ }
+ }
+ else version (ARM)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x010000, // octal 0200000
+ O_LARGEFILE = 0x020000, // octal 0400000
+ O_TMPFILE = 0x404000, // octal 020040000
+
+ F_GETLK = 12,
+ F_SETLK = 13,
+ F_SETLKW = 14,
+ }
+ }
+ else version (AArch64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x010000, // octal 0200000
+ O_LARGEFILE = 0x020000, // octal 0400000
+ O_TMPFILE = 0x404000, // octal 020040000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else version (SystemZ)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0x008000, // octal 0100000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else version (PPC64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x020000, // octal 0400000
+ O_LARGEFILE = 0x010000, // octal 0200000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else
+ static assert(0, "Platform not supported");
+
+ enum
+ {
O_CREAT = 0x40, // octal 0100
O_EXCL = 0x80, // octal 0200
O_NOCTTY = 0x100, // octal 0400
@@ -790,16 +885,11 @@ else version (CRuntime_Musl)
O_DSYNC = 0x1000, // octal 010000
O_SYNC = 0x101000, // octal 04010000
O_RSYNC = O_SYNC,
- O_DIRECTORY = 0x10000,
- O_NOFOLLOW = 0x20000,
O_CLOEXEC = 0x80000,
O_ASYNC = 0x2000,
- O_DIRECT = 0x4000,
- O_LARGEFILE = 0,
O_NOATIME = 0x40000,
O_PATH = 0x200000,
- O_TMPFILE = 0x410000,
O_NDELAY = O_NONBLOCK,
O_SEARCH = O_PATH,
O_EXEC = O_PATH,
@@ -809,19 +899,19 @@ else version (CRuntime_Musl)
O_WRONLY = 01,
O_RDWR = 02,
}
- enum {
+ enum
+ {
F_DUPFD = 0,
F_GETFD = 1,
F_SETFD = 2,
F_GETFL = 3,
F_SETFL = 4,
- F_GETLK = 5,
- F_SETLK = 6,
- F_SETLKW = 7,
+ // F_GETLK, F_SETLK, F_SETLKW are arch-specific
F_SETOWN = 8,
F_GETOWN = 9,
}
- enum {
+ enum
+ {
F_RDLCK = 0,
F_WRLCK = 1,
F_UNLCK = 2,
diff -Nurp a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
@@ -143,8 +143,10 @@ else version (CRuntime_Bionic)
else version (CRuntime_Musl)
{
struct sem_t {
- int[4*long.sizeof/int.sizeof] __val;
+ int[4*c_long.sizeof/int.sizeof] __val;
}
+
+ enum SEM_FAILED = (sem_t*).init;
}
else version (CRuntime_UClibc)
{
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
@@ -1587,31 +1587,225 @@ else version (CRuntime_Musl)
S_ISGID = 0x400, // octal 02000
S_ISVTX = 0x200, // octal 01000
}
- struct stat_t {
- dev_t st_dev;
- ino_t st_ino;
- nlink_t st_nlink;
-
- mode_t st_mode;
- uid_t st_uid;
- gid_t st_gid;
- uint __pad0;
- dev_t st_rdev;
- off_t st_size;
- blksize_t st_blksize;
- blkcnt_t st_blocks;
-
- timespec st_atim;
- timespec st_mtim;
- timespec st_ctim;
- extern(D) @safe @property inout pure nothrow
- {
- ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
- ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
- ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ version (ARM)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int __st_dev_padding;
+ c_long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ ino_t st_ino;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (AArch64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ c_ulong __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ uint[2] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (X86_64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ uint __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+
+ c_long[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (X86)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int __st_dev_padding;
+ c_long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ ino_t st_ino;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
}
- long[3] __unused;
}
+ else version (MIPS64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int[3] __pad1;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ uint[2] __pad2;
+ off_t st_size;
+ int __pad3;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ blksize_t st_blksize;
+ uint __pad4;
+ blkcnt_t st_blocks;
+ int[14] __pad5;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (PPC64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ c_ulong[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (SystemZ)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ c_ulong[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else
+ static assert("Unsupported platform");
+
private
{
extern (D) bool S_ISTYPE( mode_t mode, uint mask )
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
@@ -112,8 +112,26 @@ version (CRuntime_Glibc)
}
else version (CRuntime_Musl)
{
- alias c_long blksize_t;
- alias c_ulong nlink_t;
+ version (AArch64)
+ {
+ alias int blksize_t;
+ alias uint nlink_t;
+ }
+ else version (MIPS64)
+ {
+ alias c_long blksize_t;
+ alias uint nlink_t;
+ }
+ else version (RISCV64)
+ {
+ alias int blksize_t;
+ alias uint nlink_t;
+ }
+ else
+ {
+ alias c_long blksize_t;
+ alias c_ulong nlink_t;
+ }
alias long dev_t;
alias long blkcnt_t;
alias ulong ino_t;

View File

@ -1,137 +0,0 @@
diff -Nurp a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
@@ -1084,7 +1084,9 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
// base offset
auto ti = tls_index(mod, 0);
- version (IBMZ_Any)
+ version (CRuntime_Musl)
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
+ else version (IBMZ_Any)
{
auto idx = cast(void *)__tls_get_addr_internal(&ti)
+ cast(ulong)__builtin_thread_pointer();
diff -Nurp a/libphobos/configure.ac b/libphobos/configure.ac
--- a/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
@@ -140,6 +140,14 @@ case ${host} in
esac
AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
+AC_MSG_CHECKING([if target needs to link in swapcontext])
+AC_MSG_RESULT($LIBDRUNTIME_NEEDS_UCONTEXT)
+AS_IF([test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes], [
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [], [
+ AC_MSG_ERROR([[can't find library providing swapcontext]])
+ ])
+])
+
# Decide if it's usable.
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
*:no) use_libphobos=no ;;
diff -Nurp a/libphobos/configure.tgt b/libphobos/configure.tgt
--- a/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
@@ -22,6 +22,13 @@
# Disable the libphobos or libdruntime components on untested or known
# broken systems. More targets shall be added after testing.
LIBPHOBOS_SUPPORTED=no
+
+# Check if we require 'ucontext' or if we have a custom solution.
+# Most platform uses a custom assembly solution for context switches,
+# see `core.thread` and grep for `AsmExternal`.
+# Definitions are in config/ARCH/
+LIBPHOBOS_NEEDS_UCONTEXT=no
+
case "${target}" in
aarch64*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
@@ -37,6 +44,7 @@ case "${target}" in
;;
s390*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
LIBPHOBOS_SUPPORTED=yes
diff -Nurp a/libphobos/configure b/libphobos/configure
--- a/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
@@ -13955,6 +13955,76 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target needs to link in swapcontext" >&5
+$as_echo_n "checking if target needs to link in swapcontext... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRUNTIME_NEEDS_UCONTEXT" >&5
+$as_echo "$LIBDRUNTIME_NEEDS_UCONTEXT" >&6; }
+if test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
+$as_echo_n "checking for library containing swapcontext... " >&6; }
+if ${ac_cv_search_swapcontext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char swapcontext ();
+int
+main ()
+{
+return swapcontext ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' c ucontext; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_swapcontext=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_swapcontext+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_swapcontext+:} false; then :
+
+else
+ ac_cv_search_swapcontext=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_swapcontext" >&5
+$as_echo "$ac_cv_search_swapcontext" >&6; }
+ac_res=$ac_cv_search_swapcontext
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+
+ as_fn_error $? "can't find library providing swapcontext" "$LINENO" 5
+
+fi
+
+
+fi
+
+
# Decide if it's usable.
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
*:no) use_libphobos=no ;;

View File

@ -1,34 +0,0 @@
--- gcc-9.3.0.orig/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ gcc-9.3.0/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -870,6 +870,21 @@
F_SETLKW = 7,
}
}
+ else version (MIPS_Any)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x008000, // octal 0100000
+ O_LARGEFILE = 0x002000, // octal 0020000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 33,
+ F_SETLK = 34,
+ F_SETLKW = 35,
+ }
+ }
else
static assert(0, "Platform not supported");
--- gcc-9.3.0.orig/libphobos/configure.tgt
+++ gcc-9.3.0/libphobos/configure.tgt
@@ -38,6 +38,7 @@
;;
mips*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
riscv*-*-linux*)
LIBPHOBOS_SUPPORTED=yes

View File

@ -1,22 +0,0 @@
Upstream: Yes, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95184
Reason: GDC produced errors about duplicate symbols when the same interface
was implemented by two classes in the same project.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 3824060..7afb1aa 100644 (file)
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1803,8 +1803,11 @@ make_thunk (FuncDeclaration *decl, int offset)
DECL_CONTEXT (thunk) = d_decl_context (decl);
- /* Thunks inherit the public access of the function they are targetting. */
- TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
+ /* Thunks inherit the public access of the function they are targetting.
+ When the function is outside the current compilation unit however, then the
+ thunk must be kept private to not conflict. */
+ TREE_PUBLIC (thunk) = TREE_PUBLIC (function) && !DECL_EXTERNAL (function);
+
DECL_EXTERNAL (thunk) = 0;
/* Thunks are always addressable. */

View File

@ -24,13 +24,13 @@ CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-aarch64
pkgver=9.3.0
pkgver=10.2.0
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-aarch64
pkgrel=4
pkgrel=1
pkgdesc="Stage2 cross-compiler for aarch64"
url="https://gcc.gnu.org"
arch="x86_64"
@ -173,50 +173,34 @@ fi
makedepends="$makedepends_build $makedepends_host"
source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
002_all_default-relro.patch
003_all_default-fortify-source.patch
005_all_default-as-needed.patch
gcc-as-needed-gold.patch
011_all_default-warn-format-security.patch
012_all_default-warn-trampolines.patch
013_all_default-ssp-fix.patch
020_all_msgfmt-libstdc++-link.patch
050_all_libiberty-asprintf.patch
051_all_libiberty-pic.patch
053_all_libitm-no-fortify-source.patch
090_all_pr55930-dependency-tracking.patch
0003-gcc-poison-system-directories.patch
203-libgcc_s.patch
205-nopie.patch
0002-posix_memalign.patch
0008-s390x-muslldso.patch
0010-ldbl128-config.patch
0012-static-pie.patch
libgcc-always-build-gcceh.a.patch
gcc-4.9-musl-fortify.patch
gcc-6.1-musl-libssp.patch
gcc-pure64.patch
futex-time64.patch
fix-cxxflags-passing.patch
ada-shared.patch
ada-musl.patch
libgnarl-musl.patch
320-libffi-gnulinux.patch
gcc-pure64-mips.patch
0016-invalid_tls_model.patch
400-dlang-phobos.patch
401-dlang-32bits.patch
402-dlang-stat.patch
403-dlang-ibmz.patch
404-dlang-zlib.patch
405-dlang-mips.patch
406-dlang-fix-interface-visibility.patch
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-Turn-on-Wl-z-relro-z-now-by-default.patch
0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
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-libitm-disable-FORTIFY.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch
0016-dlang-update-zlib-binding.patch
0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch
0018-ada-fix-shared-linking.patch
0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0020-libstdc-futex-add-time64-compatibility.patch
0021-add-fortify-headers-paths.patch
0022-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0023-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0024-Pure-64-bit-MIPS.patch
0025-use-pure-64-bit-configuration-where-appropriate.patch
0026-always-build-libgcc_eh.a.patch
0027-ada-libgnarl-compatibility-for-musl.patch
0028-ada-musl-support-fixes.patch
"
# gcc-4.8-build-args.patch
@ -316,6 +300,8 @@ build() {
echo " hash_style_configure=$_hash_style_configure"
echo ""
export CFLAGS="$CFLAGS -O2"
mkdir -p "$_builddir"
cd "$_builddir"
"$_gccdir"/configure --prefix=/usr \
@ -644,42 +630,32 @@ gnat() {
mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/
}
sha512sums="4b9e3639eef6e623747a22c37a904b4750c93b6da77cf3958d5047e9b5ebddb7eebe091cc16ca0a227c0ecbd2bf3b984b221130f269a97ee4cc18f9cf6c444de gcc-9.3.0.tar.xz
e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch
f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch
5e4794d1caddb1050d8935ae5a53ba275b653ad2c9954df89a8c47ac694e6139011829f440eb7e5b24fd57ea25daf25ac83f317871841a78ffb74d167d6f8bf9 005_all_default-as-needed.patch
6c9a5068f6eea8a85d297a3555b1d2333ffd4b9ddbfb7560a3e643f8577603871ca123373ef7f96e894225291d88f7bf575c7f8386bcfdd1dabcd7ba12598b65 gcc-as-needed-gold.patch
e026bf9f73ee254528423c6cabdfd7794960c567161581b7d4b7c61c45027e12a6efef79662d4288b9cbaecb4798f01af6a5b4a13b766c2d501444ac1846fd43 011_all_default-warn-format-security.patch
37de4cc9061bfe1963e6e6570e1a6bbfd58204bf90e0eef819882599a9a80ea28f3eb815c20c1f173dc25d4bd9971b7c7f7f9512d6f8f91f04de1e1175114d4d 012_all_default-warn-trampolines.patch
38a0fedeac3eebe4a6a957792ba520225cf42663c96a171cd168fdb6c91ffa9a56b80351f8238c5d03b78d3ae2a6539a54481fe4848b4a395e2c87f2ff7adc08 013_all_default-ssp-fix.patch
d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd 020_all_msgfmt-libstdc++-link.patch
840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 050_all_libiberty-asprintf.patch
0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 051_all_libiberty-pic.patch
e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab 053_all_libitm-no-fortify-source.patch
4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 090_all_pr55930-dependency-tracking.patch
707b30c141778fbcb1e37ebb42873cd7971de232a1298f78bbd834fa74d411b7b49cecfe4f247316d7c785da792f95f26ea6d824cd322a8f87b29537af3f77f3 0003-gcc-poison-system-directories.patch
d1c2d7ff7f673375dc7cd84ae9d8515853b5af6390c70bb763412c012101344e4ee1ce155151ce3fb6ba2b80af7ed42d697dbe1bf6fd6e7b2b9087a378c47c37 203-libgcc_s.patch
98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch
6d84354e6df96d5ea244eb3bb5f044781796b88040b11c78fb6ee509e5aac19d46e0e92ca836e98e6495d9751f52439833b748efc419e4f5d5301fb549c4dcc9 0002-posix_memalign.patch
7f434a7350c9b06d0ae7cc18a569d813238483afa34b0801d112844a0dfe6164ae36b0416955fd4da7a8caa54672247f319a8ec7ce4b6a97a5f4e17ec083112a 0008-s390x-muslldso.patch
66085c5555e6b91b6874d1782d5a1dc0ab1792889f9400f48cde9483f82b51b9e3a5de1efbba21a19fc5e664334f2188d0c2bc988d42335efa26118b3c85cc7f 0010-ldbl128-config.patch
d91c5eba37166cf34ca38e03808e3960c091b3627008a0c68c127cdf52e3827f8cfbe478ababe64c3cbb4d5eb8ed6230a21a74b6908549e05e08646de09df37c 0012-static-pie.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch
dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch
fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch
5b12af738349a22346589e53e7ab7d37a065b7f4c756aab4c1cc1b4753cdf9ad1bf198f4e4783ae10232df63da0855591bab2452b50ac96a08905972d93c1b0e futex-time64.patch
35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
cceeac95f47ea8664e1c16c5ebecb472b5aaa56040e943c1b97c7873b50e3a2bf972d9f743d342a2444a3bb711a0720d2446fded43892c5e05bdeefd478b0cd1 ada-musl.patch
a1f7750bc7b8b7d916a5dee34fcc736bd4fb249c96538b547d495794e6cfd49356aa3974506a15074b4cb58edd5d7e2868607c902dd003e8c464d5066fd4a575 libgnarl-musl.patch
f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 320-libffi-gnulinux.patch
86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch
17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7 0016-invalid_tls_model.patch
38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df 400-dlang-phobos.patch
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch
9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69 402-dlang-stat.patch
fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae 403-dlang-ibmz.patch
ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb 404-dlang-zlib.patch
3f40f796f50d49ea0a185d3454c79606fb5f90ed48c030fe25c1df8c4a72ba7cae37dccdb260cf737beb3e921dc2ddad68effbe446dbf220a07d0158b9b9ca8d 405-dlang-mips.patch
c226bb5c60ae5071549e5ec3ab44dc87b244615ba520973b1d4c50a2b6d3fd941c4e5e8e1f85cad28093ee8627d20415114524b593ad3a9b24998328d3f3ea72 406-dlang-fix-interface-visibility.patch"
sha512sums="42ae38928bd2e8183af445da34220964eb690b675b1892bbeb7cd5bb62be499011ec9a93397dba5e2fb681afadfc6f2767d03b9035b44ba9be807187ae6dc65e gcc-10.2.0.tar.xz
5edc2dfe8e5d680c8c622b16943a1ec4e7f7db245e2fa4e54371962c048af1f074b1ed49f619f8abdf0eb97129d8b7198b4f16f06da794fe0fd6ce4d55f829fb 0001-posix_memalign.patch
bff1c9a08d32186b94660c42823babd63729b2a050e761c514c3f23c7eac2585ddc4f748df547915fb6b2fc098f3ecc2e8d9707f3aef9bb9c6103ba92ed5f906 0002-gcc-poison-system-directories.patch
7662cc8c6cd77a6cacb2899f4fb13d14495feb508bad9ee8ae0dd38ecddf8d45391ec636022913eece41661fbd5d336ac2130a5c08b2495eb5aff5501cff49a6 0003-Turn-on-Wl-z-relro-z-now-by-default.patch
26303e588f37c4208c3da962972b83759daa5abaf8eaf4da331a4cf1e3a90590ad56a7f8b766795bda7b6baa69aaa9c09864f297d376feacbe4ba08249da2d8d 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
4be2f8ab07e5ff2b018c633e057927446259b63cc65229f977c84b294820d1dbecc29c2e6167b3cb000a5995e7def64cd8191031ee2b2c2ec3e5b4ad70267083 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
e97e619874c0edb60d826669426f96b6f09b79849538415ee1a205345a574ea292de5f324925dd1c821859a3c4873a2392e11edcd6ac6b53f6d6d389b25ffe94 0006-Enable-Wformat-and-Wformat-security-by-default.patch
c3081e7b37dcb2e2b4381e6fcc2abfa066bb4adc3ad4bdd7bd1402a6a3ccc354bfcf713c6acb379001dd97e14e6bdc8eb2eeca6b1e45262bea3262d51394c0e6 0007-Enable-Wtrampolines-by-default.patch
cc602c71b0893b058021cd45d239c3e9f013f68cd56f642fcdad342456bae9ea08ddf0929a6c2e6e452987d1d8c4be97dfe0314d9107e01bf6403ce97e83a30f 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0bc96d3a2afd0499e01b47a8197f9a5ead04219d0674f0dea97a4654def7dca2c50d8c005d04558212d53e4ec9fcf2bf4a3286d7a12b24eba0134aa1197abfe1 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
2662eadcc54408f5c6596e24615a6771c046575a53b8aec65677fcaa699446021b8f3360efc7660d72bf004bffd98f9d4f9d64eba97dedcbb752bb3fffc5a048 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0003e594bbbf142d678f0f79fc03ff467276331a8c87016ecd5f9683abb14aea2550e6880995dd160dc92a3e4ec04e4b2323eda403d4fa8453c258c28bcc969e 0011-libiberty-copy-PIC-objects-during-build-process.patch
209f7cfb281c3c10af2b84e1542e9093bb0fb36171c7d12ce33b1d92a70388d0aae7b1bb22a613a59e352de62927a0f8e9d3a0b4729c12f8eebacc74d29ecfdd 0012-libitm-disable-FORTIFY.patch
e72ad6130dd5dd64ef34ff9f07cf23d310d0d530b272fa1bdc9459991dfb10eec64af3249f213d7f4393024d7d5111890f74679e1029ee0e97b1b6c12a708296 0013-libgcc_s.patch
16fa64460806a6456c8185cf703e7afdf87f55cf49256ed06fd1c098d97d69a3d1df715bb409984ebd275009495ac9ee01bc090580558d2ff569fa2dbbff5fa6 0014-nopie.patch
e054c819446d58e119570cca88a23f541c215c8e4a6eb65d194b97610046593981aaa306d74d39ad6868cb2a85da510dedefd0b729804e3b88a518e4a0897d20 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch
1b70eae1dfb7b819555c51c51d88b9acd09f44d491bf09b265bed7027721c3a74628715fd1bbc537ba43071e98e6747e08ad117b78fedda19571d7a8f6e2c9db 0016-dlang-update-zlib-binding.patch
9f4cf47a2f4016cb6808f245159d9365134963765af41654d60c2f62d4622405f1d1041c3690d50a2db9501075ccc932efd32c739bb0d241af5b80829cb8bafe 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch
55ca9cc19376ac4ce333abdee700e185811455419da80b0f6d765d079aa1344073d09883add920530ad62a3b9c01c347f634931f3735cb021b81b8fd7229467c 0018-ada-fix-shared-linking.patch
b461122d5bc5778398c72bc02bef6ee344ba6c79b7ff9945f9d252559ad445b298e154d7c4784e22fc5cf9d299fc3a8cfc3c0e4d37f12b961148e0432ac4e434 0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
61fdf02497bc5d90bdc1c9b2aa0294bbe1ab4285940dc840d94bda00b0c4dec342df639b11721e5569a6de47e53099928f1f1fb07ddcf3466535e8092b2af9a7 0020-libstdc-futex-add-time64-compatibility.patch
b40fb4f96693a7a0cec086c24f17ba5c8c416e67d76d468306b26895033ee326454a2b2d3028077b9f2187c545bff8c99e87d44298c179ccbc1f48f04ccc0889 0021-add-fortify-headers-paths.patch
7a7414d44a43260d7098bf24dacea6595fdaf42496ef1d176bb7a254da813c1faaf1ecfa6e1463af34c466f02cf2f8489dbfeae9bbfb070726d27da0330e4c59 0022-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
7bd3b297a05df00a0c961c407d84c60b7dcf5150919a6ce8e6d5162bb82e5820ae938feec24dad62dca141b4ede302345b6e08e21f06dd9393bec7592a8aecf7 0023-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
5c61dac5100dce45ad17f45e5e63e3f1e46173639384d7fb3c343e0b6a1e4c0ab39491d397c4445be63cf182f3bb79f7995cc8f89f70a61321dea24bf29cdd18 0024-Pure-64-bit-MIPS.patch
be8eee9edfe4e768ea4873b618a3431ae4502e933af343f80b623e38626c0e9187b73debd6773ae8dfbfb514ff0e4a18a5102e5fac4545e5de18f8e226e6b237 0025-use-pure-64-bit-configuration-where-appropriate.patch
2a2c89b3dfac37344bc17fbb9471b903cbdf4332c71bb20942587acccf962a42d58d2535cc0d90a0f6cddc8f6db1328c6b9f158aecbff99a92f9fa0e0683c0a7 0026-always-build-libgcc_eh.a.patch
739e9d58875c291af82ca9d7509f52679a01704beb4f003e3ace1cd1ae2aede5763243e34c2c73be13bd1dd46539f50d3b7c7a293686b0c6158d3069d377009e 0027-ada-libgnarl-compatibility-for-musl.patch
69f330f91a3354753e9283e804f18257c3e7a51f368defe4a704d20c2a00fd6d6cb62f4d7931ca886dd7dffeaf59fa9beaf36c19ebd3d25cdebfefc884d64c02 0028-ada-musl-support-fixes.patch"

View File

@ -1,10 +0,0 @@
--- gcc-4.8.1/Makefile.in.orig
+++ gcc-4.8.1/Makefile.in
@@ -169,6 +169,7 @@
# built for the build system to override those in BASE_FLAGS_TO_PASSS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.

View File

@ -1,21 +0,0 @@
needed for musl 1.2 and time64.
Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93421
--- gcc-9.2.0/libstdc++-v3/src/c++11/futex.cc.orig 2020-01-20 14:55:05.507548334 -0500
+++ gcc-9.2.0/libstdc++-v3/src/c++11/futex.cc 2020-01-20 14:56:52.458268068 -0500
@@ -61,7 +61,15 @@
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+ struct
+ {
+ long tv_sec;
+ long tv_nsec;
+ } rt;
+#else
struct timespec rt;
+#endif
rt.tv_sec = __s.count() - tv.tv_sec;
rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
if (rt.tv_nsec < 0)

View File

@ -1,11 +0,0 @@
--- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000
+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000
@@ -146,6 +146,8 @@
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else

View File

@ -1,20 +0,0 @@
Author: Timo Teräs <timo.teras@iki.fi>
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.
--- gcc-6.1.0/gcc/gcc.c.orig
+++ gcc-6.1.0/gcc/gcc.c
@@ -870,8 +870,7 @@
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View File

@ -1,14 +1,14 @@
From 65eb86f3e110998d30489df009d44b4bc1043adc Mon Sep 17 00:00:00 2001
From 399f9e74a691ca6272d460d72d1b47afcad84752 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 02/12] posix_memalign
Subject: [PATCH 01/28] 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 ffbb7f82cf5..b0b890d2403 100644
index 87344d9383f..ece428df487 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
@ -38,5 +38,5 @@ index ffbb7f82cf5..b0b890d2403 100644
else
return NULL;
--
2.17.1
2.27.0

View File

@ -1,11 +1,20 @@
From 48c670d2678e0323d88eb72205e039f393cabe05 Mon Sep 17 00:00:00 2001
From 0e993b1b9a33910193862d76facf34bdbe58ed01 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 03/39] gcc: poison-system-directories
Subject: [PATCH 02/28] 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
/usr/include, /sw/include and /opt/include and then triggered a failure and
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".
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [distribution: codesourcery]
Upstream-Status: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
@ -13,14 +22,14 @@ Upstream-Status: Inappropriate [distribution: codesourcery]
gcc/configure.ac | 10 ++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.c | 2 ++
gcc/incpath.c | 19 +++++++++++++++++++
7 files changed, 66 insertions(+)
gcc/incpath.c | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
diff --git a/gcc/common.opt b/gcc/common.opt
index d6ef85928f3..7b29efe3882 100644
index 3ec7743eae8..d3c3e51dcb0 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -679,6 +679,10 @@ Wreturn-local-addr
@@ -682,6 +682,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.
@ -32,10 +41,10 @@ index d6ef85928f3..7b29efe3882 100644
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 5bccb408016..1c784a8276b 100644
index 364eba47737..9551c0dfdf9 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -194,6 +194,12 @@
@@ -224,6 +224,12 @@
#endif
@ -49,10 +58,10 @@ index 5bccb408016..1c784a8276b 100644
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 5c345ce0fd7..cafd05fd150 100755
index eb6061c1631..90e3be864f8 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -953,6 +953,7 @@ with_system_zlib
@@ -1010,6 +1010,7 @@ with_system_zlib
enable_maintainer_mode
enable_link_mutex
enable_version_specific_runtime_libs
@ -60,7 +69,7 @@ index 5c345ce0fd7..cafd05fd150 100755
enable_plugin
enable_host_shared
enable_libquadmath_support
@@ -1696,6 +1697,8 @@ Optional Features:
@@ -1766,6 +1767,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
@ -69,7 +78,7 @@ index 5c345ce0fd7..cafd05fd150 100755
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--disable-libquadmath-support
@@ -29715,6 +29718,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
@@ -30266,6 +30269,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
@ -90,10 +99,10 @@ index 5c345ce0fd7..cafd05fd150 100755
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 65dbf1f2f80..dd5b38195ce 100644
index 715fcba0482..f42006e5476 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6341,6 +6341,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
@@ -6600,6 +6600,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
@ -111,18 +120,18 @@ index 65dbf1f2f80..dd5b38195ce 100644
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 255149fcfb8..cb71b60fe3c 100644
index a2794a67d1e..dfed8fd25a8 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -303,6 +303,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
@@ -348,6 +348,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
-Wparentheses -Wno-pedantic-ms-format @gol
-Wplacement-new -Wplacement-new=@var{n} @gol
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol
-Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
-Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
@@ -5712,6 +5713,14 @@ made up of data only and thus requires no special treatment. But, for
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
-Wrestrict -Wno-return-local-addr -Wreturn-type @gol
-Wno-scalar-storage-order -Wsequence-point @gol
@@ -6924,6 +6925,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.
@ -138,11 +147,11 @@ index 255149fcfb8..cb71b60fe3c 100644
@opindex Wfloat-equal
@opindex Wno-float-equal
diff --git a/gcc/gcc.c b/gcc/gcc.c
index a716f708259..02b3cd39fc2 100644
index 9f790db0daf..b2200c5185a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1061,6 +1060,8 @@
"-z relro -z now " \
@@ -1041,6 +1041,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}}} \
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
@ -151,7 +160,7 @@ index a716f708259..02b3cd39fc2 100644
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
diff --git a/gcc/incpath.c b/gcc/incpath.c
index b11c6a57939..e3b7a21966f 100644
index 8a2bda00f80..9098ab044ab 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -26,6 +26,7 @@
@ -190,5 +199,5 @@ index b11c6a57939..e3b7a21966f 100644
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.17.0
2.27.0

View File

@ -0,0 +1,39 @@
From a35a55940c3402f8ebb510ec7d8bc67e85051277 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/28] Turn on -Wl,-z,relro,-z,now by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index dfed8fd25a8..ca56d52cb05 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14638,6 +14638,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}.
+NOTE: In Alpine Linux, for LDFLAGS, the option
+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b2200c5185a..625c9ab7902 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1039,6 +1039,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 \
+ "-z relro -z now " \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
%{Wno-poison-system-directories:--no-poison-system-directories} \
--
2.27.0

View File

@ -1,16 +1,34 @@
# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
# DP: if the optimization level is > 0
From d2865d0a184ef59be8893dd34edf5037c4bf48f7 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/28] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
---
gcc/doc/invoke.texi | 6 ++++++
gcc/c-family/c-cppbuiltin.c | 3 +
2 files changed, 9 insertions(+), 0 deletions(-)
gcc/c-family/c-cppbuiltin.c | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
Index: b/gcc/doc/invoke.texi
===================================================================
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index db91a36794a..ed976c71404 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1385,6 +1385,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);
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
+
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ca56d52cb05..f5d5a1d1542 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7840,6 +7840,12 @@ also turns on the following optimization
@@ -9228,6 +9228,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.
@ -23,18 +41,6 @@ Index: b/gcc/doc/invoke.texi
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified
Index: b/gcc/c-family/c-cppbuiltin.c
===================================================================
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1176,6 +1176,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);
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
+
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");
--
2.27.0

View File

@ -1,71 +1,68 @@
# DP: On linux targets pass --as-needed by default to the linker, but always
# DP: link the sanitizer libraries with --no-as-needed.
From 872e0a15a2b74cd6b6ba58e2e7e1605543ea36bd 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/28] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -692,8 +692,11 @@ proper position among the other output f
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lasan " \
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -710,8 +713,11 @@ proper position among the other output f
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -ltsan " \
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -728,8 +734,11 @@ proper position among the other output f
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -llsan " \
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -744,8 +753,11 @@ proper position among the other output f
#define STATIC_LIBUBSAN_LIBS \
" %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
#ifdef HAVE_LD_STATIC_DYNAMIC
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lubsan " \
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
Index: b/gcc/config/gnu-user.h
===================================================================
---
gcc/config/aarch64/aarch64-linux.h | 1 +
gcc/config/alpha/linux-elf.h | 2 +-
gcc/config/arm/linux-elf.h | 1 +
gcc/config/gnu-user.h | 6 +++---
gcc/config/i386/gnu-user.h | 2 +-
gcc/config/i386/gnu-user64.h | 1 +
gcc/config/ia64/linux.h | 2 +-
gcc/config/mips/gnu-user.h | 1 +
gcc/config/riscv/linux.h | 1 +
gcc/config/rs6000/linux64.h | 4 ++--
gcc/config/rs6000/sysv4.h | 2 +-
gcc/config/s390/linux.h | 2 +-
gcc/config/sparc/linux.h | 2 +-
gcc/gcc.c | 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 e587e2e9ad6..1d1017aa523 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
+ --as-needed \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index e25fcac3c59..22b2f7b0d14 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
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index 0ec3aa53189..f8bda84de2a 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
%{rdynamic:-export-dynamic} \
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
+ --as-needed \
%{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 ff2e880b1fa..7f30c363e4a 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -161,15 +161,15 @@ see the files COPYING3 and COPYING.RUNTI
@@ -136,17 +136,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
"%{static-libasan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
@ -84,20 +81,35 @@ Index: b/gcc/config/gnu-user.h
- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#endif
Index: b/gcc/config/aarch64/aarch64-linux.h
===================================================================
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -35,6 +35,7 @@
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
+ --as-needed \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
Index: b/gcc/config/ia64/linux.h
===================================================================
#undef TARGET_F951_OPTIONS
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index ae4aa844f02..54b91c0492a 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3. If not see
{ "link_emulation", GNU_USER_LINK_EMULATION },\
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
%{!shared: \
%{!static: \
%{!static-pie: \
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 785c68220b8..21dd66b412a 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
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
+ --as-needed \
%{shared:-shared} \
%{!shared: \
%{!static: \
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
index ee38e218aec..0325971d818 100644
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
@ -109,37 +121,35 @@ Index: b/gcc/config/ia64/linux.h
%{shared:-shared} \
%{!shared: \
%{!static: \
Index: b/gcc/config/sparc/linux.h
===================================================================
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h
index 5d0782100bb..4be5fbb2191 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
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips*} %{shared} \
+ -as-needed \
%{!shared: \
%{!static: \
Index: b/gcc/config/s390/linux.h
===================================================================
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3.
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 4afef7c228c..ba1a6e60e05 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
"%{mabi=ilp32:_ilp32}"
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
Index: b/gcc/config/rs6000/linux64.h
===================================================================
#define LINK_SPEC "\
+-as-needed \
-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
%{shared} \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 2ded3301282..a1e44ddcc0d 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -490,13 +490,13 @@ extern int dot_symbols;
@@ -457,13 +457,13 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
@ -155,90 +165,105 @@ Index: b/gcc/config/rs6000/linux64.h
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
Index: b/gcc/config/rs6000/sysv4.h
===================================================================
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 9ade72114e9..9490b84a153 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -811,7 +811,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
MUSL_DYNAMIC_LINKER)
@@ -789,7 +789,7 @@ GNU_USER_TARGET_CC1_SPEC
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
#endif
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
Index: b/gcc/config/i386/gnu-user64.h
===================================================================
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -56,6 +56,7 @@
"%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
+ --as-needed \
%{shared:-shared} \
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 6919b468f06..56d52d41b31 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
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 81201e67a2f..6477d7ec52e 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -87,7 +87,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
Index: b/gcc/config/i386/gnu-user.h
===================================================================
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.
{ "link_emulation", GNU_USER_LINK_EMULATION },\
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
%{!shared: \
%{!static: \
%{!static-pie: \
Index: b/gcc/config/alpha/linux-elf.h
===================================================================
--- 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.
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
Index: b/gcc/config/arm/linux-elf.h
===================================================================
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -70,6 +70,7 @@
%{rdynamic:-export-dynamic} \
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
+ --as-needed \
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
Index: b/gcc/config/mips/gnu-user.h
===================================================================
--- 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.
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips*} %{shared} \
+ -as-needed \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
Index: b/gcc/config/riscv/linux.h
===================================================================
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -58,6 +58,7 @@
"%{mabi=ilp32:_ilp32}"
#define LINK_SPEC "\
+-as-needed \
-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \
%{mno-relax:--no-relax} \
%{shared} \
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 625c9ab7902..7aec9d3a016 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -695,8 +695,11 @@ proper position among the other output files. */
#ifdef LIBASAN_EARLY_SPEC
#define LIBASAN_SPEC STATIC_LIBASAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lasan " \
+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -713,8 +716,11 @@ proper position among the other output files. */
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -ltsan " \
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -731,8 +737,11 @@ proper position among the other output files. */
#ifdef LIBLSAN_EARLY_SPEC
#define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -llsan " \
+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -747,8 +756,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
-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -lubsan " \
+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.27.0

View File

@ -1,9 +1,18 @@
Enable -Wformat and -Wformat-security by default.
From 5e20872b8cc916cb457c63c6cd970c4fcba47bbb 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/28] Enable -Wformat and -Wformat-security by default.
--- a/gcc/c-family/c.opt 2016-03-23 18:51:56.000000000 +0100
+++ b/gcc/c-family/c.opt 2016-04-28 23:45:54.063351272 +0200
@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit
Warn about format strings that are not literals.
---
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 c49da99d395..93f25319005 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -599,7 +599,7 @@ Warn about function calls with format strings that write past the end
of the destination region. Same as -Wformat-overflow=1.
Wformat-security
-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
@ -11,7 +20,7 @@ Enable -Wformat and -Wformat-security by default.
Warn about possible security problems with format functions.
Wformat-signedness
@@ -475,7 +475,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_l
@@ -620,7 +620,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
@ -19,4 +28,7 @@ Enable -Wformat and -Wformat-security by default.
+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
Warn about printf/scanf/strftime/strfmon format string anomalies.
Wignored-qualifiers
Wformat-overflow=
--
2.27.0

View File

@ -0,0 +1,25 @@
From 1bcf7e30226852db956becebaffdfe2738923423 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/28] 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 d3c3e51dcb0..7b68397c232 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -774,7 +774,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtype-limits
--
2.27.0

View File

@ -0,0 +1,53 @@
From 23fd86ff34670873dd294bd87b93f45c3624903a 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/28] Disable ssp on -nostdlib, -nodefaultlibs and
-ffreestanding Change the buffer size.
---
gcc/gcc.c | 8 +++++++-
gcc/params.opt | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7aec9d3a016..daeb4d0c8ea 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -886,6 +886,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" \
@@ -1170,7 +1176,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fprofile-generate*|coverage:\
%{!fprofile-update=single:\
diff --git a/gcc/params.opt b/gcc/params.opt
index 4aec480798b..eaecfab37ad 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -853,7 +853,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.27.0

View File

@ -1,26 +0,0 @@
From b693804c8dba92fea7beee98f0aa520853a0532b Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Thu, 22 Dec 2016 11:22:28 +0000
Subject: [PATCH 08/12] s390x muslldso
---
gcc/config/s390/linux.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 525c17c2c9f..2d4f4a0654e 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -76,6 +76,9 @@ along with GCC; see the file COPYING3. If not see
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
+
#undef LINK_SPEC
#define LINK_SPEC \
"%{m31:-m elf_s390}%{m64:-m elf64_s390} \
--
2.17.1

View File

@ -1,4 +1,8 @@
Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
From d27d7936ecd9f357a3c6ee05e6548f8a68fdd4b7 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/28] Ensure that msgfmt doesn't encounter problems during
gcc bootstrapping.
Solves error messages like the following:
@ -16,10 +20,16 @@ library path, will make it work as expected here.
References:
https://bugs.gentoo.org/372377
https://bugs.gentoo.org/295480
---
libstdc++-v3/po/Makefile.am | 1 +
libstdc++-v3/po/Makefile.in | 1 +
2 files changed, 2 insertions(+)
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
@@ -39,6 +39,7 @@ MSGFMT = msgfmt
diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am
index a9391d8d167..f7eee24dc8c 100644
--- a/libstdc++-v3/po/Makefile.am
+++ b/libstdc++-v3/po/Makefile.am
@@ -38,6 +38,7 @@ MSGFMT = msgfmt
EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
.po.mo:
@ -27,9 +37,11 @@ https://bugs.gentoo.org/295480
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in
index a0f84b0cfa0..ab24a47a2fd 100644
--- a/libstdc++-v3/po/Makefile.in
+++ b/libstdc++-v3/po/Makefile.in
@@ -548,6 +548,7 @@ uninstall-am:
.po.mo:
@ -37,3 +49,6 @@ https://bugs.gentoo.org/295480
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--
2.27.0

View File

@ -0,0 +1,28 @@
From 2ec258d6d31e2c0c614c5086acee84a87768a67c 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/28] 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 141cb886a85..fa0e78eb62f 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -645,8 +645,11 @@ extern int pwait (int, int *, int);
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
+#ifndef asprintf
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
+#endif
/* Like asprintf but allocates memory without fail. This works like
xmalloc. */
--
2.27.0

View File

@ -1,76 +0,0 @@
From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 28 Feb 2018 00:54:05 +0000
Subject: [PATCH 10/12] ldbl128 config
---
gcc/configure | 13 +++++++++++++
gcc/configure.ac | 16 ++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..07ff8597d48 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
else
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)
+
if test $glibc_version_major -gt 2 \
|| ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
gcc_cv_target_ldbl128=yes
@@ -29320,6 +29329,10 @@ else
&& gcc_cv_target_ldbl128=yes
fi
+
+ ;;
+ esac
+
fi
;;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..6c15ed898c0 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5971,13 +5971,25 @@ case "$target" in
AC_ARG_WITH(long-double-128,
[AS_HELP_STRING([--with-long-double-128],
[use 128-bit long double by default])],
- gcc_cv_target_ldbl128="$with_long_double_128",
+ gcc_cv_target_ldbl128="$with_long_double_128", [
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)]
[GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
[gcc_cv_target_ldbl128=no
grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
$target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
&& gcc_cv_target_ldbl128=yes
- ]])])
+ ]])]
+ [
+ ;;
+ esac
+ ])
;;
esac
if test x$gcc_cv_target_ldbl128 = xyes; then
--
2.17.1

View File

@ -0,0 +1,24 @@
From 4f6fd2272f57620da399d0f841fce12b9db3b2d1 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/28] 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 d6b302e02fd..fd39928546f 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -263,6 +263,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi
--
2.27.0

View File

@ -1,14 +1,17 @@
https://bugs.gentoo.org/508852
https://gcc.gnu.org/PR61164
From cef5e0336cfdf4afd0e01fa9e562f686b234697a Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:53:36 +0000
Subject: [PATCH 12/28] libitm: disable FORTIFY
2014-04-27 Magnus Granberg <zorry@gentoo.org>
#508852
* libitm/configure.tgt: Disable FORTIFY
---
libitm/configure.tgt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 04109160e91..107b957ece3 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
@@ -46,6 +46,16 @@ if test "$gcc_cv_have_tls" = yes ; then
esac
fi
@ -25,3 +28,6 @@ https://gcc.gnu.org/PR61164
# Map the target cpu to an ARCH sub-directory. At the same time,
# work out any special compilation flags as necessary.
case "${target_cpu}" in
--
2.27.0

View File

@ -1,107 +0,0 @@
From a4aa319f7c19e564dced3daeb7222c9315af936c Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 18 Aug 2018 23:58:45 +0000
Subject: [PATCH 12/12] static-pie
in gcc-8 -static means static non-pie, even if -pie or -static-pie
are specified, -static-pie can be used to build static pie.
in musl toolchains -static -pie always meant static pie, so this
patch fixes the link specs accordingly, the new -static-pie is just
an alias to -static -pie.
---
gcc/common.opt | 4 ++--
gcc/config/gnu-user.h | 12 +++++-------
gcc/config/rs6000/sysv4.h | 11 +++++------
gcc/gcc.c | 6 +++---
4 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index b52ef0b38c8..0ce5857e01d 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3197,11 +3197,11 @@ Driver
no-pie
Driver RejectNegative Negative(shared)
-Don't create a dynamically linked position independent executable.
+Don't create a position independent executable.
pie
Driver RejectNegative Negative(no-pie)
-Create a dynamically linked position independent executable.
+Create a position independent executable.
static-pie
Driver RejectNegative Negative(pie)
diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
index 8620de3e42d..235328a2642 100644
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -51,13 +51,12 @@
#define GNU_USER_TARGET_STARTFILE_SPEC \
"%{shared:; \
pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
- static:crt1.o%s; \
- static-pie:rcrt1.o%s; \
+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
" PIE_SPEC ":Scrt1.o%s; \
:crt1.o%s} " \
GNU_USER_TARGET_CRTI " \
- %{static:crtbeginT.o%s; \
- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \
+ static:crtbeginT.o%s; \
:crtbegin.o%s} \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start_preinit.o%s; \
@@ -76,8 +75,7 @@
"%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end_preinit.o%s; \
fvtable-verify=std:vtv_end.o%s} \
- %{static:crtend.o%s; \
- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
+ %{shared|" PIE_SPEC ":crtendS.o%s; \
:crtend.o%s} " \
GNU_USER_TARGET_CRTN " " \
CRTOFFLOADEND
@@ -133,7 +131,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
#if defined(HAVE_LD_EH_FRAME_HDR)
-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
#endif
#undef LINK_GCC_C_SEQUENCE_SPEC
diff --git a/gcc/gcc.c b/gcc/gcc.c
index eb1610ba8b0..87560afb03c 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -900,7 +900,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
-#define PIE_SPEC "pie"
+#define PIE_SPEC "pie|static-pie"
#define FPIE1_SPEC "fpie"
#define NO_FPIE1_SPEC FPIE1_SPEC ":;"
#define FPIE2_SPEC "fPIE"
@@ -924,12 +924,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}"
#endif
#else
#define LD_PIE_SPEC ""
#endif
-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
#endif
#ifndef LINK_BUILDID_SPEC
--
2.17.1

View File

@ -1,19 +1,19 @@
From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001
From d31721459e363e49dfe0a7797300864d9cef92f0 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 3/6] libgcc_s
Subject: [PATCH 13/28] libgcc_s
---
gcc/config/i386/i386.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
gcc/config/i386/i386-expand.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3d044e8..82523e1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 6c759b01edf..8cf0e069e1c 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10948,10 +10948,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
@ -27,10 +27,10 @@ index 3d044e8..82523e1 100644
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 8c2248d..6c82f15 100644
index cf5f0884bb4..ed0381e7744 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
@@ -510,7 +510,7 @@ __cpu_indicator_init (void)
return 0;
}
@ -42,7 +42,7 @@ index 8c2248d..6c82f15 100644
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 11bb46e..4f47f7b 100644
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
@ -53,5 +53,5 @@ index 11bb46e..4f47f7b 100644
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
--
2.8.1
2.27.0

View File

@ -1,7 +1,7 @@
From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001
From f64f853eae3b390adbbc9b74a336d93918e6dca4 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 7 Nov 2015 02:08:05 +0000
Subject: [PATCH 5/6] nopie
Subject: [PATCH 14/28] nopie
---
gcc/configure | 27 +++++++++++++++++++++++++++
@ -9,10 +9,10 @@ Subject: [PATCH 5/6] nopie
2 files changed, 40 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 1c6e340..7e8b5d6 100755
index 90e3be864f8..951a093b459 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29390,6 +29390,33 @@ fi
@@ -30774,6 +30774,33 @@ fi
$as_echo "$gcc_cv_no_pie" >&6; }
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
@ -47,10 +47,10 @@ index 1c6e340..7e8b5d6 100755
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6c1dcd9..0ca7647 100644
index f42006e5476..fe392298016 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option],
@@ -6858,6 +6858,19 @@ AC_CACHE_CHECK([for -no-pie option],
LDFLAGS="$saved_LDFLAGS"])
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
@ -71,5 +71,5 @@ index 6c1dcd9..0ca7647 100644
AC_SUBST([NO_PIE_FLAG])
--
2.8.1
2.27.0

View File

@ -0,0 +1,25 @@
From 37dace030c1402a8e6734a0fc59e18717ce1a2ef Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:57:09 +0000
Subject: [PATCH 15/28] libffi: use __linux__ instead of __gnu_linux__ for musl
---
libffi/src/closures.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libffi/src/closures.c b/libffi/src/closures.c
index 721ff00ea43..22a699c6340 100644
--- a/libffi/src/closures.c
+++ b/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it
--
2.27.0

View File

@ -1,6 +1,16 @@
diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
--- a/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/src/std/zlib.d 2020-01-01 00:00:00.000000000 +0900
From 7fc386a2e629e859968da4eb4d0ff4983cb3b76f Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:57:51 +0000
Subject: [PATCH 16/28] dlang: update zlib binding
---
libphobos/src/std/zlib.d | 266 ++++++++++++++++++++++++++++-----------
1 file changed, 196 insertions(+), 70 deletions(-)
diff --git a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
index e6cce240fd5..bd2fe37ebec 100644
--- a/libphobos/src/std/zlib.d
+++ b/libphobos/src/std/zlib.d
@@ -1,7 +1,7 @@
// Written in the D programming language.
@ -62,7 +72,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
*
* See_Also:
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] b
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] buf)
* buf = buffer containing input data
*
* Returns:
@ -89,7 +99,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
auto err = etc.c.zlib.compress2(destbuf.ptr, &destlen, cast(ubyte *) srcbuf.ptr, srcbuf.length, level);
if (err)
{
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf,
@@ -276,7 +282,7 @@ void[] uncompress(const(void)[] srcbuf, size_t destlen = 0u, int winbits = 15)
throw new ZlibException(err);
}
}
@ -172,7 +182,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
if (!inited)
{
@@ -598,26 +607,152 @@ class UnCompress
if (!destbufsize)
destbufsize = to!uint(buf.length) * 2;
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
@ -334,7 +344,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
/**
* Decompress and return any remaining data.
* The returned data should be appended to that returned by uncompress().
@@ -626,48 +761,39 @@ class UnCompress
@@ -626,49 +761,40 @@ class UnCompress
void[] flush()
in
{
@ -409,3 +419,7 @@ diff -Nurp a/libphobos/src/std/zlib.d b/libphobos/src/std/zlib.d
+ assert(decompressor.empty, "The UnCompressor reports not being done");
}
}
--
2.27.0

View File

@ -1,29 +0,0 @@
Fixes errors such as:
GEGL-Message: 16:04:13.794: Module '/usr/lib/gegl-0.4/raw-load.so' load error: Error relocating /usr/lib/libgomp.so.1: __cxa_finalize: initial-exec TLS resolves to dynamic definition in /usr/lib/libgomp.so.1
--- a/libgomp/configure.tgt 2018-11-08 18:13:04.000000000 +0100
+++ b/libgomp/configure.tgt 2019-06-29 20:06:31.972950350 +0200
@@ -10,23 +10,6 @@
# XCFLAGS Add extra compile flags to use.
# XLDFLAGS Add extra link flags to use.
-# Optimize TLS usage by avoiding the overhead of dynamic allocation.
-if test $gcc_cv_have_tls = yes ; then
- case "${target}" in
-
- *-*-k*bsd*-gnu*)
- ;;
-
- *-*-linux* | *-*-gnu*)
- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
- ;;
-
- *-*-rtems*)
- XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
- ;;
- esac
-fi
-
# Since we require POSIX threads, assume a POSIX system by default.
config_path="posix"

View File

@ -0,0 +1,51 @@
From ef5f7880cff27a2b92952ce53a207d5dd896923b Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:58:22 +0000
Subject: [PATCH 17/28] dlang: fix fcntl on mips, add libucontext dep
---
libphobos/configure.tgt | 1 +
libphobos/libdruntime/core/sys/posix/fcntl.d | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index 94e42bf5509..73f2e4b7f01 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -35,6 +35,7 @@ case "${target}" in
;;
mips*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
power*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
diff --git a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
index 9febcff849b..cb34e2108bd 100644
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -870,6 +870,21 @@ else version (CRuntime_Musl)
F_SETLKW = 7,
}
}
+ else version (MIPS_Any)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x008000, // octal 0100000
+ O_LARGEFILE = 0x002000, // octal 0020000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 33,
+ F_SETLK = 34,
+ F_SETLKW = 35,
+ }
+ }
else
static assert(0, "Platform not supported");
--
2.27.0

View File

@ -1,10 +1,19 @@
Index: b/gcc/ada/link.c
===================================================================
From b675e0383262d6d702f5b732e4459d3e2c2a4891 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:16 +0000
Subject: [PATCH 18/28] 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 02c413a412f..f0e52a87d6e 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -105,9 +105,9 @@
#elif defined (__FreeBSD__)
@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
|| defined (__NetBSD__) || defined (__OpenBSD__) \
|| defined (__QNX__)
const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
@ -15,9 +24,9 @@ Index: b/gcc/ada/link.c
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
@@ -127,9 +127,9 @@
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (linux) || defined(__GLIBC__)
#elif defined (__linux__) || defined (__GLIBC__)
const char *__gnat_object_file_option = "-Wl,@";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
@ -28,3 +37,6 @@ Index: b/gcc/ada/link.c
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
--
2.27.0

View File

@ -0,0 +1,24 @@
From 0ea91dd6f8d856d5b589c2a3e95469fea06e7094 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 06:59:43 +0000
Subject: [PATCH 19/28] build: fix CXXFLAGS_FOR_BUILD passing
---
Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.in b/Makefile.in
index 36e369df6e7..63627db68cf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -170,6 +170,7 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
--
2.27.0

View File

@ -0,0 +1,32 @@
From 9684a815e1cbe854383c3c511e1d84d43c46ec94 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:00:17 +0000
Subject: [PATCH 20/28] libstdc++: futex: add time64 compatibility
---
libstdc++-v3/src/c++11/futex.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libstdc++-v3/src/c++11/futex.cc b/libstdc++-v3/src/c++11/futex.cc
index c9de11a7ec7..7be702dbeda 100644
--- a/libstdc++-v3/src/c++11/futex.cc
+++ b/libstdc++-v3/src/c++11/futex.cc
@@ -61,7 +61,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+ struct
+ {
+ long tv_sec;
+ long tv_nsec;
+ } rt;
+#else
struct timespec rt;
+#endif
rt.tv_sec = __s.count() - tv.tv_sec;
rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
if (rt.tv_nsec < 0)
--
2.27.0

View File

@ -0,0 +1,25 @@
From a0708ec975c01b049d254dc51179898966bf8a52 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:01:06 +0000
Subject: [PATCH 21/28] 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 95654bcdb5a..d88df8f154a 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -167,6 +167,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else
--
2.27.0

View File

@ -0,0 +1,31 @@
From 740342a0e4b0b3af498964440918abba1a27ba33 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 22/28] 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.
---
gcc/gcc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index daeb4d0c8ea..6920bec0fa0 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -894,8 +894,7 @@ proper position among the other output files. */
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \
--
2.27.0

View File

@ -1,10 +1,18 @@
# DP: Use --push-state/--pop-state for gold as well when linking libtsan.
From 775adf35d6f34f61947fc28a2bdbfa7e881c40d5 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:03:42 +0000
Subject: [PATCH 23/28] DP: Use --push-state/--pop-state for gold as well when
linking libtsan.
Index: b/gcc/gcc.c
===================================================================
---
gcc/gcc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 6920bec0fa0..40e07354b3d 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -693,10 +693,10 @@ proper position among the other output f
@@ -696,10 +696,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 "}" \
@ -17,7 +25,7 @@ Index: b/gcc/gcc.c
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -714,10 +714,10 @@ proper position among the other output f
@@ -717,10 +717,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 "}" \
@ -30,7 +38,7 @@ Index: b/gcc/gcc.c
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -735,10 +735,10 @@ proper position among the other output f
@@ -738,10 +738,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 "}" \
@ -43,7 +51,7 @@ Index: b/gcc/gcc.c
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -754,10 +754,10 @@ proper position among the other output f
@@ -757,10 +757,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 "}" \
@ -56,3 +64,6 @@ Index: b/gcc/gcc.c
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.27.0

View File

@ -1,7 +1,7 @@
From b8c4e45d052adc247341066f748421743704b481 Mon Sep 17 00:00:00 2001
From 717090cf538f765db1730956c512a43f2d52a802 Mon Sep 17 00:00:00 2001
From: Nils Andreas Svee <me@lochnair.net>
Date: Thu, 21 Dec 2017 03:14:33 +0100
Subject: [PATCH] Pure 64-bit MIPS
Subject: [PATCH 24/28] Pure 64-bit MIPS
---
gcc/config/mips/mips.h | 8 ++++----
@ -9,10 +9,10 @@ Subject: [PATCH] Pure 64-bit MIPS
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 803ab98e7..afd74752f 100644
index 3ce0c19a29a..b9920b49167 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3330,11 +3330,11 @@ struct GTY(()) machine_function {
@@ -3424,11 +3424,11 @@ struct GTY(()) machine_function {
/* If we are *not* using multilibs and the default ABI is not ABI_32 we
need to change these from /lib and /usr/lib. */
#if MIPS_ABI_DEFAULT == ABI_N32
@ -29,7 +29,7 @@ index 803ab98e7..afd74752f 100644
/* Load store bonding is not supported by micromips and fix_24k. The
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
index 16c8adf85..bb46204db 100644
index ceb58d3b5f3..8116e23ebba 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
@ -43,5 +43,5 @@ index 16c8adf85..bb46204db 100644
+ ../lib32 \
+ ../lib
--
2.15.1
2.27.0

View File

@ -1,6 +1,36 @@
--- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000
+++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000
@@ -34,6 +34,6 @@
From f73cf8d2f8f4eee71fc2ba850672e69f509a4486 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:04:40 +0000
Subject: [PATCH 25/28] use pure 64-bit configuration where appropriate
---
gcc/config/aarch64/t-aarch64-linux | 2 +-
gcc/config/i386/t-linux64 | 4 ++--
gcc/config/rs6000/t-linux | 6 ++++--
gcc/config/rs6000/t-linux64 | 4 ++--
gcc/config/rs6000/t-linux64bele | 4 ++--
gcc/config/rs6000/t-linux64lebe | 4 ++--
gcc/config/s390/t-linux64 | 4 ++--
7 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index 83e59e33b85..6ec56fdf6a8 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@ LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 1171e218578..256f8c079ba 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -33,6 +33,6 @@
comma=,
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
@ -9,29 +39,10 @@
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
--- ./gcc/config/aarch64/t-aarch64-linux.orig
+++ ./gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
--- ./gcc/config/s390/t-linux64.orig
+++ ./gcc/config/s390/t-linux64
@@ -7,5 +7,5 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--- ./gcc/config/rs6000/t-linux.orig
+++ ./gcc/config/rs6000/t-linux
diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux
index aeb7440c492..ab14c455d8d 100644
--- a/gcc/config/rs6000/t-linux
+++ b/gcc/config/rs6000/t-linux
@@ -2,7 +2,8 @@
# or soft-float.
ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
@ -40,9 +51,9 @@
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
else
ifneq (,$(findstring spe,$(target)))
MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
@@ -14,7 +15,8 @@
MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
endif
@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target)))
MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
endif
ifneq (,$(findstring powerpc64le,$(target)))
@ -52,8 +63,10 @@
endif
endif
--- ./gcc/config/rs6000/t-linux64.orig
+++ ./gcc/config/rs6000/t-linux64
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 264a7e27524..d1e460811cc 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -28,8 +28,8 @@
MULTILIB_OPTIONS := m64/m32
MULTILIB_DIRNAMES := 64 32
@ -65,8 +78,10 @@
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
$(COMPILE) $<
--- ./gcc/config/rs6000/t-linux64bele.orig
+++ ./gcc/config/rs6000/t-linux64bele
diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele
index 97c1ee6fb4d..08d72639cb6 100644
--- a/gcc/config/rs6000/t-linux64bele
+++ b/gcc/config/rs6000/t-linux64bele
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mlittle
@ -76,8 +91,10 @@
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
--- ./gcc/config/rs6000/t-linux64lebe.orig
+++ ./gcc/config/rs6000/t-linux64lebe
diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe
index 2e63bdb9fc9..c6e1c5db65d 100644
--- a/gcc/config/rs6000/t-linux64lebe
+++ b/gcc/config/rs6000/t-linux64lebe
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mbig
@ -87,3 +104,18 @@
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64
index cc6ab367072..7f498ee1cdc 100644
--- a/gcc/config/s390/t-linux64
+++ b/gcc/config/s390/t-linux64
@@ -7,5 +7,5 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--
2.27.0

View File

@ -1,11 +1,20 @@
Highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
From 8472f6d0037dcd19c44b1e95d95fbf937b3823e6 Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:05:41 +0000
Subject: [PATCH 26/28] always build libgcc_eh.a
diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
--- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100
+++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200
@@ -772,8 +772,9 @@
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
---
libgcc/Makefile.in | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 851e7657d07..99ec513a1a6 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -956,8 +956,9 @@ ifneq ($(LIBUNWIND),)
all: libunwind.a
endif
+all: libgcc_eh.a
@ -14,8 +23,8 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
+all: libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
@@ -950,10 +951,6 @@
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1159,10 +1160,6 @@ install-libunwind:
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
@ -26,9 +35,9 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -968,6 +965,10 @@
chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
@@ -1179,6 +1176,10 @@ ifeq ($(enable_gcov),yes)
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
endif
+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
@ -37,3 +46,6 @@ diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
--
2.27.0

View File

@ -1,7 +1,18 @@
diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads
--- gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads 2018-01-11 00:55:25.000000000 -0800
+++ gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads 2018-11-01 16:16:23.372452951 -0700
@@ -394,12 +394,6 @@ package System.OS_Interface is
From 4e1b3a26f558e7693853d3600ee677705e67406c Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:06:30 +0000
Subject: [PATCH 27/28] 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 80cb2b2a793..701b7a3aeab 100644
--- a/gcc/ada/libgnarl/s-osinte__linux.ads
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads
@@ -399,12 +399,6 @@ package System.OS_Interface is
PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
@ -14,7 +25,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
function pthread_rwlock_init
(mutex : access pthread_rwlock_t;
attr : access pthread_rwlockattr_t) return int;
@@ -464,11 +458,6 @@ package System.OS_Interface is
@@ -466,11 +460,6 @@ package System.OS_Interface is
protocol : int) return int;
pragma Import (C, pthread_mutexattr_setprotocol);
@ -26,10 +37,11 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
type struct_sched_param is record
sched_priority : int; -- scheduling priority
end record;
diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb
--- gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb 2018-01-11 00:55:25.000000000 -0800
+++ gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb 2018-11-13 11:28:36.433964449 -0800
@@ -202,9 +202,6 @@ package body System.Task_Primitives.Oper
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index c45559e5ba0..0b0f173e7d4 100644
--- a/gcc/ada/libgnarl/s-taprop__linux.adb
+++ b/gcc/ada/libgnarl/s-taprop__linux.adb
@@ -202,9 +202,6 @@ package body System.Task_Primitives.Operations is
pragma Import
(C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
@ -39,7 +51,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
-- 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.
@@ -214,38 +211,6 @@ package body System.Task_Primitives.Oper
@@ -214,38 +211,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.
@ -78,7 +90,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
-- 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,
@@ -348,7 +313,9 @@ package body System.Task_Primitives.Oper
@@ -348,7 +313,9 @@ package body System.Task_Primitives.Operations is
-- Init_Mutex --
----------------
@ -88,7 +100,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Mutex_Attr : aliased pthread_mutexattr_t;
Result, Result_2 : C.int;
@@ -360,16 +327,7 @@ package body System.Task_Primitives.Oper
@@ -360,16 +327,7 @@ package body System.Task_Primitives.Operations is
return Result;
end if;
@ -106,7 +118,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Result := pthread_mutexattr_setprotocol
(Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Oper
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Operations is
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
pragma Assert (Result = 0);
@ -118,3 +130,6 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
pragma Assert (Result in 0 | ENOMEM);
--
2.27.0

View File

@ -1,8 +1,69 @@
From 5e3d7d2f1e2448b6c5eb207f9251c437629e43bc Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Fri, 21 Aug 2020 07:07:48 +0000
Subject: [PATCH 28/28] ada: musl support fixes
---
gcc/ada/Makefile.rtl | 10 +++++-----
gcc/ada/adaint.c | 34 +++++++++++++++++++---------------
gcc/ada/adaint.h | 10 ++++------
gcc/ada/terminals.c | 8 ++++----
4 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 55ff9b0f3d5..0fadf4e4b79 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -1533,7 +1533,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 \
@@ -2083,7 +2083,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
s-osinte.adb<libgnarl/s-osinte__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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2112,7 +2112,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 \
@@ -2305,7 +2305,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) \
system.ads<libgnat/system-linux-ia64.ads
@@ -2401,7 +2401,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) \
system.ads<libgnat/system-linux-x86.ads
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 3b0aea9..ee0bb69 100644
index 595abf87d65..00858c24f53 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -76,6 +76,11 @@
@@ -90,6 +90,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
@ -14,7 +75,7 @@ index 3b0aea9..ee0bb69 100644
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3255,7 +3260,6 @@ __gnat_lwp_self (void)
@@ -3308,7 +3313,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
@ -22,7 +83,7 @@ index 3b0aea9..ee0bb69 100644
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void)
@@ -3318,7 +3322,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
@ -31,7 +92,7 @@ index 3b0aea9..ee0bb69 100644
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3278,33 +3282,33 @@ __gnat_cpu_alloc_size (size_t count)
@@ -3331,33 +3335,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
@ -73,7 +134,7 @@ index 3b0aea9..ee0bb69 100644
}
size_t
@@ -3314,23 +3318,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
@@ -3367,23 +3371,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
@ -103,7 +164,7 @@ index 3b0aea9..ee0bb69 100644
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 0d12f7e..a063b47 100644
index 311e240dfcc..1c4d0050103 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void);
@ -124,56 +185,11 @@ index 0d12f7e..a063b47 100644
#endif
#if defined (_WIN32)
--- a/gcc/ada/Makefile.rtl 2019-05-14 21:18:45.217455681 +0200
+++ b/gcc/ada/Makefile.rtl 2019-05-14 21:21:30.686464218 +0200
@@ -1521,7 +1521,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
$(TRASYM_DWARF_UNIX_PAIRS) \
g-sercom.adb<libgnat/g-sercom__linux.adb \
- 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 \
@@ -2073,7 +2073,7 @@
s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ppc.ads
@@ -2102,7 +2102,7 @@
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 \
@@ -2297,7 +2297,7 @@
s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.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 \
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS) \
system.ads<libgnat/system-linux-ia64.ads
@@ -2394,7 +2394,7 @@
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 \
$(ATOMICS_TARGET_PAIRS) \
$(X86_64_TARGET_PAIRS) \
system.ads<libgnat/system-linux-x86.ads
--- a/gcc/ada/terminals.c 2019-01-08 10:54:04.000000000 +0100
+++ b/gcc/ada/terminals.c 2019-05-15 13:14:09.935742526 +0200
@@ -1136,7 +1136,7 @@
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index af4417fab90..bab6bf3ca87 100644
--- a/gcc/ada/terminals.c
+++ b/gcc/ada/terminals.c
@@ -1145,7 +1145,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
/* 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)
@ -182,7 +198,7 @@ index 0d12f7e..a063b47 100644
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1150,7 +1150,7 @@
@@ -1159,7 +1159,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
@ -191,7 +207,7 @@ index 0d12f7e..a063b47 100644
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1199,8 +1199,8 @@
@@ -1208,8 +1208,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
@ -202,3 +218,6 @@ index 0d12f7e..a063b47 100644
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.27.0

View File

@ -1,33 +0,0 @@
# Turn on -Wl,-z,relro,-z,now by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
Index: b/gcc/doc/invoke.texi
===================================================================
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
+NOTE: In Alpine Linux, for LDFLAGS, the option
+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -890,6 +890,7 @@ proper position among the other output f
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "-z relro -z now " \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\

View File

@ -1,13 +0,0 @@
Enable -Wtrampolines by default.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -712,7 +712,7 @@ Common Var(warn_system_headers) Warning
Do not suppress warnings from system headers.
Wtrampolines
-Common Var(warn_trampolines) Warning
+Common Var(warn_trampolines) Init(1) Warning
Warn whenever a trampoline is generated.
Wtype-limits

View File

@ -1,38 +0,0 @@
Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding
Change the buffer size.
--- a/gcc/gcc.c 2017-07-04 09:15:57.740793000 +0200
+++ b/gcc/gcc.c 2018-03-02 13:58:44.387741114 +0100
@@ -857,6 +857,12 @@ proper position among the other output f
#define LINK_GCC_C_SEQUENCE_SPEC "%G %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" \
@@ -1131,7 +1148,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
%{fprofile-arcs|fprofile-generate*|coverage:\
%{!fprofile-update=singel:\
--- a/gcc/params.def 2016-03-30 09:47:40.000000000 +0200
+++ b/gcc/params.def 2016-09-19 12:56:58.443179039 +0200
@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
DEFPARAM (PARAM_SSP_BUFFER_SIZE,
"ssp-buffer-size",
"The lower bound for a buffer to be considered for stack smashing protection.",
- 8, 1, 0)
+ 4, 1, 0)
DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
"min-size-for-stack-sharing",

View File

@ -1,18 +0,0 @@
2008-07-25 Magnus Granberg <zorry@ume.nu>
* include/libiberty.h (asprintf): Don't declare if defined as a macro
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
+#ifndef asprintf
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
+#endif
#if !HAVE_DECL_VASPRINTF
/* Like vsprintf but provides a pointer to malloc'd storage, which

View File

@ -1,10 +0,0 @@
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi

View File

@ -1,18 +0,0 @@
libatomic build failure if configured with --disable-dependency-tracking
load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory
https://bugs.gentoo.org/463463
http://gcc.gnu.org/PR55930
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
PAT_S = $(word 3,$(PAT_SPLIT))
IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_FALSE@M_DEPS =
M_SIZE = -DN=$(PAT_N)
M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
M_FILE = $(PAT_BASE)_n.c

View File

@ -1,13 +0,0 @@
diff --git a/libffi/closures.c.orig b/libffi/closures.c
index 721ff00..22a699c 100644
--- a/libffi/src/closures.c.orig
+++ b/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
--- a/libphobos/libdruntime/core/sys/posix/config.d 2019-10-29 15:54:05.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/config.d 2019-10-29 15:54:08.000000000 +0900
@@ -67,15 +67,21 @@ version (CRuntime_Glibc)
}
else version (CRuntime_Musl)
{
+ // off_t is always 64 bits on Musl
enum _FILE_OFFSET_BITS = 64;
+ // Not present in Musl sources
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_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT;
enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT;
- enum __WORDSIZE=64;
+ version (D_LP64)
+ enum __WORDSIZE = 64;
+ else
+ enum __WORDSIZE = 32;
}
else version (CRuntime_UClibc)
{

View File

@ -1,448 +0,0 @@
diff -Nurp a/libphobos/libdruntime/core/sys/posix/fcntl.d b/libphobos/libdruntime/core/sys/posix/fcntl.d
--- a/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/fcntl.d 2020-01-01 00:00:00.000000000 +0900
@@ -779,7 +779,102 @@ else version (CRuntime_Bionic)
}
else version (CRuntime_Musl)
{
- enum {
+ version (X86_64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0,
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ // Note: Definitions for i386 are in arch/generic/bits/fcntl.h
+ else version (X86)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0x008000, // octal 0100000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 12,
+ F_SETLK = 13,
+ F_SETLKW = 14,
+ }
+ }
+ else version (ARM)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x010000, // octal 0200000
+ O_LARGEFILE = 0x020000, // octal 0400000
+ O_TMPFILE = 0x404000, // octal 020040000
+
+ F_GETLK = 12,
+ F_SETLK = 13,
+ F_SETLKW = 14,
+ }
+ }
+ else version (AArch64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x010000, // octal 0200000
+ O_LARGEFILE = 0x020000, // octal 0400000
+ O_TMPFILE = 0x404000, // octal 020040000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else version (SystemZ)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x004000, // octal 040000
+ O_LARGEFILE = 0x008000, // octal 0100000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else version (PPC64)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x004000, // octal 040000
+ O_NOFOLLOW = 0x008000, // octal 0100000
+ O_DIRECT = 0x020000, // octal 0400000
+ O_LARGEFILE = 0x010000, // octal 0200000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 5,
+ F_SETLK = 6,
+ F_SETLKW = 7,
+ }
+ }
+ else
+ static assert(0, "Platform not supported");
+
+ enum
+ {
O_CREAT = 0x40, // octal 0100
O_EXCL = 0x80, // octal 0200
O_NOCTTY = 0x100, // octal 0400
@@ -790,16 +885,11 @@ else version (CRuntime_Musl)
O_DSYNC = 0x1000, // octal 010000
O_SYNC = 0x101000, // octal 04010000
O_RSYNC = O_SYNC,
- O_DIRECTORY = 0x10000,
- O_NOFOLLOW = 0x20000,
O_CLOEXEC = 0x80000,
O_ASYNC = 0x2000,
- O_DIRECT = 0x4000,
- O_LARGEFILE = 0,
O_NOATIME = 0x40000,
O_PATH = 0x200000,
- O_TMPFILE = 0x410000,
O_NDELAY = O_NONBLOCK,
O_SEARCH = O_PATH,
O_EXEC = O_PATH,
@@ -809,19 +899,19 @@ else version (CRuntime_Musl)
O_WRONLY = 01,
O_RDWR = 02,
}
- enum {
+ enum
+ {
F_DUPFD = 0,
F_GETFD = 1,
F_SETFD = 2,
F_GETFL = 3,
F_SETFL = 4,
- F_GETLK = 5,
- F_SETLK = 6,
- F_SETLKW = 7,
+ // F_GETLK, F_SETLK, F_SETLKW are arch-specific
F_SETOWN = 8,
F_GETOWN = 9,
}
- enum {
+ enum
+ {
F_RDLCK = 0,
F_WRLCK = 1,
F_UNLCK = 2,
diff -Nurp a/libphobos/libdruntime/core/sys/posix/semaphore.d b/libphobos/libdruntime/core/sys/posix/semaphore.d
--- a/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/semaphore.d 2020-01-01 00:00:00.000000000 +0900
@@ -143,8 +143,10 @@ else version (CRuntime_Bionic)
else version (CRuntime_Musl)
{
struct sem_t {
- int[4*long.sizeof/int.sizeof] __val;
+ int[4*c_long.sizeof/int.sizeof] __val;
}
+
+ enum SEM_FAILED = (sem_t*).init;
}
else version (CRuntime_UClibc)
{
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d 2020-01-01 00:00:00.000000000 +0900
@@ -1587,31 +1587,225 @@ else version (CRuntime_Musl)
S_ISGID = 0x400, // octal 02000
S_ISVTX = 0x200, // octal 01000
}
- struct stat_t {
- dev_t st_dev;
- ino_t st_ino;
- nlink_t st_nlink;
-
- mode_t st_mode;
- uid_t st_uid;
- gid_t st_gid;
- uint __pad0;
- dev_t st_rdev;
- off_t st_size;
- blksize_t st_blksize;
- blkcnt_t st_blocks;
-
- timespec st_atim;
- timespec st_mtim;
- timespec st_ctim;
- extern(D) @safe @property inout pure nothrow
- {
- ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
- ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
- ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ version (ARM)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int __st_dev_padding;
+ c_long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ ino_t st_ino;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (AArch64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ c_ulong __pad;
+ off_t st_size;
+ blksize_t st_blksize;
+ int __pad2;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ uint[2] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (X86_64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+
+ mode_t st_mode;
+ uid_t st_uid;
+ gid_t st_gid;
+ uint __pad0;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+
+ c_long[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (X86)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int __st_dev_padding;
+ c_long __st_ino_truncated;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ int __st_rdev_padding;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ ino_t st_ino;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
}
- long[3] __unused;
}
+ else version (MIPS64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ int[3] __pad1;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ uint[2] __pad2;
+ off_t st_size;
+ int __pad3;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ blksize_t st_blksize;
+ uint __pad4;
+ blkcnt_t st_blocks;
+ int[14] __pad5;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (PPC64)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ c_ulong[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else version (SystemZ)
+ {
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+
+ blksize_t st_blksize;
+ blkcnt_t st_blocks;
+ c_ulong[3] __unused;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ }
+ }
+ }
+ else
+ static assert("Unsupported platform");
+
private
{
extern (D) bool S_ISTYPE( mode_t mode, uint mask )
diff -Nurp a/libphobos/libdruntime/core/sys/posix/sys/types.d b/libphobos/libdruntime/core/sys/posix/sys/types.d
--- a/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/core/sys/posix/sys/types.d 2020-01-08 00:00:00.000000000 +0900
@@ -112,8 +112,26 @@ version (CRuntime_Glibc)
}
else version (CRuntime_Musl)
{
- alias c_long blksize_t;
- alias c_ulong nlink_t;
+ version (AArch64)
+ {
+ alias int blksize_t;
+ alias uint nlink_t;
+ }
+ else version (MIPS64)
+ {
+ alias c_long blksize_t;
+ alias uint nlink_t;
+ }
+ else version (RISCV64)
+ {
+ alias int blksize_t;
+ alias uint nlink_t;
+ }
+ else
+ {
+ alias c_long blksize_t;
+ alias c_ulong nlink_t;
+ }
alias long dev_t;
alias long blkcnt_t;
alias ulong ino_t;

View File

@ -1,137 +0,0 @@
diff -Nurp a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d 2020-01-01 00:00:00.000000000 +0900
@@ -1084,7 +1084,9 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
// base offset
auto ti = tls_index(mod, 0);
- version (IBMZ_Any)
+ version (CRuntime_Musl)
+ return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
+ else version (IBMZ_Any)
{
auto idx = cast(void *)__tls_get_addr_internal(&ti)
+ cast(ulong)__builtin_thread_pointer();
diff -Nurp a/libphobos/configure.ac b/libphobos/configure.ac
--- a/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure.ac 2020-01-01 00:00:00.000000000 +0900
@@ -140,6 +140,14 @@ case ${host} in
esac
AC_MSG_RESULT($LIBPHOBOS_SUPPORTED)
+AC_MSG_CHECKING([if target needs to link in swapcontext])
+AC_MSG_RESULT($LIBDRUNTIME_NEEDS_UCONTEXT)
+AS_IF([test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes], [
+ AC_SEARCH_LIBS([swapcontext], [c ucontext], [], [
+ AC_MSG_ERROR([[can't find library providing swapcontext]])
+ ])
+])
+
# Decide if it's usable.
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
*:no) use_libphobos=no ;;
diff -Nurp a/libphobos/configure.tgt b/libphobos/configure.tgt
--- a/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure.tgt 2020-01-01 00:00:00.000000000 +0900
@@ -22,6 +22,13 @@
# Disable the libphobos or libdruntime components on untested or known
# broken systems. More targets shall be added after testing.
LIBPHOBOS_SUPPORTED=no
+
+# Check if we require 'ucontext' or if we have a custom solution.
+# Most platform uses a custom assembly solution for context switches,
+# see `core.thread` and grep for `AsmExternal`.
+# Definitions are in config/ARCH/
+LIBPHOBOS_NEEDS_UCONTEXT=no
+
case "${target}" in
aarch64*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
@@ -37,6 +44,7 @@ case "${target}" in
;;
s390*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
x86_64-*-kfreebsd*-gnu | i?86-*-kfreebsd*-gnu)
LIBPHOBOS_SUPPORTED=yes
diff -Nurp a/libphobos/configure b/libphobos/configure
--- a/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
+++ b/libphobos/configure 2020-01-01 00:00:00.000000000 +0900
@@ -13955,6 +13955,76 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPHOBOS_SUPPORTED" >&5
$as_echo "$LIBPHOBOS_SUPPORTED" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if target needs to link in swapcontext" >&5
+$as_echo_n "checking if target needs to link in swapcontext... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBDRUNTIME_NEEDS_UCONTEXT" >&5
+$as_echo "$LIBDRUNTIME_NEEDS_UCONTEXT" >&6; }
+if test "x$LIBDRUNTIME_NEEDS_UCONTEXT" = xyes; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5
+$as_echo_n "checking for library containing swapcontext... " >&6; }
+if ${ac_cv_search_swapcontext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char swapcontext ();
+int
+main ()
+{
+return swapcontext ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' c ucontext; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_swapcontext=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_swapcontext+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_swapcontext+:} false; then :
+
+else
+ ac_cv_search_swapcontext=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_swapcontext" >&5
+$as_echo "$ac_cv_search_swapcontext" >&6; }
+ac_res=$ac_cv_search_swapcontext
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+
+ as_fn_error $? "can't find library providing swapcontext" "$LINENO" 5
+
+fi
+
+
+fi
+
+
# Decide if it's usable.
case $LIBPHOBOS_SUPPORTED:$enable_libphobos in
*:no) use_libphobos=no ;;

View File

@ -1,34 +0,0 @@
--- gcc-9.3.0.orig/libphobos/libdruntime/core/sys/posix/fcntl.d
+++ gcc-9.3.0/libphobos/libdruntime/core/sys/posix/fcntl.d
@@ -870,6 +870,21 @@
F_SETLKW = 7,
}
}
+ else version (MIPS_Any)
+ {
+ enum
+ {
+ O_DIRECTORY = 0x010000, // octal 0200000
+ O_NOFOLLOW = 0x020000, // octal 0400000
+ O_DIRECT = 0x008000, // octal 0100000
+ O_LARGEFILE = 0x002000, // octal 0020000
+ O_TMPFILE = 0x410000, // octal 020200000
+
+ F_GETLK = 33,
+ F_SETLK = 34,
+ F_SETLKW = 35,
+ }
+ }
else
static assert(0, "Platform not supported");
--- gcc-9.3.0.orig/libphobos/configure.tgt
+++ gcc-9.3.0/libphobos/configure.tgt
@@ -38,6 +38,7 @@
;;
mips*-*-linux*)
LIBPHOBOS_SUPPORTED=yes
+ LIBDRUNTIME_NEEDS_UCONTEXT=yes
;;
riscv*-*-linux*)
LIBPHOBOS_SUPPORTED=yes

View File

@ -1,22 +0,0 @@
Upstream: Yes, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95184
Reason: GDC produced errors about duplicate symbols when the same interface
was implemented by two classes in the same project.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 3824060..7afb1aa 100644 (file)
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1803,8 +1803,11 @@ make_thunk (FuncDeclaration *decl, int offset)
DECL_CONTEXT (thunk) = d_decl_context (decl);
- /* Thunks inherit the public access of the function they are targetting. */
- TREE_PUBLIC (thunk) = TREE_PUBLIC (function);
+ /* Thunks inherit the public access of the function they are targetting.
+ When the function is outside the current compilation unit however, then the
+ thunk must be kept private to not conflict. */
+ TREE_PUBLIC (thunk) = TREE_PUBLIC (function) && !DECL_EXTERNAL (function);
+
DECL_EXTERNAL (thunk) = 0;
/* Thunks are always addressable. */

View File

@ -24,13 +24,13 @@ CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-armhf
pkgver=9.3.0
pkgver=10.2.0
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-armhf
pkgrel=4
pkgrel=1
pkgdesc="Stage2 cross-compiler for armhf"
url="https://gcc.gnu.org"
arch="x86_64"
@ -173,50 +173,34 @@ fi
makedepends="$makedepends_build $makedepends_host"
source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
002_all_default-relro.patch
003_all_default-fortify-source.patch
005_all_default-as-needed.patch
gcc-as-needed-gold.patch
011_all_default-warn-format-security.patch
012_all_default-warn-trampolines.patch
013_all_default-ssp-fix.patch
020_all_msgfmt-libstdc++-link.patch
050_all_libiberty-asprintf.patch
051_all_libiberty-pic.patch
053_all_libitm-no-fortify-source.patch
090_all_pr55930-dependency-tracking.patch
0003-gcc-poison-system-directories.patch
203-libgcc_s.patch
205-nopie.patch
0002-posix_memalign.patch
0008-s390x-muslldso.patch
0010-ldbl128-config.patch
0012-static-pie.patch
libgcc-always-build-gcceh.a.patch
gcc-4.9-musl-fortify.patch
gcc-6.1-musl-libssp.patch
gcc-pure64.patch
futex-time64.patch
fix-cxxflags-passing.patch
ada-shared.patch
ada-musl.patch
libgnarl-musl.patch
320-libffi-gnulinux.patch
gcc-pure64-mips.patch
0016-invalid_tls_model.patch
400-dlang-phobos.patch
401-dlang-32bits.patch
402-dlang-stat.patch
403-dlang-ibmz.patch
404-dlang-zlib.patch
405-dlang-mips.patch
406-dlang-fix-interface-visibility.patch
0001-posix_memalign.patch
0002-gcc-poison-system-directories.patch
0003-Turn-on-Wl-z-relro-z-now-by-default.patch
0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
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-libitm-disable-FORTIFY.patch
0013-libgcc_s.patch
0014-nopie.patch
0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch
0016-dlang-update-zlib-binding.patch
0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch
0018-ada-fix-shared-linking.patch
0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
0020-libstdc-futex-add-time64-compatibility.patch
0021-add-fortify-headers-paths.patch
0022-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
0023-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
0024-Pure-64-bit-MIPS.patch
0025-use-pure-64-bit-configuration-where-appropriate.patch
0026-always-build-libgcc_eh.a.patch
0027-ada-libgnarl-compatibility-for-musl.patch
0028-ada-musl-support-fixes.patch
"
# gcc-4.8-build-args.patch
@ -316,6 +300,8 @@ build() {
echo " hash_style_configure=$_hash_style_configure"
echo ""
export CFLAGS="$CFLAGS -O2"
mkdir -p "$_builddir"
cd "$_builddir"
"$_gccdir"/configure --prefix=/usr \
@ -644,42 +630,32 @@ gnat() {
mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/
}
sha512sums="4b9e3639eef6e623747a22c37a904b4750c93b6da77cf3958d5047e9b5ebddb7eebe091cc16ca0a227c0ecbd2bf3b984b221130f269a97ee4cc18f9cf6c444de gcc-9.3.0.tar.xz
e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch
f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 003_all_default-fortify-source.patch
5e4794d1caddb1050d8935ae5a53ba275b653ad2c9954df89a8c47ac694e6139011829f440eb7e5b24fd57ea25daf25ac83f317871841a78ffb74d167d6f8bf9 005_all_default-as-needed.patch
6c9a5068f6eea8a85d297a3555b1d2333ffd4b9ddbfb7560a3e643f8577603871ca123373ef7f96e894225291d88f7bf575c7f8386bcfdd1dabcd7ba12598b65 gcc-as-needed-gold.patch
e026bf9f73ee254528423c6cabdfd7794960c567161581b7d4b7c61c45027e12a6efef79662d4288b9cbaecb4798f01af6a5b4a13b766c2d501444ac1846fd43 011_all_default-warn-format-security.patch
37de4cc9061bfe1963e6e6570e1a6bbfd58204bf90e0eef819882599a9a80ea28f3eb815c20c1f173dc25d4bd9971b7c7f7f9512d6f8f91f04de1e1175114d4d 012_all_default-warn-trampolines.patch
38a0fedeac3eebe4a6a957792ba520225cf42663c96a171cd168fdb6c91ffa9a56b80351f8238c5d03b78d3ae2a6539a54481fe4848b4a395e2c87f2ff7adc08 013_all_default-ssp-fix.patch
d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd 020_all_msgfmt-libstdc++-link.patch
840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 050_all_libiberty-asprintf.patch
0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 051_all_libiberty-pic.patch
e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab 053_all_libitm-no-fortify-source.patch
4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 090_all_pr55930-dependency-tracking.patch
707b30c141778fbcb1e37ebb42873cd7971de232a1298f78bbd834fa74d411b7b49cecfe4f247316d7c785da792f95f26ea6d824cd322a8f87b29537af3f77f3 0003-gcc-poison-system-directories.patch
d1c2d7ff7f673375dc7cd84ae9d8515853b5af6390c70bb763412c012101344e4ee1ce155151ce3fb6ba2b80af7ed42d697dbe1bf6fd6e7b2b9087a378c47c37 203-libgcc_s.patch
98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch
6d84354e6df96d5ea244eb3bb5f044781796b88040b11c78fb6ee509e5aac19d46e0e92ca836e98e6495d9751f52439833b748efc419e4f5d5301fb549c4dcc9 0002-posix_memalign.patch
7f434a7350c9b06d0ae7cc18a569d813238483afa34b0801d112844a0dfe6164ae36b0416955fd4da7a8caa54672247f319a8ec7ce4b6a97a5f4e17ec083112a 0008-s390x-muslldso.patch
66085c5555e6b91b6874d1782d5a1dc0ab1792889f9400f48cde9483f82b51b9e3a5de1efbba21a19fc5e664334f2188d0c2bc988d42335efa26118b3c85cc7f 0010-ldbl128-config.patch
d91c5eba37166cf34ca38e03808e3960c091b3627008a0c68c127cdf52e3827f8cfbe478ababe64c3cbb4d5eb8ed6230a21a74b6908549e05e08646de09df37c 0012-static-pie.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-4.9-musl-fortify.patch
dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch
fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch
5b12af738349a22346589e53e7ab7d37a065b7f4c756aab4c1cc1b4753cdf9ad1bf198f4e4783ae10232df63da0855591bab2452b50ac96a08905972d93c1b0e futex-time64.patch
35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
cceeac95f47ea8664e1c16c5ebecb472b5aaa56040e943c1b97c7873b50e3a2bf972d9f743d342a2444a3bb711a0720d2446fded43892c5e05bdeefd478b0cd1 ada-musl.patch
a1f7750bc7b8b7d916a5dee34fcc736bd4fb249c96538b547d495794e6cfd49356aa3974506a15074b4cb58edd5d7e2868607c902dd003e8c464d5066fd4a575 libgnarl-musl.patch
f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 320-libffi-gnulinux.patch
86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch
17e0faeef742d32d57a070d983480367dd28cd28d47a8966ce327afdff3a38ea76803a833c90aff7d3a93aa66dae76c9be47b2408500913b40571af25b85aca7 0016-invalid_tls_model.patch
38772c5b0905455a44c43d6ef7e5f140530006e2bde9f5ffd6b569c7cf9633992515f666b486d7a78c30ab8da99b92b2775c90fde47821ae542ef1c49dc405df 400-dlang-phobos.patch
84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830 401-dlang-32bits.patch
9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69 402-dlang-stat.patch
fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae 403-dlang-ibmz.patch
ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb 404-dlang-zlib.patch
3f40f796f50d49ea0a185d3454c79606fb5f90ed48c030fe25c1df8c4a72ba7cae37dccdb260cf737beb3e921dc2ddad68effbe446dbf220a07d0158b9b9ca8d 405-dlang-mips.patch
c226bb5c60ae5071549e5ec3ab44dc87b244615ba520973b1d4c50a2b6d3fd941c4e5e8e1f85cad28093ee8627d20415114524b593ad3a9b24998328d3f3ea72 406-dlang-fix-interface-visibility.patch"
sha512sums="42ae38928bd2e8183af445da34220964eb690b675b1892bbeb7cd5bb62be499011ec9a93397dba5e2fb681afadfc6f2767d03b9035b44ba9be807187ae6dc65e gcc-10.2.0.tar.xz
5edc2dfe8e5d680c8c622b16943a1ec4e7f7db245e2fa4e54371962c048af1f074b1ed49f619f8abdf0eb97129d8b7198b4f16f06da794fe0fd6ce4d55f829fb 0001-posix_memalign.patch
bff1c9a08d32186b94660c42823babd63729b2a050e761c514c3f23c7eac2585ddc4f748df547915fb6b2fc098f3ecc2e8d9707f3aef9bb9c6103ba92ed5f906 0002-gcc-poison-system-directories.patch
7662cc8c6cd77a6cacb2899f4fb13d14495feb508bad9ee8ae0dd38ecddf8d45391ec636022913eece41661fbd5d336ac2130a5c08b2495eb5aff5501cff49a6 0003-Turn-on-Wl-z-relro-z-now-by-default.patch
26303e588f37c4208c3da962972b83759daa5abaf8eaf4da331a4cf1e3a90590ad56a7f8b766795bda7b6baa69aaa9c09864f297d376feacbe4ba08249da2d8d 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
4be2f8ab07e5ff2b018c633e057927446259b63cc65229f977c84b294820d1dbecc29c2e6167b3cb000a5995e7def64cd8191031ee2b2c2ec3e5b4ad70267083 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
e97e619874c0edb60d826669426f96b6f09b79849538415ee1a205345a574ea292de5f324925dd1c821859a3c4873a2392e11edcd6ac6b53f6d6d389b25ffe94 0006-Enable-Wformat-and-Wformat-security-by-default.patch
c3081e7b37dcb2e2b4381e6fcc2abfa066bb4adc3ad4bdd7bd1402a6a3ccc354bfcf713c6acb379001dd97e14e6bdc8eb2eeca6b1e45262bea3262d51394c0e6 0007-Enable-Wtrampolines-by-default.patch
cc602c71b0893b058021cd45d239c3e9f013f68cd56f642fcdad342456bae9ea08ddf0929a6c2e6e452987d1d8c4be97dfe0314d9107e01bf6403ce97e83a30f 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
0bc96d3a2afd0499e01b47a8197f9a5ead04219d0674f0dea97a4654def7dca2c50d8c005d04558212d53e4ec9fcf2bf4a3286d7a12b24eba0134aa1197abfe1 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
2662eadcc54408f5c6596e24615a6771c046575a53b8aec65677fcaa699446021b8f3360efc7660d72bf004bffd98f9d4f9d64eba97dedcbb752bb3fffc5a048 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
0003e594bbbf142d678f0f79fc03ff467276331a8c87016ecd5f9683abb14aea2550e6880995dd160dc92a3e4ec04e4b2323eda403d4fa8453c258c28bcc969e 0011-libiberty-copy-PIC-objects-during-build-process.patch
209f7cfb281c3c10af2b84e1542e9093bb0fb36171c7d12ce33b1d92a70388d0aae7b1bb22a613a59e352de62927a0f8e9d3a0b4729c12f8eebacc74d29ecfdd 0012-libitm-disable-FORTIFY.patch
e72ad6130dd5dd64ef34ff9f07cf23d310d0d530b272fa1bdc9459991dfb10eec64af3249f213d7f4393024d7d5111890f74679e1029ee0e97b1b6c12a708296 0013-libgcc_s.patch
16fa64460806a6456c8185cf703e7afdf87f55cf49256ed06fd1c098d97d69a3d1df715bb409984ebd275009495ac9ee01bc090580558d2ff569fa2dbbff5fa6 0014-nopie.patch
e054c819446d58e119570cca88a23f541c215c8e4a6eb65d194b97610046593981aaa306d74d39ad6868cb2a85da510dedefd0b729804e3b88a518e4a0897d20 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch
1b70eae1dfb7b819555c51c51d88b9acd09f44d491bf09b265bed7027721c3a74628715fd1bbc537ba43071e98e6747e08ad117b78fedda19571d7a8f6e2c9db 0016-dlang-update-zlib-binding.patch
9f4cf47a2f4016cb6808f245159d9365134963765af41654d60c2f62d4622405f1d1041c3690d50a2db9501075ccc932efd32c739bb0d241af5b80829cb8bafe 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch
55ca9cc19376ac4ce333abdee700e185811455419da80b0f6d765d079aa1344073d09883add920530ad62a3b9c01c347f634931f3735cb021b81b8fd7229467c 0018-ada-fix-shared-linking.patch
b461122d5bc5778398c72bc02bef6ee344ba6c79b7ff9945f9d252559ad445b298e154d7c4784e22fc5cf9d299fc3a8cfc3c0e4d37f12b961148e0432ac4e434 0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
61fdf02497bc5d90bdc1c9b2aa0294bbe1ab4285940dc840d94bda00b0c4dec342df639b11721e5569a6de47e53099928f1f1fb07ddcf3466535e8092b2af9a7 0020-libstdc-futex-add-time64-compatibility.patch
b40fb4f96693a7a0cec086c24f17ba5c8c416e67d76d468306b26895033ee326454a2b2d3028077b9f2187c545bff8c99e87d44298c179ccbc1f48f04ccc0889 0021-add-fortify-headers-paths.patch
7a7414d44a43260d7098bf24dacea6595fdaf42496ef1d176bb7a254da813c1faaf1ecfa6e1463af34c466f02cf2f8489dbfeae9bbfb070726d27da0330e4c59 0022-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
7bd3b297a05df00a0c961c407d84c60b7dcf5150919a6ce8e6d5162bb82e5820ae938feec24dad62dca141b4ede302345b6e08e21f06dd9393bec7592a8aecf7 0023-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
5c61dac5100dce45ad17f45e5e63e3f1e46173639384d7fb3c343e0b6a1e4c0ab39491d397c4445be63cf182f3bb79f7995cc8f89f70a61321dea24bf29cdd18 0024-Pure-64-bit-MIPS.patch
be8eee9edfe4e768ea4873b618a3431ae4502e933af343f80b623e38626c0e9187b73debd6773ae8dfbfb514ff0e4a18a5102e5fac4545e5de18f8e226e6b237 0025-use-pure-64-bit-configuration-where-appropriate.patch
2a2c89b3dfac37344bc17fbb9471b903cbdf4332c71bb20942587acccf962a42d58d2535cc0d90a0f6cddc8f6db1328c6b9f158aecbff99a92f9fa0e0683c0a7 0026-always-build-libgcc_eh.a.patch
739e9d58875c291af82ca9d7509f52679a01704beb4f003e3ace1cd1ae2aede5763243e34c2c73be13bd1dd46539f50d3b7c7a293686b0c6158d3069d377009e 0027-ada-libgnarl-compatibility-for-musl.patch
69f330f91a3354753e9283e804f18257c3e7a51f368defe4a704d20c2a00fd6d6cb62f4d7931ca886dd7dffeaf59fa9beaf36c19ebd3d25cdebfefc884d64c02 0028-ada-musl-support-fixes.patch"

View File

@ -1,10 +0,0 @@
--- gcc-4.8.1/Makefile.in.orig
+++ gcc-4.8.1/Makefile.in
@@ -169,6 +169,7 @@
# built for the build system to override those in BASE_FLAGS_TO_PASSS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.

View File

@ -1,21 +0,0 @@
needed for musl 1.2 and time64.
Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93421
--- gcc-9.2.0/libstdc++-v3/src/c++11/futex.cc.orig 2020-01-20 14:55:05.507548334 -0500
+++ gcc-9.2.0/libstdc++-v3/src/c++11/futex.cc 2020-01-20 14:56:52.458268068 -0500
@@ -61,7 +61,15 @@
struct timeval tv;
gettimeofday (&tv, NULL);
// Convert the absolute timeout value to a relative timeout
+#if defined(SYS_futex_time64)
+ struct
+ {
+ long tv_sec;
+ long tv_nsec;
+ } rt;
+#else
struct timespec rt;
+#endif
rt.tv_sec = __s.count() - tv.tv_sec;
rt.tv_nsec = __ns.count() - tv.tv_usec * 1000;
if (rt.tv_nsec < 0)

View File

@ -1,11 +0,0 @@
--- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000
+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000
@@ -146,6 +146,8 @@
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else

View File

@ -1,20 +0,0 @@
Author: Timo Teräs <timo.teras@iki.fi>
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.
--- gcc-6.1.0/gcc/gcc.c.orig
+++ gcc-6.1.0/gcc/gcc.c
@@ -870,8 +870,7 @@
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

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