cross/gcc-x86_64: remove, not needed and broken

Partially reverts 4cd33610c5, just for
x86_64
This commit is contained in:
Bart Ribbers 2020-11-13 13:00:47 +01:00
parent caf50d4e58
commit 2216ae0c83
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
40 changed files with 0 additions and 3339 deletions

View file

@ -1,42 +0,0 @@
From 4ed2cc3054f444c683f54954c32e586a54066337 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 26 Jan 2018 20:32:50 +0000
Subject: [PATCH 01/39] 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 87344d9383f..ece428df487 100644
--- a/gcc/config/i386/pmm_malloc.h
+++ b/gcc/config/i386/pmm_malloc.h
@@ -27,12 +27,13 @@
#include <stdlib.h>
/* We can't depend on <stdlib.h> since the prototype of posix_memalign
- may not be visible. */
+ may not be visible and we can't pollute the namespace either. */
#ifndef __cplusplus
-extern int posix_memalign (void **, size_t, size_t);
+extern int _mm_posix_memalign (void **, size_t, size_t)
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
#endif
+__asm__("posix_memalign");
static __inline void *
_mm_malloc (size_t __size, size_t __alignment)
@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
return malloc (__size);
if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
__alignment = sizeof (void *);
- if (posix_memalign (&__ptr, __alignment, __size) == 0)
+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
return __ptr;
else
return NULL;
--
2.28.0

View file

@ -1,203 +0,0 @@
From 09a32a40b34477cd787deb12833c063a09dea7b2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:59:00 +0400
Subject: [PATCH 02/39] 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: Pending
---
gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++
gcc/configure | 16 ++++++++++++++++
gcc/configure.ac | 10 ++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.c | 2 ++
gcc/incpath.c | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+)
diff --git a/gcc/common.opt b/gcc/common.opt
index dfed6ec76ba..8bb65e0e1af 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -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.
+Wpoison-system-directories
+Common Var(flag_poison_system_directories) Init(1) Warning
+Warn for -I and -L options using system directories if cross compiling
+
Wshadow
Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global.
diff --git a/gcc/config.in b/gcc/config.in
index 364eba47737..9551c0dfdf9 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -224,6 +224,12 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index b4088d8fd1e..793530e21cf 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1010,6 +1010,7 @@ with_system_zlib
enable_maintainer_mode
enable_link_mutex
enable_version_specific_runtime_libs
+enable_poison_system_directories
enable_plugin
enable_host_shared
enable_libquadmath_support
@@ -1766,6 +1767,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
+ --enable-poison-system-directories
+ warn for use of native system header directories
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--disable-libquadmath-support
@@ -30271,6 +30274,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" = "xyes"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 070b9c6c497..0fd438e39e5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6605,6 +6605,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),,
+ [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 0d532a64bfe..86e57038042 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -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
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
-Wrestrict -Wno-return-local-addr -Wreturn-type @gol
-Wno-scalar-storage-order -Wsequence-point @gol
@@ -6926,6 +6927,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.
+@item -Wno-poison-system-directories
+@opindex Wno-poison-system-directories
+Do not warn for @option{-I} or @option{-L} options using system
+directories such as @file{/usr/include} when cross compiling. This
+option is intended for use in chroot environments when such
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@item -Wfloat-equal
@opindex Wfloat-equal
@opindex Wno-float-equal
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9f790db0daf..b2200c5185a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -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} \
+ %{Werror=poison-system-directories:--error-poison-system-directories} \
%{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
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 8a2bda00f80..9098ab044ab 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -26,6 +26,7 @@
#include "intl.h"
#include "incpath.h"
#include "cppdefault.h"
+#include "diagnostic-core.h"
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (flag_poison_system_directories)
+ {
+ struct cpp_dir *p;
+
+ for (p = heads[INC_QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and
--
2.28.0

View file

@ -1,39 +0,0 @@
From 77e75a23e9bdf8863823225567c509b6fed49e6e 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/39] 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 86e57038042..87ff404bc20 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14645,6 +14645,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.28.0

View file

@ -1,46 +0,0 @@
From 3b76b0c848746d4adbc4e8db408efd41aefb829c 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/39] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++,
ObjC, ObjC++, if the optimization level is > 0
---
gcc/c-family/c-cppbuiltin.c | 4 ++++
gcc/doc/invoke.texi | 6 ++++++
2 files changed, 10 insertions(+)
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 87ff404bc20..01e67e97491 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9230,6 +9230,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.
+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
+set by default, and is activated when @option{-O} is set to 2 or higher.
+This enables additional compile-time and run-time checks for several libc
+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
+@option{-D_FORTIFY_SOURCE=0}.
+
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified
--
2.28.0

View file

@ -1,269 +0,0 @@
From 483912c560424ee8b5cc996990d45802671fc73f 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/39] On linux targets pass --as-needed by default to the
linker, but always link the sanitizer libraries with --no-as-needed.
---
gcc/config/aarch64/aarch64-linux.h | 1 +
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
@@ -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 " \
- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#undef LIBTSAN_EARLY_SPEC
#define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
"%{static-libtsan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#undef LIBLSAN_EARLY_SPEC
#define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
"%{static-liblsan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
- 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
#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 { \
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "\
+#define LINK_SPEC " --as-needed \
%{shared:-shared} \
%{!shared: \
%{!static: \
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: \
%{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}"
#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
@@ -457,13 +457,13 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
%(link_os_extra_spec32)"
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
%{!static-pie: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 9ade72114e9..9490b84a153 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -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 "}}"
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 63853e60c03..de6d8675456 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#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: \
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.28.0

View file

@ -1,34 +0,0 @@
From c57a8b43401ca9a1b889fa9fd421ac49c3dbd380 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/39] Enable -Wformat and -Wformat-security by default.
---
gcc/c-family/c.opt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 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)
+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
Warn about possible security problems with format functions.
Wformat-signedness
@@ -620,7 +620,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
Warn about zero-length formats.
Wformat=
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
+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.
Wformat-overflow=
--
2.28.0

View file

@ -1,25 +0,0 @@
From a58dad2c52639422671ac6986c36e48499fc2f20 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/39] 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 8bb65e0e1af..ace932b300d 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.28.0

View file

@ -1,53 +0,0 @@
From 98b2b8f7de60ed1b6b7602124ef6db278cf3c212 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/39] 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.28.0

View file

@ -1,54 +0,0 @@
From 035775ef38206ed2859500efe5fb42ceec2e858d 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/39] Ensure that msgfmt doesn't encounter problems during
gcc bootstrapping.
Solves error messages like the following:
msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
The libgcc_s.so used during build doesn't satisfy the needs of the
libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
is used as a stand-alone application here, and what library it uses
behind the scenes is of no concern to the gcc build process.
Therefore, simply invoking it "as usual", i.e. without any special
library path, will make it work as expected here.
2011-09-19 Martin von Gagern
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(+)
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:
+ env --unset=LD_LIBRARY_PATH \
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
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:
+ env --unset=LD_LIBRARY_PATH \
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--
2.28.0

View file

@ -1,28 +0,0 @@
From e9875d74e75c601b95dba677bc9e58c869150212 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/39] 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.28.0

View file

@ -1,24 +0,0 @@
From 764e64bba73a7b7eb5154c8537781412252ed33e 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/39] 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.28.0

View file

@ -1,33 +0,0 @@
From da46d99b1b7661a98064a45bdccf08c1867582b0 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/39] libitm: 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
@@ -46,6 +46,16 @@ if test "$gcc_cv_have_tls" = yes ; then
esac
fi
+# FIXME: error: inlining failed in call to always_inline
+# int vfprintf(FILE*, const char*, __va_list_tag*)
+# : function body can be overwritten at link time
+# Disable Fortify in libitm for now. #508852
+case "${target}" in
+ *-*-linux*)
+ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
+ ;;
+esac
+
# 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.28.0

View file

@ -1,57 +0,0 @@
From 354f2a8ceb70f9f6e1688ba41c1cc1c17ac87329 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 13/39] libgcc_s
---
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-expand.c b/gcc/config/i386/i386-expand.c
index c6033688f51..a60e5162995 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10966,10 +10966,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
- /* Make it call __cpu_indicator_init in libgcc. */
+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
tree call_expr, fndecl, type;
type = build_function_type_list (integer_type_node, NULL_TREE);
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
call_expr = build_call_expr (fndecl, 0);
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index cf5f0884bb4..ed0381e7744 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -510,7 +510,7 @@ __cpu_indicator_init (void)
return 0;
}
-#if defined SHARED && defined USE_ELF_SYMVER
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
+#ifndef SHARED
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
--
2.28.0

View file

