commit a1056023058e1bcbd7e057dcde56403b8d873f68
parent 7928de839ff8990304a6d308e193ec73fe82048d
Author: Dash Eclipse <dash@ezup.dev>
Date: Thu, 16 Jul 2020 18:35:24 +0000
Add srcpkgs/gcc/
Diffstat:
20 files changed, 1785 insertions(+), 0 deletions(-)
diff --git a/srcpkgs/gcc/files/c89.1 b/srcpkgs/gcc/files/c89.1
@@ -0,0 +1,80 @@
+.\" $NetBSD: c89.1,v 1.2 2008/04/30 13:10:50 martin Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd January 5, 1999
+.Dt C89 1
+.Os
+.Sh NAME
+.Nm c89
+.Nd ANSI (1989) C compiler
+.Sh SYNOPSIS
+.Nm
+.Op Fl pedantic
+.Op Fl pedantic-errors
+.Op Fl D_ANSI_SOURCE
+.Op options ...
+.Sh DESCRIPTION
+Calls the C compiler (cc) with the given
+.Ar options ,
+using a C language environment compatible with the
+.St -ansiC
+specification.
+.Pp
+This includes proper handling of trigraphs,
+disabling non-ANSI compiler features (such as
+.Ar asm ,
+.Ar inline ,
+.Ar typeof ,
+and the $ character in identifiers),
+and definition of the preprocessor symbol
+.Ev __STRICT_ANSI__ .
+.Pp
+The following options are available:
+.Bl -tag -width -pedantic-errorsxx
+.It Fl pedantic
+Issue extra warnings defined by ANSI for use of non-ANSI features.
+.It Fl pedantic-errors
+Issue errors instead of warnings that normally would be presented by
+.Fl pedantic .
+.It Fl D_ANSI_SOURCE
+Tell the system header file set to use an ANSI-conformant "clean" namespace.
+.El
+.Sh SEE ALSO
+.Xr cc 1
+.Sh STANDARDS
+.Nm
+conforms to
+.St -p1003.2-92 .
+.Sh HISTORY
+.Nm
+appeared in
+.Nx 1.4 .
+.Sh BUGS
+Since
+.Nm
+is a shell wrapper script to
+.Ar cc ,
+compile errors are prefixed by "cc:".
diff --git a/srcpkgs/gcc/files/c89.sh b/srcpkgs/gcc/files/c89.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/cc -std=c89 "$@"
diff --git a/srcpkgs/gcc/files/c99.1 b/srcpkgs/gcc/files/c99.1
@@ -0,0 +1,81 @@
+.\" $NetBSD: c99.1,v 1.3 2010/05/14 01:53:28 joerg Exp $
+.\"
+.\" Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd September 24, 2008
+.Dt C99 1
+.Os
+.Sh NAME
+.Nm c99
+.Nd ANSI (1999) C compiler
+.Sh SYNOPSIS
+.Nm
+.Op Fl pedantic
+.Op Fl pedantic-errors
+.Op Fl D_ANSI_SOURCE
+.Op options ...
+.Sh DESCRIPTION
+Calls the C compiler (cc) with the given
+.Ar options ,
+using a C language environment compatible with the
+.St -isoC-99
+specification.
+.Pp
+This includes
+inline functions, variable-length arrays, support for one-line
+comments beginning with //,
+disabling non-ANSI compiler features (such as
+.Ar asm ,
+.Ar typeof ,
+and the $ character in identifiers),
+and definition of the preprocessor symbol
+.Ev __STRICT_ANSI__ .
+.Pp
+The following options are available:
+.Bl -tag -width -pedantic-errorsxx
+.It Fl pedantic
+Issue extra warnings defined by ANSI for use of non-ANSI features.
+.It Fl pedantic-errors
+Issue errors instead of warnings that normally would be presented by
+.Fl pedantic .
+.It Fl D_ANSI_SOURCE
+Tell the system header file set to use an ANSI-conformant "clean" namespace.
+.El
+.Sh SEE ALSO
+.Xr cc 1
+.Sh STANDARDS
+.Nm
+conforms to
+.St -p1003.2-92 .
+.Sh HISTORY
+.Nm
+first appeared in
+.Nx 5.0 .
+.Sh BUGS
+Since
+.Nm
+is a shell wrapper script to
+.Ar cc ,
+compile errors are prefixed by "cc:".
diff --git a/srcpkgs/gcc/files/c99.sh b/srcpkgs/gcc/files/c99.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/cc -std=c99 "$@"
diff --git a/srcpkgs/gcc/files/gccgo-musl.patch b/srcpkgs/gcc/files/gccgo-musl.patch
@@ -0,0 +1,200 @@
+This is not among the normal patches as these changes are musl specific and
+there is no way to easily conditionalize it in source for some of the changes.
+
+Souurce: Adélie Linux, q66
+URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
+
+--- Makefile.in
++++ Makefile.in
+@@ -46325,7 +46325,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} \
+--- libgo/mksysinfo.sh
++++ 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}
+--- libgo/go/runtime/mem_gccgo.go
++++ libgo/go/runtime/mem_gccgo.go
+@@ -16,7 +16,7 @@ import (
+ //go:linkname sysFree runtime.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
+@@ -38,7 +38,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()
+--- libgo/go/runtime/signal_gccgo.go
++++ libgo/go/runtime/signal_gccgo.go
+@@ -111,7 +111,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")
+--- libgo/go/syscall/errstr.go
++++ libgo/go/syscall/errstr.go
+@@ -5,7 +5,6 @@
+ // license that can be found in the LICENSE file.
+
+ // +build !hurd
+-// +build !linux
+
+ package syscall
+
+--- libgo/go/syscall/errstr_glibc.go
++++ /dev/null
+@@ -1,33 +0,0 @@
+-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
+-
+-// Copyright 2010 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// We use this rather than errstr.go because on GNU/Linux sterror_r
+-// returns a pointer to the error message, and may not use buf at all.
+-
+-// +build hurd linux
+-
+-package syscall
+-
+-import "unsafe"
+-
+-//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
+-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
+-
+-func Errstr(errnum int) string {
+- a := make([]byte, 128)
+- p := strerror_r(errnum, a)
+- b := (*[1000]byte)(unsafe.Pointer(p))
+- i := 0
+- for b[i] != 0 {
+- i++
+- }
+- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
+- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
+- c := b[0] + 'a' - 'A'
+- return string(c) + string(b[1:i])
+- }
+- return string(b[:i])
+-}
+--- libgo/go/syscall/libcall_linux.go
++++ 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)
+--- libgo/mksigtab.sh
++++ 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
+--- libgo/runtime/go-signal.c
++++ libgo/runtime/go-signal.c
+@@ -222,7 +222,11 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
+ #endif
+ #ifdef __PPC__
+ #ifdef __linux__
+- ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
++ #ifdef __PPC64__
++ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
++ #else
++ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
++ #endif
+ #endif
+ #ifdef _AIX
+ ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
+@@ -343,7 +343,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
+ #endif
+ #endif
+
+-#if defined(__PPC__) && defined(__LITTLE_ENDIAN__)
++#if defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__GLIBC__)
+ #ifdef __linux__
+ {
+ mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
+--- libgo/sysinfo.c
++++ 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
diff --git a/srcpkgs/gcc/files/libgnarl-musl.patch b/srcpkgs/gcc/files/libgnarl-musl.patch
@@ -0,0 +1,125 @@
+Source: Alpine Linux
+Upstream: Unknown
+Reason: Patch libgnarl to not use function missing from musl.
+
+diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads
+--- gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads 2018-01-11 00:55:25.000000000 -0800
++++ gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads 2018-11-01 16:16:23.372452951 -0700
+@@ -394,12 +394,6 @@ package System.OS_Interface is
+ 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;
+@@ -464,11 +458,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 -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb
+--- gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb 2018-01-11 00:55:25.000000000 -0800
++++ gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb 2018-11-13 11:28:36.433964449 -0800
+@@ -202,9 +202,6 @@ package body System.Task_Primitives.Oper
+ 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.Oper
+ -- 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.Oper
+ -- 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.Oper
+ 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.Oper
+ 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);
+
diff --git a/srcpkgs/gcc/files/libssp-musl.patch b/srcpkgs/gcc/files/libssp-musl.patch
@@ -0,0 +1,43 @@
+First part taken from Alpine.
+
+Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -876,9 +876,8 @@
+ #endif
+
+ #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" \
+--- a/gcc/config/i386/gnu-user-common.h
++++ b/gcc/config/i386/gnu-user-common.h
+@@ -64,9 +64,3 @@ along with GCC; see the file COPYING3. If not see
+
+ /* Static stack checking is supported by means of probes. */
+ #define STACK_CHECK_STATIC_BUILTIN 1
+-
+-/* We only build the -fsplit-stack support in libgcc if the
+- assembler has full support for the CFI directives. */
+-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+-#define TARGET_CAN_SPLIT_STACK
+-#endif
+--- a/gcc/config/i386/gnu.h
++++ b/gcc/config/i386/gnu.h
+@@ -40,11 +40,6 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
+ /* i386 glibc provides __stack_chk_guard in %gs:0x14. */
+ #define TARGET_THREAD_SSP_OFFSET 0x14
+
+-/* We only build the -fsplit-stack support in libgcc if the
+- assembler has full support for the CFI directives. */
+-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+-#define TARGET_CAN_SPLIT_STACK
+-#endif
+ /* We steal the last transactional memory word. */
+ #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
+ #endif
diff --git a/srcpkgs/gcc/patches/0010-ldbl128-config.patch b/srcpkgs/gcc/patches/0010-ldbl128-config.patch
@@ -0,0 +1,76 @@
+From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Wed, 28 Feb 2018 00:54:05 +0000
+Subject: [PATCH 10/12] ldbl128 config
+
+---
+ gcc/configure | 13 +++++++++++++
+ gcc/configure.ac | 16 ++++++++++++++--
+ 2 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git gcc/configure gcc/configure
+index 6121e163259..07ff8597d48 100755
+--- gcc/configure
++++ gcc/configure
+@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
+ withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
+ else
+
++ case "$target" in
++ s390*-*-linux-musl*)
++ gcc_cv_target_ldbl128=yes
++ ;;
++ powerpc*-*-linux-musl*)
++ gcc_cv_target_ldbl128=no
++ ;;
++ *)
++
+ if test $glibc_version_major -gt 2 \
+ || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
+ gcc_cv_target_ldbl128=yes
+@@ -29320,6 +29329,10 @@ else
+ && gcc_cv_target_ldbl128=yes
+
+ fi
++
++ ;;
++ esac
++
+ fi
+
+ ;;
+diff --git gcc/configure.ac gcc/configure.ac
+index b066cc609e1..6c15ed898c0 100644
+--- gcc/configure.ac
++++ gcc/configure.ac
+@@ -5971,13 +5971,25 @@ case "$target" in
+ AC_ARG_WITH(long-double-128,
+ [AS_HELP_STRING([--with-long-double-128],
+ [use 128-bit long double by default])],
+- gcc_cv_target_ldbl128="$with_long_double_128",
++ gcc_cv_target_ldbl128="$with_long_double_128", [
++ case "$target" in
++ s390*-*-linux-musl*)
++ gcc_cv_target_ldbl128=yes
++ ;;
++ powerpc*-*-linux-musl*)
++ gcc_cv_target_ldbl128=no
++ ;;
++ *)]
+ [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
+ [gcc_cv_target_ldbl128=no
+ grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
+ $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
+ && gcc_cv_target_ldbl128=yes
+- ]])])
++ ]])]
++ [
++ ;;
++ esac
++ ])
+ ;;
+ esac
+ if test x$gcc_cv_target_ldbl128 = xyes; then
+--
+2.17.1
+
diff --git a/srcpkgs/gcc/patches/ada-shared.patch b/srcpkgs/gcc/patches/ada-shared.patch
@@ -0,0 +1,28 @@
+--- gcc/ada/link.c
++++ gcc/ada/link.c
+@@ -105,9 +105,9 @@
+
+ #elif defined (__FreeBSD__)
+ 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";
+@@ -127,9 +127,9 @@
+
+ #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";
diff --git a/srcpkgs/gcc/patches/fix-cxxflags-passing.patch b/srcpkgs/gcc/patches/fix-cxxflags-passing.patch
@@ -0,0 +1,10 @@
+--- Makefile.in.orig
++++ Makefile.in
+@@ -169,6 +169,7 @@
+ # built for the build system to override those in BASE_FLAGS_TO_PASSS.
+ EXTRA_BUILD_FLAGS = \
+ CFLAGS="$(CFLAGS_FOR_BUILD)" \
++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+
+ # This is the list of directories to built for the host system.
diff --git a/srcpkgs/gcc/patches/fix-musl-execinfo.patch b/srcpkgs/gcc/patches/fix-musl-execinfo.patch
@@ -0,0 +1,33 @@
+There is no <execinfo.h> in musl libc
+
+--- libvtv/vtv_rts.cc 2016-09-23 16:17:11.000000000 +0200
++++ libvtc/vtv_rts.cc 2016-09-25 15:08:57.896000000 +0200
+@@ -124,7 +124,7 @@
+ #include <windows.h>
+ #include <winternl.h>
+ #include <psapi.h>
+-#else
++#elif defined (__GLIBC__)
+ #include <execinfo.h>
+ #endif
+
+--- libvtv/vtv_utils.cc 2016-09-23 16:17:11.000000000 +0200
++++ libvtv/vtv_utils.cc 2016-09-25 15:15:35.529000000 +0200
+@@ -34,7 +34,7 @@
+ #include <string.h>
+ #if defined (__CYGWIN__) || defined (__MINGW32__)
+ #include <windows.h>
+-#else
++#elif defined (__GLIBC__)
+ #include <execinfo.h>
+ #endif
+
+@@ -178,7 +178,7 @@
+
+ __vtv_add_to_log (vtv_failures_log_fd, "%s", log_msg);
+
+-#if !defined (__CYGWIN__) && !defined (__MINGW32__)
++#if !defined (__CYGWIN__) && !defined (__MINGW32__) && defined(__GLIBC__)
+ if (generate_backtrace)
+ {
+ #define STACK_DEPTH 20
diff --git a/srcpkgs/gcc/patches/invalid_tls_model.patch b/srcpkgs/gcc/patches/invalid_tls_model.patch
@@ -0,0 +1,26 @@
+--- libgomp/configure.tgt 2018-11-08 18:13:04.000000000 +0100
++++ libgomp/configure.tgt 2019-06-29 20:06:31.972950350 +0200
+@@ -10,23 +10,6 @@
+ # XCFLAGS Add extra compile flags to use.
+ # XLDFLAGS Add extra link flags to use.
+
+-# Optimize TLS usage by avoiding the overhead of dynamic allocation.
+-if test $gcc_cv_have_tls = yes ; then
+- case "${target}" in
+-
+- *-*-k*bsd*-gnu*)
+- ;;
+-
+- *-*-linux* | *-*-gnu*)
+- XCFLAGS="${XCFLAGS} -ftls-model=initial-exec -DUSING_INITIAL_EXEC_TLS"
+- ;;
+-
+- *-*-rtems*)
+- XCFLAGS="${XCFLAGS} -ftls-model=local-exec"
+- ;;
+- esac
+-fi
+-
+ # Since we require POSIX threads, assume a POSIX system by default.
+ config_path="posix"
+
diff --git a/srcpkgs/gcc/patches/libffi_gnulinux.patch b/srcpkgs/gcc/patches/libffi_gnulinux.patch
@@ -0,0 +1,11 @@
+--- libffi/src/closures.c.orig
++++ 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
diff --git a/srcpkgs/gcc/patches/libgcc-ibm128-no-tag.patch b/srcpkgs/gcc/patches/libgcc-ibm128-no-tag.patch
@@ -0,0 +1,38 @@
+From 236634eed58fa6e00cc50f19e7202903a9d8fae6 Mon Sep 17 00:00:00 2001
+From: q66 <daniel@octaforge.org>
+Date: Thu, 12 Dec 2019 04:03:56 +0100
+Subject: [PATCH] libgcc: use -mno-gnu-attribute for 128-bit IBM ldouble
+ support code
+
+Doing this will allow libgcc to emit the appropriate symbols without actually
+emitting the FP ABI tag for them, which allows 64-bit long double environments
+to function and even link statically while still allowing usage of
+explicit __ibm128.
+---
+ libgcc/config/rs6000/t-ibm-ldouble | 2 +-
+ libgcc/config/rs6000/t-linux | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgcc/config/rs6000/t-ibm-ldouble b/libgcc/config/rs6000/t-ibm-ldouble
+index b132784..fb5eca8 100644
+--- libgcc/config/rs6000/t-ibm-ldouble
++++ libgcc/config/rs6000/t-ibm-ldouble
+@@ -1,6 +1,6 @@
+ # GCC 128-bit long double support routines.
+ LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
+
+-HOST_LIBGCC2_CFLAGS += -mlong-double-128
++HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-gnu-attribute
+
+ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ibm-ldouble.ver
+diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux
+index 4f6d4c4..fa93bb6 100644
+--- libgcc/config/rs6000/t-linux
++++ libgcc/config/rs6000/t-linux
+@@ -1,3 +1,3 @@
+ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
+
+-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
++HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-gnu-attribute -mno-minimal-toc
+--
+2.24.0
diff --git a/srcpkgs/gcc/patches/mips-sgidefs_h.patch b/srcpkgs/gcc/patches/mips-sgidefs_h.patch
@@ -0,0 +1,11 @@
+--- libffi/src/mips/ffitarget.h 2014-11-08 13:47:24.000000000 +0100
++++ libffi/src/mips/ffitarget.h 2017-11-09 16:51:11.866848444 +0100
+@@ -42,7 +42,7 @@
+ #define _MIPS_SIM_NABI32 2
+ #define _MIPS_SIM_ABI64 3
+ #elif !defined(__OpenBSD__)
+-# include <sgidefs.h>
++# include <asm/sgidefs.h>
+ #endif
+
+ # ifndef _ABIN32
diff --git a/srcpkgs/gcc/patches/mips-soft-float.patch b/srcpkgs/gcc/patches/mips-soft-float.patch
@@ -0,0 +1,18 @@
+--- libffi/src/mips/o32.S 2020-03-12 12:07:23.000000000 +0100
++++ libffi/src/mips/o32.S 2020-05-14 20:52:45.701809054 +0200
+@@ -278,6 +278,7 @@
+ li $9, FFI_TYPE_VOID
+ beq $8, $9, closure_done
+
++#ifndef __mips_soft_float
+ li $13, 1 # FFI_O32
+ bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+
+@@ -289,6 +290,7 @@
+ l.d $f0, V0_OFF2($fp)
+ beq $8, $9, closure_done
+ 1:
++#endif
+ REG_L $3, V1_OFF2($fp)
+ REG_L $2, V0_OFF2($fp)
+
diff --git a/srcpkgs/gcc/patches/musl-ada.patch b/srcpkgs/gcc/patches/musl-ada.patch
@@ -0,0 +1,204 @@
+diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
+index 3b0aea9..ee0bb69 100644
+--- gcc/ada/adaint.c
++++ gcc/ada/adaint.c
+@@ -76,6 +76,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
+@@ -3255,7 +3260,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
+@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void)
+
+ /* Dynamic cpu sets */
+
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count)
+ {
+ return CPU_ALLOC (count);
+@@ -3278,33 +3282,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
+@@ -3314,23 +3318,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 0d12f7e..a063b47 100644
+--- gcc/ada/adaint.h
++++ 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)
+--- gcc/ada/Makefile.rtl 2019-05-14 21:18:45.217455681 +0200
++++ gcc/ada/Makefile.rtl 2019-05-14 21:21:30.686464218 +0200
+@@ -1521,7 +1521,7 @@
+ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+ g-sercom.adb<libgnat/g-sercom__linux.adb \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ a-exetim.adb<libgnarl/a-exetim__posix.adb \
+ a-exetim.ads<libgnarl/a-exetim__default.ads \
+ s-linux.ads<libgnarl/s-linux.ads \
+@@ -2073,7 +2073,7 @@
+ s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+ g-sercom.adb<libgnat/g-sercom__linux.adb \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ system.ads<libgnat/system-linux-ppc.ads
+@@ -2102,7 +2102,7 @@
+ endif
+
+ # ARM linux, GNU eabi
+-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
++ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<libgnarl/a-intnam__linux.ads \
+ s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
+@@ -2297,7 +2297,7 @@
+ s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
+ g-sercom.adb<libgnat/g-sercom__linux.adb \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+ system.ads<libgnat/system-linux-ia64.ads
+@@ -2394,7 +2394,7 @@
+ s-taspri.ads<libgnarl/s-taspri__posix.ads \
+ g-sercom.adb<libgnat/g-sercom__linux.adb \
+ $(TRASYM_DWARF_UNIX_PAIRS) \
+- s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++ s-tsmona.adb<libgnat/s-tsmona.adb \
+ $(ATOMICS_TARGET_PAIRS) \
+ $(X86_64_TARGET_PAIRS) \
+ system.ads<libgnat/system-linux-x86.ads
+--- gcc/ada/terminals.c 2019-01-08 10:54:04.000000000 +0100
++++ gcc/ada/terminals.c 2019-05-15 13:14:09.935742526 +0200
+@@ -1136,7 +1136,7 @@
+ /* 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
+@@ -1150,7 +1150,7 @@
+ #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)
+@@ -1199,8 +1199,8 @@
+ 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)
diff --git a/srcpkgs/gcc/patches/ppc64-pure64.patch b/srcpkgs/gcc/patches/ppc64-pure64.patch
@@ -0,0 +1,57 @@
+--- gcc/config/rs6000/t-linux
++++ 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
+ ifneq (,$(findstring spe,$(target)))
+ MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
+@@ -14,7 +15,8 @@
+ 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
+
+--- gcc/config/rs6000/t-linux64
++++ 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) $<
+--- gcc/config/rs6000/t-linux64bele
++++ 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}
+--- gcc/config/rs6000/t-linux64lebe
++++ 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/srcpkgs/gcc/template b/srcpkgs/gcc/template
@@ -0,0 +1,738 @@
+# Template file for 'gcc'
+_majorver=9
+_minorver=${_majorver}.3
+_gmp_version=6.2.0
+_mpfr_version=4.0.2
+_mpc_version=1.1.0
+_isl_version=0.21
+
+pkgname=gcc
+version=${_minorver}.0
+revision=6
+short_desc="GNU Compiler Collection"
+maintainer="Enno Boland <gottox@voidlinux.org>"
+homepage="http://gcc.gnu.org"
+license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
+# *-musl builders have issues fetching https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
+distfiles="
+ ${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz
+ https://gmplib.org/download/gmp/gmp-${_gmp_version}.tar.xz
+ https://www.mpfr.org/mpfr-${_mpfr_version}/mpfr-${_mpfr_version}.tar.xz
+ ${GNU_SITE}/mpc/mpc-${_mpc_version}.tar.gz
+ http://isl.gforge.inria.fr/isl-${_isl_version}.tar.bz2"
+checksum="71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1
+ 258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526
+ 1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a
+ 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e
+ d18ca11f8ad1a39ab6d03d3dcb3365ab416720fcb65b42d69f34f51bf0a0e859"
+
+nopie=yes
+lib32disabled=yes
+bootstrap=yes
+replaces="gcc-gcj<7.2.0 gcc-gcj-jdk-compat<7.2.0 libmpx>=0 libmpx-devel>=0"
+
+_have_gccgo=yes
+
+# MIPS does not have libucontext yet
+# no support for ppcle in gccgo (missing GOARCH and stuff)
+case "$XBPS_TARGET_MACHINE" in
+ mips*-musl|ppcle*) _have_gccgo=no ;;
+esac
+
+if [ "$CHROOT_READY" ]; then
+ hostmakedepends="tar texinfo perl flex"
+else
+ _have_gccgo=no
+fi
+makedepends="zlib-devel"
+depends="binutils libgcc-devel-${version}_${revision}
+ libstdc++-devel-${version}_${revision} libssp-devel-${version}_${revision}"
+checkdepends="dejagnu"
+
+subpackages="libgcc libgomp libgomp-devel libatomic libatomic-devel"
+subpackages+=" libssp libssp-devel"
+
+build_options="ada gnatboot"
+build_options_default="ada"
+desc_option_ada="Enable Ada build"
+desc_option_gnatboot="Enable Ada bootstrap using adacore.com binaries"
+
+if [ "$build_option_gnatboot" ]; then
+ case "$XBPS_TARGET_MACHINE" in
+ x86_64)
+ _gnat_tarball="gnat-gpl-2017-x86_64-linux-bin.tar.gz"
+ distfiles+=" http://mirrors.cdn.adacore.com/art/591c6d80c7a447af2deed1d7>$_gnat_tarball"
+ checksum+=" b942bcac20dea39748b39f8b624d9619f60a8dee2e8195dbe3829c835b0956e6"
+ build_options_default="gnatboot"
+ ;;
+ i686)
+ _gnat_tarball="gnat-gpl-2014-x86-linux-bin.tar.gz"
+ distfiles+=" http://mirrors.cdn.adacore.com/art/564b3e9dc8e196b040fbe248>$_gnat_tarball"
+ checksum+=" 3b693510f5d22a240abb3034934c1adbd80ccd6e4f61a4f491cc408fdfd9c042"
+ build_options_default="gnatboot"
+ ;;
+ esac
+fi
+
+if [ "$CHROOT_READY" ]; then
+ subpackages+=" gcc-fortran libgfortran-devel libgfortran"
+ subpackages+=" gcc-objc gcc-objc++ libobjc-devel libobjc"
+fi
+
+if [ "$_have_gccgo" = "yes" ]; then
+ subpackages+=" gcc-go gcc-go-tools libgo-devel libgo"
+ # we need this for gcc-go on musl
+ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" libucontext-devel"
+ fi
+fi
+
+subpackages+=" libstdc++-devel libstdc++ libgcc-devel"
+if [ "$build_option_gnatboot" -o "$build_option_ada" ]; then
+ subpackages+=" gcc-ada libada-devel libada"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+ i686) _triplet="i686-pc-linux-gnu";;
+ i686-musl) _triplet="i686-linux-musl";;
+ x86_64) _triplet="x86_64-unknown-linux-gnu";;
+ x86_64-musl) _triplet="x86_64-linux-musl";;
+ armv5tel) _triplet="arm-linux-gnueabi";;
+ armv5tel-musl) _triplet="arm-linux-musleabi";;
+ armv6l) _triplet="arm-linux-gnueabihf";;
+ armv7l) _triplet="armv7l-linux-gnueabihf";;
+ armv6l-musl) _triplet="arm-linux-musleabihf";;
+ armv7l-musl) _triplet="armv7l-linux-musleabihf";;
+ aarch64) _triplet="aarch64-linux-gnu";;
+ aarch64-musl) _triplet="aarch64-linux-musl";;
+ ppc) _triplet="powerpc-linux-gnu";;
+ ppc-musl) _triplet="powerpc-linux-musl";;
+ ppcle) _triplet="powerpcle-linux-gnu";;
+ ppcle-musl) _triplet="powerpcle-linux-musl";;
+ ppc64le) _triplet="powerpc64le-linux-gnu";;
+ ppc64le-musl) _triplet="powerpc64le-linux-musl";;
+ ppc64) _triplet="powerpc64-linux-gnu";;
+ ppc64-musl) _triplet="powerpc64-linux-musl";;
+ mips-musl) _triplet="mips-linux-musl";;
+ mipshf-musl) _triplet="mips-linux-muslhf";;
+ mipsel-musl) _triplet="mipsel-linux-musl";;
+ mipselhf-musl) _triplet="mipsel-linux-muslhf";;
+esac
+case "$XBPS_TARGET_MACHINE" in
+ *-musl) depends+=" musl-devel";;
+ *) depends+=" glibc-devel"
+ subpackages+=" libsanitizer libsanitizer-devel"
+ ;;
+esac
+case "$XBPS_TARGET_MACHINE" in
+ i686*|x86_64*)
+ subpackages+=" libquadmath libquadmath-devel"
+ subpackages+=" libvtv libvtv-devel"
+ ;;
+ ppc64le)
+ subpackages+=" libquadmath libquadmath-devel"
+ ;;
+esac
+case "$XBPS_TARGET_MACHINE" in
+ mips*) ;;
+ x86_64*|i686) subpackages+=" libitm libitm-devel";;
+ *) subpackages+=" libitm libitm-devel";;
+esac
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" cross-${_triplet}"
+ if [ "$build_option_ada" ]; then
+ hostmakedepends+=" gcc-ada"
+ fi
+fi
+
+post_extract() {
+ mkdir -p ${wrksrc}/{gmp,mpfr,mpc,isl}
+ cp -ar ${XBPS_BUILDDIR}/gmp-${_gmp_version}/* ${wrksrc}/gmp/
+ cp -ar ${XBPS_BUILDDIR}/mpfr-${_mpfr_version}/* ${wrksrc}/mpfr/
+ cp -ar ${XBPS_BUILDDIR}/mpc-${_mpc_version}/* ${wrksrc}/mpc/
+ cp -ar ${XBPS_BUILDDIR}/isl-${_isl_version}/* ${wrksrc}/isl/
+
+ if [ "$build_option_gnatboot" ]; then
+ local f="${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_gnat_tarball}"
+ msg_normal "Extracting ${_gnat_tarball} ...\n"
+ mkdir -p ${wrksrc}/gnat-ins
+ tar -x -f "$f" --strip-components=1 -C ${wrksrc}/gnat-ins
+ cd ${wrksrc}/gnat-ins
+ make ins-all prefix=${wrksrc}/gnat
+ cd ${wrksrc}
+ rm -rf ${wrksrc}/gnat-ins
+
+ # Rename obsolete ld and as
+ find ${wrksrc}/gnat -name ld -exec mv -v {} {}.old \;
+ find ${wrksrc}/gnat -name as -exec mv -v {} {}.old \;
+ fi
+}
+
+pre_configure() {
+ # _FORTIFY_SOURCE needs an optimization level.
+ sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {gcc,libiberty}/configure
+ case "$XBPS_TARGET_MACHINE" in
+ *-musl)
+ patch -p1 -i ${FILESDIR}/libgnarl-musl.patch
+ patch -p1 -i ${FILESDIR}/libssp-musl.patch
+ patch -p0 -i ${FILESDIR}/gccgo-musl.patch
+ ;;
+ esac
+}
+do_configure() {
+ local _langs _args _hash
+
+ _hash=gnu
+ case "$XBPS_TARGET_MACHINE" in
+ mipselhf-musl) _args+=" --with-arch=mips32r2 --with-float=hard"; _hash=sysv;;
+ mipsel-musl) _args+=" --with-arch=mips32r2 --with-float=soft"; _hash=sysv;;
+ mipshf-musl) _args+=" --with-arch=mips32r2 --with-float=hard";;
+ mips-musl) _args+=" --with-arch=mips32r2 --with-float=soft";;
+ armv5*) _args+=" --with-arch=armv5te --with-float=soft";;
+ armv6l*) _args+=" --with-arch=armv6 --with-fpu=vfp --with-float=hard";;
+ armv7l*) _args+=" --with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard";;
+ aarch64*) # use lib not lib64 by default
+ _args+=" --with-arch=armv8-a"
+ sed -i '/m64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux
+ ;;
+ ppc) _args+=" --target=powerpc-linux-gnu --enable-secureplt";;
+ ppc-musl) _args+=" --target=powerpc-linux-musl --enable-secureplt --disable-decimal-float";;
+ ppcle) _args+=" --target=powerpcle-linux-gnu --enable-secureplt";;
+ ppcle-musl) _args+=" --target=powerpcle-linux-musl --enable-secureplt --disable-decimal-float";;
+ ppc64le*) # use lib not lib64 by default
+ _args+=" --target=${_triplet} --with-abi=elfv2 --enable-secureplt --enable-targets=powerpcle-linux"
+ sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
+ ;;
+ ppc64*) # use lib not lib64 by default
+ _args+=" --target=${_triplet} --with-abi=elfv2 --enable-secureplt --enable-targets=powerpc-linux"
+ sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
+ ;;
+ x86_64*) # use lib not lib64 by default
+ sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
+ sed -i 's/lib64/lib/' gcc/config/i386/linux64.h
+ ;;
+ esac
+
+ # fix: unknown long double size, cannot define BFP_FMT
+ case "$XBPS_TARGET_MACHINE" in
+ ppc64le-musl|ppc64-musl)
+ _args+=" --enable-decimal-float=no --disable-libquadmath"
+ ;;
+ ppc64)
+ _args+=" --disable-libquadmath"
+ ;;
+ *) ;;
+ esac
+
+ if [ -z "$CHROOT_READY" -o -n "$CROSS_BUILD" ]; then
+ _langs="c,c++,lto"
+ fi
+
+ if [ "$CROSS_BUILD" ]; then
+ export CC_FOR_TARGET="$CC"
+ export GCC_FOR_TARGET="$CC"
+ export CXX_FOR_TARGET="$CXX"
+ export GOC_FOR_TARGET="${_triplet}-gccgo"
+ export GFORTRAN_FOR_TARGET="${_triplet}-gfortran"
+
+ _args+=" --host=$XBPS_CROSS_TRIPLET"
+ _args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
+ _args+=" --enable-sjlj-exceptions=no"
+ _langs+=",objc,obj-c++,fortran"
+ elif [ -z "$CHROOT_READY" ]; then
+ export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib"
+ _args+=" --build=${_triplet}"
+ else
+ _langs="c,c++,objc,obj-c++,fortran,lto"
+ _args+=" --build=${_triplet}"
+ _args+=" --enable-fast-character"
+ fi
+
+ if [ "$_have_gccgo" = "yes" ]; then
+ _langs+=",go"
+ fi
+
+ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ _args+=" --disable-libsanitizer"
+ _args+=" --disable-symvers"
+ _args+=" libat_cv_have_ifunc=no"
+ fi
+
+ case "$XBPS_TARGET_MACHINE" in
+ ppc*) _args+=" --disable-vtable-verify";;
+ *) _args+=" --enable-vtable-verify";;
+ esac
+
+ export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
+ export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
+
+ # Disable explicit -fno-PIE, gcc will figure this out itself.
+ export CFLAGS="${CFLAGS//-fno-PIE/}"
+ export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
+ export LDFLAGS="${LDFLAGS//-no-pie/}"
+
+ _args+=" --prefix=/usr"
+ _args+=" --mandir=/usr/share/man"
+ _args+=" --infodir=/usr/share/info"
+ _args+=" --libexecdir=/usr/lib"
+ _args+=" --libdir=/usr/lib"
+ _args+=" --enable-threads=posix"
+ _args+=" --enable-__cxa_atexit"
+ _args+=" --disable-multilib"
+ _args+=" --with-system-zlib"
+ _args+=" --enable-shared"
+ _args+=" --enable-lto"
+ _args+=" --enable-plugins"
+ _args+=" --enable-linker-build-id"
+ _args+=" --disable-werror"
+ _args+=" --disable-nls"
+ _args+=" --enable-default-pie"
+ _args+=" --enable-default-ssp"
+ _args+=" --enable-checking=release"
+ _args+=" --disable-libstdcxx-pch"
+ _args+=" --with-isl"
+ _args+=" --with-linker-hash-style=$_hash"
+ _args+=" --disable-libunwind-exceptions"
+ _args+=" --disable-target-libiberty"
+
+ # --enable-serial-configure is broken when cross-compiling for
+ # some targets because it introduces make rule dependency cycles
+ if [ ! "$CROSS_BUILD" ]; then
+ _args+=" --enable-serial-configure"
+ fi
+
+ mkdir -p build
+ cd build
+ if [ "$build_option_gnatboot" ]; then
+ _args+=" --enable-languages=${_langs},ada"
+ _args+=" --enable-libada"
+ CONFIG_SHELL=/bin/bash \
+ CC="${wrksrc}/gnat/bin/gcc" \
+ GNATBIND="${wrksrc}/gnat/bin/gnatbind" \
+ GNATMAKE="${wrksrc}/gnat/bin/gnatmake" \
+ PATH="${wrksrc}/gnat/bin:$PATH" \
+ ${wrksrc}/configure ${_args}
+ elif [ "$build_option_ada" ]; then
+ _args+=" --enable-languages=${_langs},ada"
+ CONFIG_SHELL=/bin/bash \
+ ${wrksrc}/configure ${_args}
+ else
+ _args+=" --enable-languages=${_langs}"
+ CONFIG_SHELL=/bin/bash \
+ ${wrksrc}/configure ${_args}
+ fi
+}
+do_build() {
+ if [ -z "$CHROOT_READY" ]; then
+ export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib"
+ fi
+ cd build
+ if [ "$build_option_gnatboot" ]; then
+ CC="${wrksrc}/gnat/bin/gcc" \
+ GNATBIND="${wrksrc}/gnat/bin/gnatbind" \
+ GNATMAKE="${wrksrc}/gnat/bin/gnatmake" \
+ PATH="${wrksrc}/gnat/bin:$PATH" \
+ make ${makejobs}
+ else
+ make ${makejobs}
+ fi
+}
+pre_install() {
+ if [ "$CROSS_BUILD" ]; then
+ # XXX otherwise links to host libpthread
+ for f in $(find ${wrksrc}/build/${XBPS_CROSS_TRIPLET} -type f -name libtool); do
+ sed -e "s,add_dir=\"-L\$libdir\",add_dir=\"-L${XBPS_CROSS_BASE}\$libdir\",g" -i $f
+ done
+ fi
+}
+do_install() {
+ cd build
+ case "$XBPS_TARGET_MACHINE" in
+ x86_64*|aarch64*|ppc64*)
+ vmkdir usr/lib
+ ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/usr/lib64
+ ;;
+ esac
+ make DESTDIR=${DESTDIR} install
+
+ # Make version a symlink of major version to make all versions
+ # from the same series work automagically.
+ mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${version} \
+ ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
+ ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver} \
+ ${DESTDIR}/usr/lib/gcc/${_triplet}/${version}
+
+ # Ditto for c++ headers.
+ mv ${DESTDIR}/usr/include/c++/${version} \
+ ${DESTDIR}/usr/include/c++/${_minorver}
+ ln -sfr ${DESTDIR}/usr/include/c++/${_minorver} \
+ ${DESTDIR}/usr/include/c++/${version}
+
+ # cc symlink
+ ln -sfr ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc
+ # rpcgen wants /lib/cpp, make a symlink
+ ln -sfr ${DESTDIR}/usr/bin/cpp ${DESTDIR}/usr/lib/cpp
+
+ # lto plugin symlink
+ vmkdir usr/lib/bfd-plugins
+ ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${version}/liblto_plugin.so \
+ ${DESTDIR}/usr/lib/bfd-plugins
+
+ if [ -e ${DESTDIR}/usr/lib64 ]; then
+ rm -f ${DESTDIR}/usr/lib64
+ fi
+
+ # Remove libffi stuff.
+ rm -f ${DESTDIR}/usr/lib/libffi*
+ rm -f ${DESTDIR}/usr/share/man/man3/ffi*
+
+ # Remove all python scripts in libdir.
+ rm -f ${DESTDIR}/usr/lib/*.py
+
+ # Remove more python stuff.
+ if [ -d ${DESTDIR}/usr/share/gcc-${version}/python ]; then
+ rm -rf ${DESTDIR}/usr/share/gcc-${version}/python
+ fi
+
+ # Install c89 and c99 wrappers and its manpages, from NetBSD.
+ for f in c89 c99; do
+ vbin ${FILESDIR}/${f}.sh ${f}
+ vman ${FILESDIR}/${f}.1
+ done
+
+ case "$XBPS_TARGET_MACHINE" in
+ i686*|x86_64*|ppc64le) ;;
+ *) rm -f ${DESTDIR}/usr/share/info/libquadmath.info;;
+ esac
+}
+
+gcc-ada_package() {
+ lib32disabled=yes
+ depends="gcc>=${_minorver} libada-devel>=${_minorver}"
+ short_desc+=" - Ada compiler frontend"
+ pkg_install() {
+ for f in gnat{,bind,chop,clean,find,kr,link,ls,make,name,prep,xref}; do
+ vmove usr/bin/${f}
+ done
+ }
+}
+
+gcc-go_package() {
+ lib32disabled=yes
+ depends="gcc>=${_minorver} libgo-devel>=${_minorver}"
+ short_desc+=" - Go compiler frontend"
+ nostrip_files="buildid cgo test2json vet"
+ pkg_install() {
+ for f in gccgo ${_triplet}-gccgo; do
+ vmove usr/bin/${f}
+ done
+ for f in buildid cgo go1 test2json vet; do
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/${f}
+ done
+ vmove usr/share/info/gccgo.info
+ touch ${PKGDESTDIR}/usr/share/info/dir
+ vmove usr/share/man/man1/gccgo.1
+ vmove usr/lib/go
+ }
+}
+
+gcc-go-tools_package() {
+ lib32disabled=yes
+ depends="gcc-go>=${_minorver}"
+ short_desc+=" - Go tools"
+ conflicts="go>=0"
+ nostrip=yes
+ pkg_install() {
+ vmove usr/bin/go
+ vmove usr/bin/gofmt
+ vmove usr/share/man/man1/go.1
+ vmove usr/share/man/man1/gofmt.1
+ }
+}
+
+gcc-fortran_package() {
+ lib32disabled=yes
+ depends="gcc>=${_minorver} libgfortran-devel>=${_minorver}"
+ short_desc+=" - Fortran compiler frontend"
+ pkg_install() {
+ for f in gfortran ${_triplet}-gfortran; do
+ vmove usr/bin/${f}
+ done
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/f951
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/libcaf_single.a
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/finclude
+ if [ "$CROSS_BUILD" ]; then
+ # A number of OMP modules are not built when cross
+ # compiling gcc. Copy them from the cross compiler.
+ local src="/usr/lib/gcc/${_triplet}/${version}/finclude"
+ local dst="usr/lib/gcc/${_triplet}/${_minorver}/finclude"
+ for f in omp_lib.f90 omp_lib.h omp_lib.mod omp_lib_kinds.mod \
+ openacc.f90 openacc.mod openacc_kinds.mod openacc_lib.h; do
+ vinstall ${src}/${f} 644 ${dst}/
+ done
+ fi
+ vmove usr/share/info/gfortran.info
+ touch ${PKGDESTDIR}/usr/share/info/dir
+ vmove usr/share/man/man1/gfortran.1
+ }
+}
+
+gcc-objc++_package() {
+ lib32disabled=yes
+ depends="gcc-objc>=${_minorver}"
+ short_desc+=" - Objective-C++ support"
+ pkg_install() {
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/cc1objplus
+ }
+}
+
+gcc-objc_package() {
+ lib32disabled=yes
+ depends="gcc>=${_minorver} libobjc>=${_minorver}"
+ short_desc+=" - Objective-C support"
+ pkg_install() {
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/include/objc
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/cc1obj
+ }
+}
+
+libada-devel_package() {
+ depends="libada>=${_minorver}"
+ short_desc+=" - Ada library - development files"
+ pkg_install() {
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/adainclude
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/plugin/include/ada
+ }
+}
+
+libada_package() {
+ short_desc+=" - Ada library"
+ pkg_install() {
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/adalib
+ mv -v ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/adalib/libgna{rl,t}{,-${_majorver}}.so \
+ ${PKGDESTDIR}/usr/lib
+ }
+}
+
+libgfortran-devel_package() {
+ depends="libgfortran>=${_minorver}"
+ short_desc+=" - Fortran library - development files"
+ pkg_install() {
+ vmove usr/lib/libgfortran.spec
+ vmove usr/lib/libgfortran.a
+ # This does not seem to exist anymore?
+ if [ -f usr/lib/gcc/${_triplet}/${_minorver}/libgfortranbegin.a ]; then
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/libgfortranbegin.a
+ fi
+ }
+}
+
+libgfortran_package() {
+ short_desc+=" - Fortran library"
+ pkg_install() {
+ vmove "usr/lib/libgfortran.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libgo-devel_package() {
+ depends="libgo>=${_minorver}"
+ short_desc+=" - Go library - development files"
+ nostrip=yes
+ pkg_install() {
+ vmove usr/lib/libgo.a
+ vmove usr/lib/libgobegin.a
+ vmove usr/lib/libgolibbegin.a
+ vmove usr/lib/libgo.so
+ }
+}
+
+libgo_package() {
+ short_desc+=" - Go library"
+ nostrip=yes
+ pkg_install() {
+ vmove "usr/lib/libgo.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libobjc-devel_package() {
+ depends="libobjc>=${_minorver}"
+ short_desc+=" - Objective-C library - development files"
+ pkg_install() {
+ vmove "usr/lib/libobjc.*a"
+ }
+}
+
+libobjc_package() {
+ short_desc+=" - Objective-C library"
+ pkg_install() {
+ vmove "usr/lib/libobjc.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libquadmath-devel_package() {
+ depends="libquadmath>=${_minorver}"
+ short_desc+=" - quadmath library - development files"
+ pkg_install() {
+ vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/quadmath*"
+ vmove "usr/lib/libquadmath*.a"
+ vmove usr/share/info/libquadmath.info
+ touch ${PKGDESTDIR}/usr/share/info/dir
+ }
+}
+
+libquadmath_package() {
+ short_desc+=" - quadmath library"
+ pkg_install() {
+ vmove "usr/lib/libquadmath.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libvtv-devel_package() {
+ depends="libvtv>=${_minorver}"
+ short_desc+=" - Vtable Verification Runtime Library - development files"
+ pkg_install() {
+ vmove usr/lib/libvtv.a
+ vmove usr/lib/libvtv.so
+ }
+}
+
+libvtv_package() {
+ short_desc+=" - Vtable Verification Runtime Library"
+ pkg_install() {
+ vmove usr/lib/libvtv.so.*
+ }
+}
+
+libatomic-devel_package() {
+ depends="libatomic>=${_minorver}"
+ short_desc+=" - Atomics library - development files"
+ pkg_install() {
+ vmove usr/lib/libatomic.a
+ vmove usr/lib/libatomic.so
+ }
+}
+
+libatomic_package() {
+ short_desc+=" - Atomics library"
+ pkg_install() {
+ vmove usr/lib/libatomic.so.*
+ }
+}
+
+libgcc_package() {
+ short_desc+=" - GCC library"
+ replaces="libcilkrts<8.2.0"
+ noverifyrdeps=yes
+ pkg_install() {
+ vmove "usr/lib/libgcc_s.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libgcc-devel_package() {
+ depends="libgcc-${version}_${revision}"
+ short_desc+=" - GCC library - development files"
+ replaces="libcilkrts-devel<8.2.0"
+ pkg_install() {
+ vmove "usr/lib/gcc/${_triplet}/${_minorver}/*.o"
+ vmove "usr/lib/gcc/${_triplet}/${_minorver}/*.a"
+ }
+}
+
+libgomp-devel_package() {
+ depends="libgomp>=${_minorver}"
+ short_desc+=" - OpenMP v4.0 library - development files"
+ pkg_install() {
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/include/omp.h
+ vmove usr/lib/libgomp.so
+ vmove usr/lib/libgomp.a
+ vmove usr/lib/libgomp.spec
+ vmove usr/share/info/libgomp.info
+ touch ${PKGDESTDIR}/usr/share/info/dir
+ }
+}
+
+libgomp_package() {
+ short_desc+=" - OpenMP v4.0 library"
+ pkg_install() {
+ vmove "usr/lib/libgomp*.so.*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libitm-devel_package() {
+ depends="libitm>=${_minorver}"
+ short_desc+=" - Transactional Memory library - development files"
+ replaces="libitm<4.9.0_1"
+ pkg_install() {
+ vmove usr/lib/libitm.a
+ vmove usr/lib/libitm.so
+ vmove usr/lib/libitm.spec
+ vmove usr/share/info/libitm.info
+ touch ${PKGDESTDIR}/usr/share/info/dir
+ }
+}
+
+libitm_package() {
+ short_desc+=" - Transactional Memory library"
+ pkg_install() {
+ vmove "usr/lib/libitm.so.*"
+ }
+}
+
+libsanitizer-devel_package() {
+ depends="libsanitizer>=${_minorver}"
+ short_desc+=" - Sanitizer libraries - development files"
+ pkg_install() {
+ vmove "usr/lib/lib*san*.so"
+ vmove "usr/lib/lib*san*.a"
+ vmove usr/lib/libasan_preinit.o
+ vmove usr/lib/libsanitizer.spec
+ }
+}
+
+libsanitizer_package() {
+ short_desc+=" - Sanitizer libraries"
+ pkg_install() {
+ vmove "usr/lib/lib*san*.so.*"
+ }
+}
+
+libssp-devel_package() {
+ depends="libssp>=${_minorver}"
+ short_desc+=" - SSP (StackSmashingProtection) library - development files"
+ pkg_install() {
+ vmove "usr/lib/libssp*.a"
+ vmove usr/lib/gcc/${_triplet}/${_minorver}/include/ssp
+ }
+}
+
+libssp_package() {
+ short_desc+=" - SSP (StackSmashingProtection) library"
+ pkg_install() {
+ vmove "usr/lib/libssp.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
+
+libstdc++-devel_package() {
+ depends="libstdc++>=${_minorver}"
+ short_desc+=" - Standard C++ Library - development files"
+ pkg_install() {
+ vmove "usr/lib/libstdc++.*a"
+ vmove "usr/lib/libsupc++.*"
+ vmove usr/include/c++
+ }
+}
+
+libstdc++_package() {
+ short_desc+=" - Standard C++ Library"
+ pkg_install() {
+ vmove "usr/lib/libstdc++.so*"
+ vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+ }
+}
diff --git a/srcpkgs/gcc/update b/srcpkgs/gcc/update
@@ -0,0 +1,2 @@
+site="https://gcc.gnu.org/releases.html"
+pattern="GCC \K[\d.]+(?=\<)"