@ -1,75 +0,0 @@
From 7fb84007ff62309abffdbddfa751e69c331e82c3 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 7 Nov 2015 02:08:05 +0000
Subject: [PATCH 14/39] nopie
---
gcc/configure | 27 +++++++++++++++++++++++++++
gcc/configure.ac | 13 +++++++++++++
2 files changed, 40 insertions(+)
diff --git a/gcc/configure b/gcc/configure
index 793530e21cf..2d874d3defe 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -30779,6 +30779,33 @@ fi
$as_echo "$gcc_cv_no_pie" >&6; }
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
+else
+ # Check if -nopie works.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
+$as_echo_n "checking for -nopie option... " >&6; }
+if test "${gcc_cv_nopie+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -nopie"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void) {return 0;}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ gcc_cv_nopie=yes
+else
+ gcc_cv_nopie=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$saved_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
+$as_echo "$gcc_cv_nopie" >&6; }
+ if test "$gcc_cv_nopie" = "yes"; then
+ NO_PIE_FLAG="-nopie"
+ fi
fi
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 0fd438e39e5..0b257e687ee 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6863,6 +6863,19 @@ AC_CACHE_CHECK([for -no-pie option],
LDFLAGS="$saved_LDFLAGS"])
if test "$gcc_cv_no_pie" = "yes"; then
NO_PIE_FLAG="-no-pie"
+else
+ # Check if -nopie works.
+ AC_CACHE_CHECK([for -nopie option],
+ [gcc_cv_nopie],
+ [saved_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -nopie"
+ AC_LINK_IFELSE([int main(void) {return 0;}],
+ [gcc_cv_nopie=yes],
+ [gcc_cv_nopie=no])
+ LDFLAGS="$saved_LDFLAGS"])
+ if test "$gcc_cv_nopie" = "yes"; then
+ NO_PIE_FLAG="-nopie"
+ fi
fi
AC_SUBST([NO_PIE_FLAG])
--
2.28.0

View file

@ -1,25 +0,0 @@
From 3f764eb6dc371cc48cfdf231cbd40e64b1f2a671 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/39] 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.28.0

View file

@ -1,425 +0,0 @@
From b78dea0f8f09d4092bec52b7ada719ead2552dd2 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/39] 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.
/**
- * Compress/decompress data using the $(HTTP www._zlib.net, _zlib library).
+ * Compress/decompress data using the $(HTTP www.zlib.net, zlib library).
*
* Examples:
*
@@ -43,12 +43,12 @@
* References:
* $(HTTP en.wikipedia.org/wiki/Zlib, Wikipedia)
*
- * Copyright: Copyright Digital Mars 2000 - 2011.
+ * Copyright: Copyright The D Language Foundation 2000 - 2011.
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: $(HTTP digitalmars.com, Walter Bright)
- * Source: $(PHOBOSSRC std/_zlib.d)
+ * Source: $(PHOBOSSRC std/zlib.d)
*/
-/* Copyright Digital Mars 2000 - 2011.
+/* Copyright The D Language Foundation 2000 - 2011.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -75,9 +75,9 @@ enum
class ZlibException : Exception
{
- this(int errnum)
- { string msg;
-
+ private static string getmsg(int errnum) nothrow @nogc pure @safe
+ {
+ string msg;
switch (errnum)
{
case Z_STREAM_END: msg = "stream end"; break;
@@ -90,7 +90,12 @@ class ZlibException : Exception
case Z_VERSION_ERROR: msg = "version error"; break;
default: msg = "unknown error"; break;
}
- super(msg);
+ return msg;
+ }
+
+ this(int errnum)
+ {
+ super(getmsg(errnum));
}
}
@@ -104,7 +109,7 @@ class ZlibException : Exception
* buf = buffer containing input data
*
* Returns:
- * A $(D uint) checksum for the provided input data and starting checksum
+ * A `uint` checksum for the provided input data and starting checksum
*
* See_Also:
* $(LINK http://en.wikipedia.org/wiki/Adler-32)
@@ -147,7 +152,7 @@ uint adler32(uint adler, const(void)[] buf)
* buf = buffer containing input data
*
* Returns:
- * A $(D uint) checksum for the provided input data and starting checksum
+ * A `uint` checksum for the provided input data and starting checksum
*
* See_Also:
* $(LINK http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
@@ -191,13 +196,14 @@ uint crc32(uint crc, const(void)[] buf)
ubyte[] compress(const(void)[] srcbuf, int level)
in
{
- assert(-1 <= level && level <= 9);
+ assert(-1 <= level && level <= 9, "Compression level needs to be within [-1, 9].");
}
-body
+do
{
import core.memory : GC;
+ import std.array : uninitializedArray;
auto destlen = srcbuf.length + ((srcbuf.length + 1023) / 1024) + 12;
- auto destbuf = new ubyte[destlen];
+ auto destbuf = uninitializedArray!(ubyte[])(destlen);
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, size_t destlen = 0u, int winbits = 15)
throw new ZlibException(err);
}
}
- assert(0);
+ assert(0, "Unreachable code");
}
@system unittest
@@ -370,9 +376,9 @@ class Compress
this(int level, HeaderFormat header = HeaderFormat.deflate)
in
{
- assert(1 <= level && level <= 9);
+ assert(1 <= level && level <= 9, "Legal compression level are in [1, 9].");
}
- body
+ do
{
this.level = level;
this.gzip = header == HeaderFormat.gzip;
@@ -406,6 +412,7 @@ class Compress
const(void)[] compress(const(void)[] buf)
{
import core.memory : GC;
+ import std.array : uninitializedArray;
int err;
ubyte[] destbuf;
@@ -420,7 +427,7 @@ class Compress
inited = 1;
}
- destbuf = new ubyte[zs.avail_in + buf.length];
+ destbuf = uninitializedArray!(ubyte[])(zs.avail_in + buf.length);
zs.next_out = destbuf.ptr;
zs.avail_out = to!uint(destbuf.length);
@@ -461,9 +468,10 @@ class Compress
void[] flush(int mode = Z_FINISH)
in
{
- assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH);
+ assert(mode == Z_FINISH || mode == Z_SYNC_FLUSH || mode == Z_FULL_FLUSH,
+ "Mode must be either Z_FINISH, Z_SYNC_FLUSH or Z_FULL_FLUSH.");
}
- body
+ do
{
import core.memory : GC;
ubyte[] destbuf;
@@ -523,6 +531,7 @@ class UnCompress
z_stream zs;
int inited;
int done;
+ bool inputEnded;
size_t destbufsize;
HeaderFormat format;
@@ -571,16 +580,16 @@ class UnCompress
const(void)[] uncompress(const(void)[] buf)
in
{
- assert(!done);
+ assert(!done, "Buffer has been flushed.");
}
- body
+ do
{
+ if (inputEnded || !buf.length)
+ return null;
+
import core.memory : GC;
+ import std.array : uninitializedArray;
int err;
- ubyte[] destbuf;
-
- if (buf.length == 0)
- return null;
if (!inited)
{
@@ -598,26 +607,152 @@ class UnCompress
if (!destbufsize)
destbufsize = to!uint(buf.length) * 2;
- destbuf = new ubyte[zs.avail_in * 2 + destbufsize];
- zs.next_out = destbuf.ptr;
- zs.avail_out = to!uint(destbuf.length);
-
- if (zs.avail_in)
- buf = zs.next_in[0 .. zs.avail_in] ~ cast(ubyte[]) buf;
+ auto destbuf = uninitializedArray!(ubyte[])(destbufsize);
+ size_t destFill;
zs.next_in = cast(ubyte*) buf.ptr;
zs.avail_in = to!uint(buf.length);
- err = inflate(&zs, Z_NO_FLUSH);
- if (err != Z_STREAM_END && err != Z_OK)
+ while (true)
{
- GC.free(destbuf.ptr);
- error(err);
+ auto oldAvailIn = zs.avail_in;
+
+ zs.next_out = destbuf[destFill .. $].ptr;
+ zs.avail_out = to!uint(destbuf.length - destFill);
+
+ err = inflate(&zs, Z_NO_FLUSH);
+ if (err == Z_STREAM_END)
+ {
+ inputEnded = true;
+ break;
+ }
+ else if (err != Z_OK)
+ {
+ GC.free(destbuf.ptr);
+ error(err);
+ }
+ else if (!zs.avail_in)
+ break;
+
+ /*
+ According to the zlib manual inflate() stops when either there's
+ no more data to uncompress or the output buffer is full
+ So at this point, the output buffer is too full
+ */
+
+ destFill = destbuf.length;
+
+ if (destbuf.capacity)
+ {
+ if (destbuf.length < destbuf.capacity)
+ destbuf.length = destbuf.capacity;
+ else
+ {
+ auto newLength = GC.extend(destbuf.ptr, destbufsize, destbufsize);
+
+ if (newLength && destbuf.length < destbuf.capacity)
+ destbuf.length = destbuf.capacity;
+ else
+ destbuf.length += destbufsize;
+ }
+ }
+ else
+ destbuf.length += destbufsize;
}
+
destbuf.length = destbuf.length - zs.avail_out;
return destbuf;
}
+ // Test for issues 3191 and 9505
+ @system unittest
+ {
+ import std.algorithm.comparison;
+ import std.array;
+ import std.file;
+ import std.zlib;
+
+ // Data that can be easily compressed
+ ubyte[1024] originalData;
+
+ // This should yield a compression ratio of at least 1/2
+ auto compressedData = compress(originalData, 9);
+ assert(compressedData.length < originalData.length / 2,
+ "The compression ratio is too low to accurately test this situation");
+
+ auto chunkSize = compressedData.length / 4;
+ assert(chunkSize < compressedData.length,
+ "The length of the compressed data is too small to accurately test this situation");
+
+ auto decompressor = new UnCompress();
+ ubyte[originalData.length] uncompressedData;
+ ubyte[] reusedBuf;
+ int progress;
+
+ reusedBuf.length = chunkSize;
+
+ for (int i = 0; i < compressedData.length; i += chunkSize)
+ {
+ auto len = min(chunkSize, compressedData.length - i);
+ // simulate reading from a stream in small chunks
+ reusedBuf[0 .. len] = compressedData[i .. i + len];
+
+ // decompress using same input buffer
+ auto chunk = decompressor.uncompress(reusedBuf);
+ assert(progress + chunk.length <= originalData.length,
+ "The uncompressed result is bigger than the original data");
+
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
+ progress += chunk.length;
+ }
+
+ auto chunk = decompressor.flush();
+ assert(progress + chunk.length <= originalData.length,
+ "The uncompressed result is bigger than the original data");
+
+ uncompressedData[progress .. progress + chunk.length] = cast(const ubyte[]) chunk[];
+ progress += chunk.length;
+
+ assert(progress == originalData.length,
+ "The uncompressed and the original data sizes differ");
+ assert(originalData[] == uncompressedData[],
+ "The uncompressed and the original data differ");
+ }
+
+ @system unittest
+ {
+ ubyte[1024] invalidData;
+ auto decompressor = new UnCompress();
+
+ try
+ {
+ auto uncompressedData = decompressor.uncompress(invalidData);
+ }
+ catch (ZlibException e)
+ {
+ assert(e.msg == "data error");
+ return;
+ }
+
+ assert(false, "Corrupted data didn't result in an error");
+ }
+
+ @system unittest
+ {
+ ubyte[2014] originalData = void;
+ auto compressedData = compress(originalData, 9);
+
+ auto decompressor = new UnCompress();
+ auto uncompressedData = decompressor.uncompress(compressedData ~ cast(ubyte[]) "whatever");
+
+ assert(originalData.length == uncompressedData.length,
+ "The uncompressed and the original data sizes differ");
+ assert(originalData[] == uncompressedData[],
+ "The uncompressed and the original data differ");
+ assert(!decompressor.uncompress("whatever").length,
+ "Compression continued after the end");
+ }
+
/**
* Decompress and return any remaining data.
* The returned data should be appended to that returned by uncompress().
@@ -626,49 +761,40 @@ class UnCompress
void[] flush()
in
{
- assert(!done);
+ assert(!done, "Buffer has been flushed before.");
}
out
{
- assert(done);
+ assert(done, "Flushing failed.");
}
- body
+ do
{
- import core.memory : GC;
- ubyte[] extra;
- ubyte[] destbuf;
- int err;
-
done = 1;
- if (!inited)
- return null;
+ return null;
+ }
- L1:
- destbuf = new ubyte[zs.avail_in * 2 + 100];
- zs.next_out = destbuf.ptr;
- zs.avail_out = to!uint(destbuf.length);
+ /// Returns true if all input data has been decompressed and no further data
+ /// can be decompressed (inflate() returned Z_STREAM_END)
+ @property bool empty() const
+ {
+ return inputEnded;
+ }
- err = etc.c.zlib.inflate(&zs, Z_NO_FLUSH);
- if (err == Z_OK && zs.avail_out == 0)
- {
- extra ~= destbuf;
- goto L1;
- }
- if (err != Z_STREAM_END)
- {
- GC.free(destbuf.ptr);
- if (err == Z_OK)
- err = Z_BUF_ERROR;
- error(err);
- }
- destbuf = destbuf.ptr[0 .. zs.next_out - destbuf.ptr];
- err = etc.c.zlib.inflateEnd(&zs);
- inited = 0;
- if (err)
- error(err);
- if (extra.length)
- destbuf = extra ~ destbuf;
- return destbuf;
+ ///
+ @system unittest
+ {
+ // some random data
+ ubyte[1024] originalData = void;
+
+ // append garbage data (or don't, this works in both cases)
+ auto compressedData = cast(ubyte[]) compress(originalData) ~ cast(ubyte[]) "whatever";
+
+ auto decompressor = new UnCompress();
+ auto uncompressedData = decompressor.uncompress(compressedData);
+
+ assert(uncompressedData[] == originalData[],
+ "The uncompressed and the original data differ");
+ assert(decompressor.empty, "The UnCompressor reports not being done");
}
}
--
2.28.0

View file

@ -1,51 +0,0 @@
From 58c529af8a9673b90dc7137065ab788c25b358a8 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/39] 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.28.0

View file

@ -1,42 +0,0 @@
From 2a614f9b702b02c312cd513eddb1fc6745f9a3ad 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/39] 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
@@ -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;
-char __gnat_shared_libgcc_default = STATIC;
+const char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
+char __gnat_shared_libgcc_default = SHARED;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib";
#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;
-char __gnat_shared_libgcc_default = STATIC;
+const char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
+char __gnat_shared_libgcc_default = SHARED;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
const char *__gnat_object_library_extension = ".a";
--
2.28.0

View file

@ -1,24 +0,0 @@
From dab36b973223e0d6853f564e845bc22dadcc4d2d 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/39] 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.28.0

View file

@ -1,32 +0,0 @@
From c2efb7703c2ef381a8b1d1cd751222e0a7e10665 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/39] 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.28.0

View file

@ -1,25 +0,0 @@
From ca8a8331acef15d0b3b095b8c63539acd1d93e8b 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/39] 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.28.0

View file

@ -1,31 +0,0 @@
From 23468db70f830e99ac138826d28cc33fa71d3405 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/39] 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.28.0

View file

@ -1,69 +0,0 @@
From 67513cb76a43014172f54384c3bad0c41e949c8a 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/39] DP: Use --push-state/--pop-state for gold as well when
linking libtsan.
---
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
@@ -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 "}" \
- " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " %{!static-libasan:--push-state --no-as-needed}" \
" -lasan " \
" %{static-libasan:" LD_DYNAMIC_OPTION "}" \
- " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
+ " %{!static-libasan:--pop-state}" \
STATIC_LIBASAN_LIBS
#else
#define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
@@ -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 "}" \
- " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " %{!static-libtsan:--push-state --no-as-needed}" \
" -ltsan " \
" %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
- " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
+ " %{!static-libtsan:--pop-state}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
@@ -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 "}" \
- " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " %{!static-liblsan:--push-state --no-as-needed}" \
" -llsan " \
" %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
- " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
+ " %{!static-liblsan:--pop-state}" \
STATIC_LIBLSAN_LIBS
#else
#define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
@@ -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 "}" \
- " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " %{!static-libubsan:--push-state --no-as-needed}" \
" -lubsan " \
" %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
- " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
+ " %{!static-libubsan:--pop-state}" \
STATIC_LIBUBSAN_LIBS
#else
#define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
--
2.28.0

View file

@ -1,47 +0,0 @@
From 5d9d38da4f523c052a5bcd2562d79809b4136f2c 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 24/39] Pure 64-bit MIPS
---
gcc/config/mips/mips.h | 8 ++++----
gcc/config/mips/t-linux64 | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 3ce0c19a29a..b9920b49167 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -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
-#define STANDARD_STARTFILE_PREFIX_1 "/lib32/"
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/"
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
#elif MIPS_ABI_DEFAULT == ABI_64
-#define STANDARD_STARTFILE_PREFIX_1 "/lib64/"
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/"
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
#endif
/* 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 ceb58d3b5f3..8116e23ebba 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
MULTILIB_OSDIRNAMES = \
- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+ ../lib \
+ ../lib32 \
+ ../lib
--
2.28.0

View file

@ -1,121 +0,0 @@
From ac0eeb3237ac2cf75c19be92afe3335c9a0d83bb 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/39] 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)))
-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
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)))
ifneq (,$(findstring powerpc64,$(target)))
-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
else
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)))
-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
endif
endif
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
MULTILIB_EXTRA_OPTS :=
-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
$(COMPILE) $<
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
MULTILIB_DIRNAMES += le
-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
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
MULTILIB_DIRNAMES += be
-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
+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.28.0

View file

@ -1,51 +0,0 @@
From 3f35cf750117fa7cbceaf33e4bea008d0688bd93 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/39] always build libgcc_eh.a
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
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1159,10 +1160,6 @@ install-libunwind:
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -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
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \
--
2.28.0

View file

@ -1,135 +0,0 @@
From 48342d154084bb9610b8f02f93fcfc2aa606595a 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/39] 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;
- function pthread_rwlockattr_setkind_np
- (attr : access pthread_rwlockattr_t;
- pref : int) return int;
- pragma Import
- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
-
function pthread_rwlock_init
(mutex : access pthread_rwlock_t;
attr : access pthread_rwlockattr_t) return int;
@@ -466,11 +460,6 @@ package System.OS_Interface is
protocol : int) return int;
pragma Import (C, pthread_mutexattr_setprotocol);
- function pthread_mutexattr_setprioceiling
- (attr : access pthread_mutexattr_t;
- prioceiling : int) return int;
- pragma Import (C, pthread_mutexattr_setprioceiling);
-
type struct_sched_param is record
sched_priority : int; -- scheduling priority
end record;
diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb
index 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");
- function GNAT_has_cap_sys_nice return C.int;
- pragma Import
- (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
-- We do not have pragma Linker_Options ("-lcap"); here, because this
-- library is not present on many Linux systems. 'libcap' is the Linux
-- "capabilities" library, called by __gnat_has_cap_sys_nice.
@@ -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.
- function Get_Ceiling_Support return Boolean;
- -- Get the value of the Ceiling_Support constant (see below).
- -- Note well: If this function or related code is modified, it should be
- -- tested by hand, because automated testing doesn't exercise it.
-
- -------------------------
- -- Get_Ceiling_Support --
- -------------------------
-
- function Get_Ceiling_Support return Boolean is
- Ceiling_Support : Boolean := False;
- begin
- if Locking_Policy /= 'C' then
- return False;
- end if;
-
- declare
- function geteuid return Integer;
- pragma Import (C, geteuid, "geteuid");
- Superuser : constant Boolean := geteuid = 0;
- Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
- pragma Assert (Has_Cap in 0 | 1);
- begin
- Ceiling_Support := Superuser or else Has_Cap = 1;
- end;
-
- return Ceiling_Support;
- end Get_Ceiling_Support;
-
- pragma Warnings (Off, "non-static call not allowed in preelaborated unit");
- Ceiling_Support : constant Boolean := Get_Ceiling_Support;
- pragma Warnings (On, "non-static call not allowed in preelaborated unit");
-- 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.Operations is
-- Init_Mutex --
----------------
+ pragma Warnings (Off, "formal parameter * is not referenced");
function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
+ pragma Warnings (On, "formal parameter * is not referenced");
Mutex_Attr : aliased pthread_mutexattr_t;
Result, Result_2 : C.int;
@@ -360,16 +327,7 @@ package body System.Task_Primitives.Operations is
return Result;
end if;
- if Ceiling_Support then
- Result := pthread_mutexattr_setprotocol
- (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
- pragma Assert (Result = 0);
-
- Result := pthread_mutexattr_setprioceiling
- (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
- pragma Assert (Result = 0);
-
- elsif Locking_Policy = 'I' then
+ if Locking_Policy = 'I' then
Result := pthread_mutexattr_setprotocol
(Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Operations is
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
pragma Assert (Result = 0);
- Result := pthread_rwlockattr_setkind_np
- (RWlock_Attr'Access,
- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
- pragma Assert (Result = 0);
-
Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
pragma Assert (Result in 0 | ENOMEM);
--
2.28.0

View file

@ -1,223 +0,0 @@
From 0d517a7c90f9e21616c8ad0c66e24c1554f6658c 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/39] 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 595abf87d65..00858c24f53 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -90,6 +90,11 @@
#include <sys/param.h>
#include <sys/pstat.h>
#endif
+
+#if defined (linux)
+#define _GNU_SOURCE 1
+#include <sched.h>
+#endif
#ifdef __PikeOS__
#define __BSD_VISIBLE 1
@@ -3308,7 +3313,6 @@ __gnat_lwp_self (void)
#endif
#if defined (__linux__)
-#include <sched.h>
/* glibc versions earlier than 2.7 do not define the routines to handle
dynamically allocated CPU sets. For these targets, we use the static
@@ -3318,7 +3322,7 @@ __gnat_lwp_self (void)
/* Dynamic cpu sets */
-cpu_set_t *
+void *
__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3331,33 +3335,33 @@ __gnat_cpu_alloc_size (size_t count)
}
void
-__gnat_cpu_free (cpu_set_t *set)
+__gnat_cpu_free (void *set)
{
- CPU_FREE (set);
+ CPU_FREE ((cpu_set_t *) set);
}
void
-__gnat_cpu_zero (size_t count, cpu_set_t *set)
+__gnat_cpu_zero (size_t count, void *set)
{
- CPU_ZERO_S (count, set);
+ CPU_ZERO_S (count, (cpu_set_t *) set);
}
void
-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
+__gnat_cpu_set (int cpu, size_t count, void *set)
{
/* Ada handles CPU numbers starting from 1, while C identifies the first
CPU by a 0, so we need to adjust. */
- CPU_SET_S (cpu - 1, count, set);
+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
}
#else /* !CPU_ALLOC */
/* Static cpu sets */
-cpu_set_t *
+void *
__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
{
- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
+ return xmalloc (sizeof (cpu_set_t));
}
size_t
@@ -3367,23 +3371,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
}
void
-__gnat_cpu_free (cpu_set_t *set)
+__gnat_cpu_free (void *set)
{
free (set);
}
void
-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
{
- CPU_ZERO (set);
+ CPU_ZERO ((cpu_set_t *) set);
}
void
-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
{
/* Ada handles CPU numbers starting from 1, while C identifies the first
CPU by a 0, so we need to adjust. */
- CPU_SET (cpu - 1, set);
+ CPU_SET (cpu - 1, (cpu_set_t *) set);
}
#endif /* !CPU_ALLOC */
#endif /* __linux__ */
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 311e240dfcc..1c4d0050103 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -316,13 +316,11 @@ extern void *__gnat_lwp_self (void);
/* Routines for interface to required CPU set primitives */
-#include <sched.h>
-
-extern cpu_set_t *__gnat_cpu_alloc (size_t);
+extern void * __gnat_cpu_alloc (size_t);
extern size_t __gnat_cpu_alloc_size (size_t);
-extern void __gnat_cpu_free (cpu_set_t *);
-extern void __gnat_cpu_zero (size_t, cpu_set_t *);
-extern void __gnat_cpu_set (int, size_t, cpu_set_t *);
+extern void __gnat_cpu_free (void *);
+extern void __gnat_cpu_zero (size_t, void *);
+extern void __gnat_cpu_set (int, size_t, void *);
#endif
#if defined (_WIN32)
diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
index 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)
- 2- getpt (USE_GETPT)
+ 2- posix_openpt (USE_POSIX_OPENPT)
3- openpty (USE_OPENPTY)
When using the cloning device method, the macro USE_CLONE_DEVICE should
@@ -1159,7 +1159,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
#elif defined (__linux__)
-#define USE_GETPT
+#define USE_POSIX_OPENPT
#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
@@ -1208,8 +1208,8 @@ allocate_pty_desc (pty_desc **desc) {
int master_fd = -1;
char *slave_name = NULL;
-#ifdef USE_GETPT
- master_fd = getpt ();
+#if defined(USE_POSIX_OPENPT)
+ master_fd = posix_openpt(O_RDWR | O_NOCTTY);
#elif defined (USE_OPENPTY)
status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
#elif defined (USE_CLONE_DEVICE)
--
2.28.0

View file

@ -1,48 +0,0 @@
From 3d86ab883c2a67dc9828f73a3d84c9fdb202ec32 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 17:58:08 +0200
Subject: [PATCH 29/39] gcc-go: Use _off_t type instead of _loff_t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/go/syscall/libcall_linux.go | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 88286c07b6e..f8f5cfb5011 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -206,19 +206,19 @@ func Gettid() (tid int) {
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
-//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
-//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
+//sys splice(rfd int, roff *_off_t, wfd int, woff *_off_t, len int, flags int) (n int64, err error)
+//splice(rfd _C_int, roff *_off_t, wfd _C_int, woff *_off_t, len Size_t, flags _C_uint) Ssize_t
func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
- var lroff _loff_t
- var plroff *_loff_t
+ var lroff _off_t
+ var plroff *_off_t
if roff != nil {
- lroff = _loff_t(*roff)
+ lroff = _off_t(*roff)
plroff = &lroff
}
- var lwoff _loff_t
- var plwoff *_loff_t
+ var lwoff _off_t
+ var plwoff *_off_t
if woff != nil {
- lwoff = _loff_t(*woff)
+ lwoff = _off_t(*woff)
plwoff = &lwoff
}
n, err = splice(rfd, plroff, wfd, plwoff, len, flags)
--
2.28.0

View file

@ -1,30 +0,0 @@
From da63b5262701f91a2261812332f2850be0180634 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 17:58:21 +0200
Subject: [PATCH 30/39] gcc-go: Don't include sys/user.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/sysinfo.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c
index 0692fd41eb7..c8d987358d9 100644
--- a/libgo/sysinfo.c
+++ b/libgo/sysinfo.c
@@ -73,9 +73,6 @@
#include <sys/times.h>
#include <sys/wait.h>
#include <sys/un.h>
-#if defined(HAVE_SYS_USER_H)
-#include <sys/user.h>
-#endif
#if defined(HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
#endif
--
2.28.0

View file

@ -1,29 +0,0 @@
From 18d6d2d1f62a4232340696fb7d68d248c751e416 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 17:59:22 +0200
Subject: [PATCH 31/39] gcc-go: Fix ucontext_t on PPC64
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/runtime/go-signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index b429fdb2403..fd1c885f043 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -224,7 +224,7 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
#elif defined(__alpha__) && defined(__linux__)
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
#elif defined(__PPC__) && defined(__linux__)
- ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
+ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
#elif defined(__PPC__) && defined(_AIX)
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
#elif defined(__aarch64__) && defined(__linux__)
--
2.28.0

View file

@ -1,43 +0,0 @@
From d9942a2e54f69dee9c03e5e4339a6c62473e6845 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 17:59:45 +0200
Subject: [PATCH 32/39] gcc-go: Fix handling of signal 34 on musl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/mksigtab.sh | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libgo/mksigtab.sh b/libgo/mksigtab.sh
index 11e4ec436bd..fe866eacb27 100644
--- a/libgo/mksigtab.sh
+++ b/libgo/mksigtab.sh
@@ -82,7 +82,7 @@ checksig _SIGPWR '{_SigNotify, "SIGPWR: power failure restart"}'
checksig _SIGEMT '{_SigThrow, "SIGEMT: emulate instruction executed"}'
checksig _SIGINFO '{_SigNotify, "SIGINFO: status request from keyboard"}'
checksig _SIGTHR '{_SigNotify, "SIGTHR: reserved"}'
-checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}'
+#checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}'
checksig _SIGWAITING '{_SigNotify, "SIGWAITING: reserved signal no longer used by"}'
checksig _SIGLWP '{_SigNotify, "SIGLWP: reserved signal no longer used by"}'
checksig _SIGFREEZE '{_SigNotify, "SIGFREEZE: special signal used by CPR"}'
@@ -95,10 +95,12 @@ checksig _SIGLOST ' {_SigNotify, "SIGLOST: resource lost (Sun); server died (G
# Special handling of signals 32 and 33 on GNU/Linux systems,
# because they are special to glibc.
+# Signal 34 is additionally special to Linux systems with musl.
if test "${GOOS}" = "linux"; then
- SIGLIST=$SIGLIST"_32__33_"
+ SIGLIST=$SIGLIST"_32__33__34_"
echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */'
echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */'
+ echo ' 34: {_SigSetStack + _SigUnblock, "signal 34"}, /* see issue 30062 */'
fi
if test "${GOOS}" = "aix"; then
--
2.28.0

View file

@ -1,38 +0,0 @@
From 38e7c12086acae4507f9d5067f947431a28c34db Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 18:01:03 +0200
Subject: [PATCH 33/39] gcc-go: Use int64 type as offset argument for mmap
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/go/runtime/mem_gccgo.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libgo/go/runtime/mem_gccgo.go b/libgo/go/runtime/mem_gccgo.go
index ba38ebaa9ab..3c9e5ce9461 100644
--- a/libgo/go/runtime/mem_gccgo.go
+++ b/libgo/go/runtime/mem_gccgo.go
@@ -15,7 +15,7 @@ import (
//go:linkname sysFree
//extern mmap
-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) unsafe.Pointer
//extern munmap
func munmap(addr unsafe.Pointer, length uintptr) int32
@@ -37,7 +37,7 @@ func init() {
}
}
-func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
+func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) (unsafe.Pointer, int) {
p := sysMmap(addr, n, prot, flags, fd, off)
if uintptr(p) == _MAP_FAILED {
return nil, errno()
--
2.28.0

View file

@ -1,38 +0,0 @@
From a4e800081081b00539bbb6fd8b5cf6b66504cfaa Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 18:02:28 +0200
Subject: [PATCH 34/39] gcc-go: Fix st_{a,m,c}tim fields in generated
sysinfo.go
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are more than one st_{a,m,c}tim fields in struct stat on time64 machines.
Run the Go-isation on all of them.
Taken from Adélie Linux.
---
libgo/mksysinfo.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index bd2ba32cba1..972e2c379bc 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -510,9 +510,9 @@ fi | sed -e 's/type _stat64/type Stat_t/' \
-e 's/st_size/Size/' \
-e 's/st_blksize/Blksize/' \
-e 's/st_blocks/Blocks/' \
- -e 's/st_atim/Atim/' \
- -e 's/st_mtim/Mtim/' \
- -e 's/st_ctim/Ctim/' \
+ -e 's/st_atim/Atim/g' \
+ -e 's/st_mtim/Mtim/g' \
+ -e 's/st_ctim/Ctim/g' \
-e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
-e 's/\([^a-zA-Z0-9_]\)_st_timespec_t\([^a-zA-Z0-9_]\)/\1StTimespec\2/g' \
--
2.28.0

View file

@ -1,29 +0,0 @@
From 57ccf0ad7f0c4b1f998ebfb6cdaa7d1876012d66 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 30 Aug 2020 18:03:03 +0200
Subject: [PATCH 35/39] gcc-go: signal 34 is special on musl libc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Taken from Adélie Linux.
---
libgo/go/runtime/signal_gccgo.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgo/go/runtime/signal_gccgo.go b/libgo/go/runtime/signal_gccgo.go
index c555712a03c..9e228580d37 100644
--- a/libgo/go/runtime/signal_gccgo.go
+++ b/libgo/go/runtime/signal_gccgo.go
@@ -106,7 +106,7 @@ func getsig(i uint32) uintptr {
if sigaction(i, nil, &sa) < 0 {
// On GNU/Linux glibc rejects attempts to call
// sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID).
- if GOOS == "linux" && (i == 32 || i == 33) {
+ if GOOS == "linux" && (i == 32 || i == 33 || i == 34) {
return _SIG_DFL
}
throw("sigaction read failure")
--
2.28.0

View file

@ -1,30 +0,0 @@
From e6d4cdd4d03cceb01e8ed03bbe7d35b5798abc88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 30 Aug 2020 19:26:53 +0200
Subject: [PATCH 36/39] gcc-go: Prefer _off_t over _off64_t
musl does not seem to have _off64_t.
---
libgo/mksysinfo.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 972e2c379bc..8d6da15f983 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -379,11 +379,7 @@ fi
# Some basic types.
echo 'type Size_t _size_t' >> ${OUT}
echo "type Ssize_t _ssize_t" >> ${OUT}
-if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then
- echo "type Offset_t _off64_t" >> ${OUT}
-else
- echo "type Offset_t _off_t" >> ${OUT}
-fi
+echo "type Offset_t _off_t" >> ${OUT}
echo "type Mode_t _mode_t" >> ${OUT}
echo "type Pid_t _pid_t" >> ${OUT}
echo "type Uid_t _uid_t" >> ${OUT}
--
2.28.0

View file

@ -1,27 +0,0 @@
From ac54a2afa01a3ebb06346f8dac505f0babbbe1a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 30 Aug 2020 19:27:51 +0200
Subject: [PATCH 37/39] gcc-go: undef SETCONTEXT_CLOBBERS_TLS in proc.c
---
libgo/runtime/proc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 274ce01c0bf..92a540bdde9 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -66,6 +66,10 @@ static void gscanstack(G*);
__thread G *g __asm__(GOSYM_PREFIX "runtime.g");
+/* libucontext does not seem to support tlsbase, undef the macro
+ * here to make sure we define initcontext and fixcontext as dummies. */
+#undef SETCONTEXT_CLOBBERS_TLS
+
#ifndef SETCONTEXT_CLOBBERS_TLS
static inline void
--
2.28.0

View file

@ -1,25 +0,0 @@
From e456a63af7f0bd1f519de98e74f864be0f73572a Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Mon, 31 Aug 2020 08:59:40 +0200
Subject: [PATCH 38/39] gcc-go: link to libucontext
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 63627db68cf..c7f1f84d683 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48823,7 +48823,7 @@ configure-target-libgo:
esac; \
module_srcdir=libgo; \
rm -f no-such-file || : ; \
- CONFIG_SITE=no-such-file $(SHELL) \
+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--
2.28.0

View file

@ -1,27 +0,0 @@
From f3a1e98d6d4d546bfb749b91c1f3639df905c1d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 31 Aug 2020 20:26:56 +0200
Subject: [PATCH 39/39] gcc-go: Disable printing of unaccessible ppc64 struct
members
These struct members do not seem to exist on musl.
---
libgo/runtime/go-signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
index fd1c885f043..e845e453332 100644
--- a/libgo/runtime/go-signal.c
+++ b/libgo/runtime/go-signal.c
@@ -333,7 +333,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
runtime_printf("sp %X\n", m->sc_regs[30]);
runtime_printf("pc %X\n", m->sc_pc);
}
-#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__)
+#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__GLIBC__)
{
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
int i;
--
2.28.0

View file

@ -1,692 +0,0 @@
# Automatically generated aport, do not edit!
# Generator: pmbootstrap aportgen gcc-x86_64
# Based on: main/gcc (from Alpine)
CTARGET_ARCH=x86_64
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
LANG_D=false
LANG_OBJC=false
LANG_JAVA=false
LANG_GO=false
LANG_FORTRAN=false
LANG_ADA=false
options="!strip !tracedeps"
# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH"
# when this variable matches "no*"
BOOTSTRAP="nobuildbase"
# abuild will only cross compile when this variable is set, but it
# needs to find a valid package database in there for dependency
# resolving, so we set it to /.
CBUILDROOT="/"
_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET"
pkgname=gcc-x86_64
_pkgbase=10.2.1
pkgver=10.2.1_pre0
[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross=""
[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
pkgname=gcc-x86_64
pkgrel=0
pkgdesc="Stage2 cross-compiler for x86_64"
url="https://gcc.gnu.org"
arch="x86_64"
license="GPL-2.0-or-later LGPL-2.1-or-later"
_gccrel=$pkgver-r$pkgrel
depends="isl binutils-x86_64 mpc1"
makedepends_build="gcc g++ paxmark bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev"
makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-x86_64 binutils-x86_64"
subpackages="g++-x86_64:gpp"
[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_target"
replaces="libstdc++ binutils"
: "${LANG_CXX:=true}"
: "${LANG_D:=true}"
: "${LANG_OBJC:=true}"
: "${LANG_GO:=true}"
: "${LANG_FORTRAN:=true}"
: "${LANG_ADA:=true}"
_libgomp=true
_libgcc=true
_libatomic=true
_libitm=true
if [ "$CHOST" != "$CTARGET" ]; then
if [ "$BOOTSTRAP" = nolibc ]; then
LANG_CXX=false
LANG_ADA=false
_libgcc=false
_builddir="$srcdir/build-cross-pass2"
else
_builddir="$srcdir/build-cross-final"
fi
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
_libgomp=false
_libatomic=false
_libitm=false
# reset target flags (should be set in crosscreate abuild)
# fixup flags. seems gcc treats CPPFLAGS as global without
# _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
export CFLAGS="$CPPFLAGS $CFLAGS"
export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
unset CPPFLAGS
export CFLAGS_FOR_TARGET=" "
export CXXFLAGS_FOR_TARGET=" "
export LDFLAGS_FOR_TARGET=" "
STRIP_FOR_TARGET="$CTARGET-strip"
elif [ "$CBUILD" != "$CHOST" ]; then
# fixup flags. seems gcc treats CPPFLAGS as global without
# _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
export CFLAGS="$CPPFLAGS $CFLAGS"
export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
unset CPPFLAGS
# reset flags and cc for build
export CC_FOR_BUILD="gcc"
export CXX_FOR_BUILD="g++"
export CFLAGS_FOR_BUILD=" "
export CXXFLAGS_FOR_BUILD=" "
export LDFLAGS_FOR_BUILD=" "
export CFLAGS_FOR_TARGET=" "
export CXXFLAGS_FOR_TARGET=" "
export LDFLAGS_FOR_TARGET=" "
# Languages that do not need bootstrapping
LANG_OBJC=false
LANG_GO=false
LANG_FORTRAN=false
LANG_D=false
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build-cross-native"
else
STRIP_FOR_TARGET=${CROSS_COMPILE}strip
_builddir="$srcdir/build"
fi
# GDC hasn't been ported to PowerPC
# See libphobos/configure.tgt in GCC sources for supported targets
[ "$CARCH" = ppc64le ] && LANG_D=false
# libitm has TEXTRELs in ARM build, so disable for now
case "$CTARGET_ARCH" in
arm*) _libitm=false ;;
mips*) _libitm=false ;;
esac
# Fortran uses libquadmath if toolchain has __float128
# currently on x86, x86_64 and ia64
_libquadmath=$LANG_FORTRAN
case "$CTARGET_ARCH" in
x86 | x86_64) _libquadmath=$LANG_FORTRAN ;;
*) _libquadmath=false ;;
esac
# libatomic is a dependency for openvswitch
$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH"
$_libgcc && subpackages="$subpackages libgcc::$CTARGET_ARCH"
$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH"
if $_libgomp; then
depends="$depends libgomp=$_gccrel"
subpackages="$subpackages libgomp::$CTARGET_ARCH"
fi
_languages=c
if $LANG_CXX; then
_languages="$_languages,c++"
fi
if $LANG_D; then
subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
_languages="$_languages,d"
makedepends_build="$makedepends_build libucontext-dev"
fi
if $LANG_OBJC; then
subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
_languages="$_languages,objc"
fi
if $LANG_GO; then
subpackages="$subpackages libgo::$CTARGET_ARCH gcc-go$_target:go"
_languages="$_languages,go"
fi
if $LANG_FORTRAN; then
subpackages="$subpackages libgfortran::$CTARGET_ARCH gfortran$_target:gfortran"
_languages="$_languages,fortran"
fi
if $LANG_ADA; then
subpackages="$subpackages libgnat::$CTARGET_ARCH gcc-gnat$_target:gnat"
_languages="$_languages,ada"
[ "$CBUILD" = "$CTARGET" ] && makedepends_build="$makedepends_build gcc-gnat-bootstrap"
[ "$CBUILD" != "$CTARGET" ] && makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross"
fi
makedepends="$makedepends_build $makedepends_host"
# when using upstream releases, use this URI template
# https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkgbase:-$pkgver}.tar.xz
#
# right now, we are using a git snapshot
source="https://dev.alpinelinux.org/~nenolod/gcc-10.2.1.tar.xz
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
0029-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch
0030-gcc-go-Don-t-include-sys-user.h.patch
0031-gcc-go-Fix-ucontext_t-on-PPC64.patch
0032-gcc-go-Fix-handling-of-signal-34-on-musl.patch
0033-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
0034-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch
0035-gcc-go-signal-34-is-special-on-musl-libc.patch
0036-gcc-go-Prefer-_off_t-over-_off64_t.patch
0037-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch
0038-gcc-go-link-to-libucontext.patch
0039-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch
"
# gcc-4.8-build-args.patch
# we build out-of-tree
_gccdir="$srcdir"/gcc-${_pkgbase:-$pkgver}
_gcclibdir="/usr/lib/gcc/$CTARGET/${_pkgbase:-$pkgver}"
_gcclibexec="/usr/libexec/gcc/$CTARGET/${_pkgbase:-$pkgver}"
prepare() {
cd "$_gccdir"
_err=
for i in $source; do
case "$i" in
*.patch)
msg "Applying $i"
patch -p1 -i "$srcdir"/$i || _err="$_err $i"
;;
esac
done
if [ -n "$_err" ]; then
error "The following patches failed:"
for i in $_err; do
echo " $i"
done
return 1
fi
echo ${_pkgbase:-$pkgver} > gcc/BASE-VER
}
build() {
local _arch_configure=
local _libc_configure=
local _bootstrap_configure=
local _symvers=
cd "$_gccdir"
case "$CTARGET" in
aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64";;
armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --with-abi=aapcs-linux";;
armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6zk --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=hard --with-abi=aapcs-linux";;
armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";;
mips-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";;
mips64-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";;
mips64el-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";;
mipsel-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";;
powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";;
powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no --enable-targets=powerpcle-linux";;
i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";;
i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=generic --enable-cld";;
s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
esac
case "$CTARGET_ARCH" in
mips*) _hash_style_configure="--with-linker-hash-style=sysv" ;;
*) _hash_style_configure="--with-linker-hash-style=gnu" ;;
esac
case "$CTARGET_LIBC" in
musl)
# musl does not support mudflap, or libsanitizer
# libmpx uses secure_getenv and struct _libc_fpstate not present in musl
# alpine musl provides libssp_nonshared.a, so we don't need libssp either
_libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer"
_symvers="--disable-symvers"
export libat_cv_have_ifunc=no
;;
esac
case "$BOOTSTRAP" in
nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
*) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
esac
$_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
$_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
$_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
$_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
echo " CBUILD=$CBUILD"
echo " CHOST=$CHOST"
echo " CTARGET=$CTARGET"
echo " CTARGET_ARCH=$CTARGET_ARCH"
echo " CTARGET_LIBC=$CTARGET_LIBC"
echo " languages=$_languages"
echo " arch_configure=$_arch_configure"
echo " libc_configure=$_libc_configure"
echo " cross_configure=$_cross_configure"
echo " bootstrap_configure=$_bootstrap_configure"
echo " hash_style_configure=$_hash_style_configure"
echo ""
export CFLAGS="$CFLAGS -O2"
mkdir -p "$_builddir"
cd "$_builddir"
"$_gccdir"/configure --prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--build=${CBUILD} \
--host=${CHOST} \
--target=${CTARGET} \
--with-pkgversion="Alpine $pkgver" \
--enable-checking=release \
--disable-fixed-point \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-nls \
--disable-werror \
$_symvers \
--enable-__cxa_atexit \
--enable-default-pie \
--enable-default-ssp \
--enable-cloog-backend \
--enable-languages=$_languages \
$_arch_configure \
$_libc_configure \
$_cross_configure \
$_bootstrap_configure \
--with-system-zlib \
$_hash_style_configure
make
}
package() {
cd "$_builddir"
make -j1 DESTDIR="$pkgdir" install
ln -s gcc "$pkgdir"/usr/bin/cc
# we dont support gcj -static
# and saving 35MB is not bad.
find "$pkgdir" \( -name libgtkpeer.a \
-o -name libgjsmalsa.a \
-o -name libgij.a \) \
-delete
# strip debug info from some static libs
find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libgphobos.a -o -name libgdruntime.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
-o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \
-a -type f \
-exec ${STRIP_FOR_TARGET} -g {} +
if $_libgomp; then
mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir
fi
if $_libitm; then
mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir
fi
# remove ffi
rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi*
find "$pkgdir" -name 'ffi*.h' -delete
local gdblib=${_target:+$CTARGET/}lib
if [ -d "$pkgdir"/usr/$gdblib/ ]; then
for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do
mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib
mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/
done
fi
paxmark -pmrs "$pkgdir"/$_gcclibexec/cc1
# move ada runtime libs
if $LANG_ADA; then
for i in $(find "$pkgdir"/$_gcclibdir/adalib/ -type f -maxdepth 1 -name "libgna*.so"); do
mv "$i" "$pkgdir"/usr/lib/
ln -s ../../../../${i##*/} $i
done
fi
if [ "$CHOST" != "$CTARGET" ]; then
# cross-gcc: remove any files that would conflict with the
# native gcc package
rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "${pkgdir:?}"/usr/share
# libcc1 does not depend on target, don't ship it
rm -rf "$pkgdir"/usr/lib/libcc1.so*
# fixup gcc library symlinks to be linker scripts so
# linker finds the libs from relocated sysroot
for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do
if [ -h "$so" ]; then
local _real=$(basename "$(readlink "$so")")
rm -f "$so"
echo "GROUP ($_real)" > "$so"
fi
done
else
# add c89/c99 wrapper scripts
cat >"$pkgdir"/usr/bin/c89 <<'EOF'
#!/bin/sh
_flavor="-std=c89"
for opt; do
case "$opt" in
-ansi|-std=c89|-std=iso9899:1990) _flavor="";;
-std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
EOF
cat >"$pkgdir"/usr/bin/c99 <<'EOF'
#!/bin/sh
_flavor="-std=c99"
for opt; do
case "$opt" in
-std=c99|-std=iso9899:1999) _flavor="";;
-std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2
exit 1;;
esac
done
exec gcc $_flavor ${1+"$@"}
EOF
chmod 755 "$pkgdir"/usr/bin/c?9
# install lto plugin so regular binutils may use it
mkdir -p "$pkgdir"/usr/lib/bfd-plugins
ln -s /$_gcclibexec/liblto_plugin.so "$pkgdir/usr/lib/bfd-plugins/"
fi
}
libatomic() {
pkgdesc="GCC Atomic library"
depends=
replaces="gcc"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libatomic.so.* "$subpkgdir"/usr/lib/
}
libcxx() {
pkgdesc="GNU C++ standard runtime library"
depends=
if [ "$CHOST" = "$CTARGET" ]; then
# verify that we are using clock_gettime rather than doing direct syscalls
# so we dont break 32 bit arches due to time64.
nm -D "$pkgdir"/usr/lib/libstdc++.so.* | grep clock_gettime
fi
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libstdc++.so.* "$subpkgdir"/usr/lib/
}
gpp() {
pkgdesc="GNU C++ standard library and compiler"
depends="libstdc++=$_gccrel gcc=$_gccrel libc-dev"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/usr/bin \
"$subpkgdir"/usr/${_target:+$CTARGET/}include \
"$subpkgdir"/usr/${_target:+$CTARGET/}lib \
mv "$pkgdir/$_gcclibexec/cc1plus" "$subpkgdir/$_gcclibexec/"
paxmark -pmrs "$subpkgdir/$_gcclibexec/cc1plus"
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/*++* "$subpkgdir"/usr/${_target:+$CTARGET/}lib/
mv "$pkgdir"/usr/${_target:+$CTARGET/}include/c++ "$subpkgdir"/usr/${_target:+$CTARGET/}include/
mv "$pkgdir"/usr/bin/*++ "$subpkgdir"/usr/bin/
}
libobjc() {
pkgdesc="GNU Objective-C runtime"
replaces="objc"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libobjc.so.* "$subpkgdir"/usr/lib/
}
objc() {
pkgdesc="GNU Objective-C"
replaces="gcc"
depends="libc-dev gcc=$_gccrel libobjc=$_gccrel"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include \
"$subpkgdir"/usr/lib
mv "$pkgdir/$_gcclibexec/cc1obj" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/objc "$subpkgdir"/$_gcclibdir/include/
mv "$pkgdir"/usr/lib/libobjc.so "$pkgdir"/usr/lib/libobjc.a \
"$subpkgdir"/usr/lib/
}
libgcc() {
pkgdesc="GNU C compiler runtime libraries"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgcc_s.so.* "$subpkgdir"/usr/lib/
}
libgomp() {
pkgdesc="GCC shared-memory parallel programming API library"
depends=
replaces="gcc"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/${_target:+$CTARGET/}lib/libgomp.so.* "$subpkgdir"/usr/lib/
}
libgphobos() {
pkgdesc="D programming language standard library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgdruntime.so.* "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.so.* "$subpkgdir"/usr/lib/
}
gdc() {
pkgdesc="GCC-based D language compiler"
depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
depends="$depends libucontext-dev"
mkdir -p "$subpkgdir/$_gcclibexec" \
"$subpkgdir"/$_gcclibdir/include/d/ \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
# Copy: The installed '.d' files, the static lib, the binary itself
# The shared libs are part of 'libgphobos' so one can run program
# without installing the compiler
mv "$pkgdir/$_gcclibexec/d21" "$subpkgdir/$_gcclibexec/"
mv "$pkgdir"/$_gcclibdir/include/d/* "$subpkgdir"/$_gcclibdir/include/d/
mv "$pkgdir"/usr/lib/libgdruntime.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.a "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/lib/libgphobos.spec "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/$CTARGET-gdc "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/gdc "$subpkgdir"/usr/bin/
}
libgo() {
pkgdesc="Go runtime library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgo.so.* "$subpkgdir"/usr/lib/
}
go() {
pkgdesc="Go support for GCC"
depends="gcc=$_gccrel libgo=$_gccrel !go"
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
mv "$pkgdir"/usr/lib/go "$subpkgdir"/usr/lib/
mv "$pkgdir"/usr/bin/*gccgo "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/*go "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/*gofmt "$subpkgdir"/usr/bin
mv "$pkgdir"/$_gcclibexec/go1 "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/cgo "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/buildid "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/test2json "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibexec/vet "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/usr/lib/libgo.a \
"$pkgdir"/usr/lib/libgo.so \
"$pkgdir"/usr/lib/libgobegin.a \
"$pkgdir"/usr/lib/libgolibbegin.a \
"$subpkgdir"/usr/lib/
}
libgfortran() {
pkgdesc="Fortran runtime library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgfortran.so.* "$subpkgdir"/usr/lib/
}
libquadmath() {
replaces="gcc"
pkgdesc="128-bit math library for GCC"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libquadmath.so.* "$subpkgdir"/usr/lib/
}
gfortran() {
pkgdesc="GNU Fortran Compiler"
depends="gcc=$_gccrel libgfortran=$_gccrel"
$_libquadmath && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/$_gcclibdir \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/*gfortran "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/lib/libgfortran.a \
"$pkgdir"/usr/lib/libgfortran.so \
"$subpkgdir"/usr/lib/
if $_libquadmath; then
mv "$pkgdir"/usr/lib/libquadmath.a \
"$pkgdir"/usr/lib/libquadmath.so \
"$subpkgdir"/usr/lib/
fi
mv "$pkgdir"/$_gcclibdir/finclude "$subpkgdir"/$_gcclibdir/
mv "$pkgdir"/$_gcclibexec/f951 "$subpkgdir"/$_gcclibexec
mv "$pkgdir"/usr/lib/libgfortran.spec "$subpkgdir"/$_gcclibdir
}
libgnat() {
pkgdesc="GNU Ada runtime shared libraries"
depends=
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/
}
gnat() {
pkgdesc="Ada support for GCC"
depends="gcc=$_gccrel"
provides="$pkgname-gnat-bootstrap"
[ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/$_gcclibdir \
"$subpkgdir"/usr/bin
mv "$pkgdir"/$_gcclibexec/*gnat* "$subpkgdir"/$_gcclibexec/
mv "$pkgdir"/$_gcclibdir/*ada* "$subpkgdir"/$_gcclibdir/
mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/
}
sha512sums="30c3e36c6e001d172b6219dbf5f0383655d29cbed8a197e1d6139213aacbfdb7cbca63553eedf3a4b35bd445a87ee0f555838d8b2cd7a46ab6bba7951a6b60c5 gcc-10.2.1.tar.xz
571e689369e1fd8a9281fed29f9ce5d35cdb6f892f5118216b2b171c5cd16ba5ab1f8f25f8438760bd26bc649b8f4703cc4e7a0918c250933398a37132fb3266 0001-posix_memalign.patch
2ca7d07543105955525e28a899f9cfbafa3f4f58cce8ae9931c20ddebe1126119a5001b8654e3ff7762f84de882dd609ae87f987b31a53dba6d6f5c7b6374a81 0002-gcc-poison-system-directories.patch
772b1bbae7c12cecef87d696603c523d5ea94a6c27f020f5873e6011479e43af735690a1137d4ec2a086946460ce4d411d5a9f00491015a73b04df39942d6dcd 0003-Turn-on-Wl-z-relro-z-now-by-default.patch
5d785525371fdfe89c5c36edf8c694083fc5d25870ef529473386de51e1db2f846d55a48087099230028acc1d076ad29c159603249aedc695cdf14844e2b26c7 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch
f467e975f904c01339696f27113ddccac321ef205db4855d46a2a7e9f4ec93e5ab5f9adc19e36a4ef6f61e87fcf9b089ea0727f3ea9736561fb4e9eec4bbf9b0 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch
49919bcbd59aea56be90e209d299ddb7b7a295d1db438a769279f4fe57ccf7a028a68227e31a22c1370037a4946a4c7c9ed5ac5044c163fb0f3795d3a2dc26cd 0006-Enable-Wformat-and-Wformat-security-by-default.patch
8374eaa22ef5f26d63226ded57042a8d7d2b69b415e3ff87ec2fc5046404dc062e2e096f329062d047d4e741ed2c5b58b6e1695cf070308f36c9558c6098fdcc 0007-Enable-Wtrampolines-by-default.patch
6be0db2455f5f678d37506773e4493a3cbaefd951486edb3374803813c749c2e6064218950cdc1c06f491fd95d4bd6ae9cbdf83148b332d172c20903eca03aa1 0008-Disable-ssp-on-nostdlib-nodefaultlibs-and-ffreestand.patch
d1d1a87177623439a929b42af57a997b48d9e1f6a4ff06b4f84c5f027fc461473dd36145671d2d61b50c0acfcf028d3361be9c95b3340e6e336b012de84f4252 0009-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch
167cc80faa6a9daca1a990e87bfc268f27cb620fcd488405f24e397b9a1d6f51a0238d85be4a87f2db93fc1e06ff05d569ce0a2e2fe4db65ec44e15dfb66b994 0010-Don-t-declare-asprintf-if-defined-as-a-macro.patch
85327918c409bf982c0dc13895324d6fc9cef1c68a3969ba5cf0a9450f2a04e3fa858af5ef7e432fc578cf6b0631cec55921bdcd361724c928eea943b4b5b2f3 0011-libiberty-copy-PIC-objects-during-build-process.patch
f65784f4eebec688f51598a306b9d034ba7feb0c6ac35a45e4f59585097fff820b3de90613941603985cdb5ee1a4c630381146bf2ee8429ffe80f0ffd5aa22c1 0012-libitm-disable-FORTIFY.patch
c489306880b493c92796e145dad372976ff90e42d8a97211e91db59bc75ca20244c96456dc806fd30f878f95878a37f4211f58b0f527b5808467a245186a0e14 0013-libgcc_s.patch
67a045fb5588eeb6776a98fbc0280a97e8b06e26909cab3e55346f6c81d87cf9ed7515afa3648b92ddd455e182fd5e44f6094e44f701676817f9d6fc3aad319e 0014-nopie.patch
b559a0f380065bd62d69359813e855819950a82c2361aa85771081de68bfe5d652936fbe5ad762f029016c643ffc8d62c0bf0e90460bd7d62a1c0f89ddcb5491 0015-libffi-use-__linux__-instead-of-__gnu_linux__-for-mu.patch
a42d56b0346208adb4a9f8575d53519c6303ead4eb498bed2ff36b9c20d904d9e1ba5996ec8ee35fb39ba91f30be28a6ab6c3c537a21078670c3ae88762b9a5b 0016-dlang-update-zlib-binding.patch
72313fd4829c8d153b8f4654863ff959597ac25fe657d641cfb5eafb42ae58662dd8581ac7a09eb6dadd2797e3585376fdd1f0207f23c061febdc37a85ea1ba1 0017-dlang-fix-fcntl-on-mips-add-libucontext-dep.patch
8f695b5f60d2effca4144373fb0e2d3f1ce4a0c4465669ffb3dd771794b0e18da73b2c3e3644403e91c786ad0c42b54bfeac22543280d40c1a1c2b441c434410 0018-ada-fix-shared-linking.patch
c6800ce569e2da9a379bbb94f1f064833ba66ea1e4dc555e66c45f4ab9e83f40264ca0d06d161df469449b05ddf04907f890b39a1fa8a2bc3e530777d4896371 0019-build-fix-CXXFLAGS_FOR_BUILD-passing.patch
5557ec2a754cd64451a8f186397ff79c509d5781a3e32ba11e6ea45356b13d28ba0b959663540d25725e4bd20934c029a90343bed03b2c0bd143ea73c7f47281 0020-libstdc-futex-add-time64-compatibility.patch
1844d044b1eb3cc72ef72c7efb0623d08d62bbb059dcc254524a378bcc37193126eb52894f6acfea31240457e51c435e28573346d3a19d3d045d12846c07ff8d 0021-add-fortify-headers-paths.patch
210b6a16411c1e5fd00c96c06472c3b7713417ef6f48ea8d127482664d63db8ff5226be2cb2b93420e5f153d96b48e02ba4937d2ad7172c6a0e52ac91a050a2d 0022-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch
4a1daeb55c1103b9b52061eb08a3782307e4c9e1a72f4fc20aaa1ecca02931a9678d6a71cbcf8aaf8898da4c95ad639f8d04de07f169d95c16fc58d0db31602e 0023-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch
80729605dac33f225eebecbcf6c319e2839c6924483a13bc186092f15f325bf3e972f68328546e394d9e216de0b00e6601ba768b0bb2633ff8c3c0747bb7b1fd 0024-Pure-64-bit-MIPS.patch
ba222bd9ceb95ea9aa729618b95ee81299d20dd5a7840bff47a046d92247e1ea9e2f65d192b1570724da5898fa950a0b8692d505b5c27005d4b143301fd86a52 0025-use-pure-64-bit-configuration-where-appropriate.patch
67e4426be0aeab6b62d7b5e72443f4ea71e4f3fab096b734d656601ad47d44120ef1d9fc87dfef6af2808b39d21cc161cf3d3e45744bd79b56a1071bef5cde94 0026-always-build-libgcc_eh.a.patch
1f9a62459a511a97620147b357a8d1129d1f33a45b3db3a16e049e33b62c23886c37b10152254e84a86d0d2736de06e68e029cf96fa607cf52f15d58e4925b94 0027-ada-libgnarl-compatibility-for-musl.patch
d610a309aebc1aa3a13ce57a69a185b129b02e34cac0f25d7ea3b1dde28551de5e0acc8952b7c877d1f63cbf8f245fb78555d41fee6a55d4d5f68fe92b6a3037 0028-ada-musl-support-fixes.patch
dfa4e5da6206793c63cffef67cf02a443116e63649e6b0466d3c6e24082e5f14eb2640fb9b1b433d2cc4d4755804a360b1b4c572f50638f27169c9f2ef271bdc 0029-gcc-go-Use-_off_t-type-instead-of-_loff_t.patch
22aec9116a2dc32add10efcf6bdc502933a318c668aaa9f01d9e7d6aebc1221fd8e6858abd610c556582f9cad0bc15ff7fbb08ca6c7fbe483c481cec3f361712 0030-gcc-go-Don-t-include-sys-user.h.patch
274b227d5d28e9c1d90ce1e29d5d88f938ea775cdd536bd51c8941a55994103ffb37222e395ab36b2fe4676aef106bb63bd510f73590e2ae434f4c6904454363 0031-gcc-go-Fix-ucontext_t-on-PPC64.patch
3c06cf909d3b07a7de89c67afa6596fdc4ed4445ddc299d3b037dab8cb08828726aa7136576ba6b36f4c8b80451215bc356c8f9141b1e1420010f1ad5444943f 0032-gcc-go-Fix-handling-of-signal-34-on-musl.patch
f0b6f30c6d934c751ab5d58f3656ab80e02ceac12954a124600b09f2de350ad5a2081a09c2eb5c046fe1969af5022ac27b3bc0c0652cd1986b402334825ca92d 0033-gcc-go-Use-int64-type-as-offset-argument-for-mmap.patch
7800ae263f8510341cfc4b0daf5771e309f8ac1df9b8b9ad199eb6c792a13d1550f59584a89eda396514692e43940f5f52039cdef64f49a3e1b9ef40282d81be 0034-gcc-go-Fix-st_-a-m-c-tim-fields-in-generated-sysinfo.patch
33ae7f190b29667d2740e5f8edb6e69946f5601c3d87e2874cb7314bdfaef798223c018006a1d1932a547d1139ebbce08c3cb8b5f563413eb2ae64b9b8668a1e 0035-gcc-go-signal-34-is-special-on-musl-libc.patch
5f56cecf4b1a00c47c58d75ac8390009d80c8733e63cda90483cbbcb2e89d4e63778e475292378df77e6d2b81603dc43f27b8bb9a36ea384a429f501e6e88eed 0036-gcc-go-Prefer-_off_t-over-_off64_t.patch
a4d3396a34e88723740fe52451992082974ddd2336257d173726f08955806349cbee9ddf1d9ec634365d374a0d61f6b28496ca326fba007b151bc3bed3097fa6 0037-gcc-go-undef-SETCONTEXT_CLOBBERS_TLS-in-proc.c.patch
85e1f94113cf9e6be00be810b484b2098913ddb6b9f088351e0ae4d96afe5782d7c8687dacda1db8ee7487d14f67ef836bcfe890e94221b6c112c587e373afe0 0038-gcc-go-link-to-libucontext.patch
d332bf5b2af982776aacee359737145b636eaf373214fc58f66666ec6add5032ae1d2cbff6380c0791a0a8010f3c73a68407cd8908385a9bb2ba0295ea3e2370 0039-gcc-go-Disable-printing-of-unaccessible-ppc64-struct.patch"