Github messages for voidlinux
 help / color / mirror / Atom feed
From: lane-brain <lane-brain@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New package: libgccjit-10.2.1_pre1
Date: Tue, 16 Feb 2021 18:19:35 +0100	[thread overview]
Message-ID: <20210216171935.bi2LfZ09cCPNw0li1Ssoh4ZlBcPAgSuXF2A0Gu0qHOs@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-28785@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

There is an updated pull request by lane-brain against master on the void-packages repository

https://github.com/lane-brain/void-packages libgccjit-void
https://github.com/void-linux/void-packages/pull/28785

New package: libgccjit-10.2.1_pre1
<!-- Mark items with [x] where applicable -->

#### General
- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [x] I built this PR locally for my native architecture, (x86_64-glibc)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

A patch file from https://github.com/void-linux/void-packages/pull/28785.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libgccjit-void-28785.patch --]
[-- Type: text/x-diff, Size: 96881 bytes --]

From 411d9929b4ed25956af216c643e9c165a8fc26a6 Mon Sep 17 00:00:00 2001
From: lane-brain <lane@mailbox.org>
Date: Mon, 15 Feb 2021 20:32:51 -0500
Subject: [PATCH 1/2] New package: libgccjit-10.2.1_pre1

---
 srcpkgs/libgccjit/files/c89.1                 |  80 ++++++
 srcpkgs/libgccjit/files/c89.sh                |   2 +
 srcpkgs/libgccjit/files/c99.1                 |  81 ++++++
 srcpkgs/libgccjit/files/c99.sh                |   2 +
 srcpkgs/libgccjit/files/gccgo-musl.patch      | 222 ++++++++++++++++
 srcpkgs/libgccjit/files/libgnarl-musl.patch   | 125 +++++++++
 srcpkgs/libgccjit/files/libssp-musl.patch     |  70 +++++
 srcpkgs/libgccjit/patches/ada-shared.patch    |  28 ++
 .../patches/consistent-library-paths.patch    | 110 ++++++++
 .../patches/fix-cxxflags-passing.patch        |  10 +
 .../libgccjit/patches/fix-musl-execinfo.patch |  33 +++
 .../patches/fix-vtv-link-order.patch          |  20 ++
 .../libgccjit/patches/libffi_gnulinux.patch   |  11 +
 .../patches/libgcc-ibm128-no-tag.patch        |  38 +++
 .../libgccjit/patches/mips-sgidefs_h.patch    |  11 +
 .../libgccjit/patches/mips-soft-float.patch   |  18 ++
 srcpkgs/libgccjit/patches/musl-ada.patch      | 204 +++++++++++++++
 srcpkgs/libgccjit/template                    | 241 ++++++++++++++++++
 srcpkgs/libgccjit/update                      |   2 +
 19 files changed, 1308 insertions(+)
 create mode 100644 srcpkgs/libgccjit/files/c89.1
 create mode 100644 srcpkgs/libgccjit/files/c89.sh
 create mode 100644 srcpkgs/libgccjit/files/c99.1
 create mode 100644 srcpkgs/libgccjit/files/c99.sh
 create mode 100644 srcpkgs/libgccjit/files/gccgo-musl.patch
 create mode 100644 srcpkgs/libgccjit/files/libgnarl-musl.patch
 create mode 100644 srcpkgs/libgccjit/files/libssp-musl.patch
 create mode 100644 srcpkgs/libgccjit/patches/ada-shared.patch
 create mode 100644 srcpkgs/libgccjit/patches/consistent-library-paths.patch
 create mode 100644 srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch
 create mode 100644 srcpkgs/libgccjit/patches/fix-musl-execinfo.patch
 create mode 100644 srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
 create mode 100644 srcpkgs/libgccjit/patches/libffi_gnulinux.patch
 create mode 100644 srcpkgs/libgccjit/patches/libgcc-ibm128-no-tag.patch
 create mode 100644 srcpkgs/libgccjit/patches/mips-sgidefs_h.patch
 create mode 100644 srcpkgs/libgccjit/patches/mips-soft-float.patch
 create mode 100644 srcpkgs/libgccjit/patches/musl-ada.patch
 create mode 100644 srcpkgs/libgccjit/template
 create mode 100644 srcpkgs/libgccjit/update

diff --git a/srcpkgs/libgccjit/files/c89.1 b/srcpkgs/libgccjit/files/c89.1
new file mode 100644
index 00000000000..3ed984da33f
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/files/c89.sh b/srcpkgs/libgccjit/files/c89.sh
new file mode 100644
index 00000000000..52d6d45431b
--- /dev/null
+++ b/srcpkgs/libgccjit/files/c89.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/cc -std=c89 "$@"
diff --git a/srcpkgs/libgccjit/files/c99.1 b/srcpkgs/libgccjit/files/c99.1
new file mode 100644
index 00000000000..d368f1a874b
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/files/c99.sh b/srcpkgs/libgccjit/files/c99.sh
new file mode 100644
index 00000000000..15cab47c748
--- /dev/null
+++ b/srcpkgs/libgccjit/files/c99.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/cc -std=c99 "$@"
diff --git a/srcpkgs/libgccjit/files/gccgo-musl.patch b/srcpkgs/libgccjit/files/gccgo-musl.patch
new file mode 100644
index 00000000000..a2ce4b2b046
--- /dev/null
+++ b/srcpkgs/libgccjit/files/gccgo-musl.patch
@@ -0,0 +1,222 @@
+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.
+
+Added by q66: runtime.h now uses libucontext_ prefixed APIs to allow build
+with freestanding versions of libucontext
+
+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	2020-07-23 08:35:19.004402840 +0200
++++ -	2020-08-09 21:35:54.352886232 +0200
+@@ -224,7 +224,11 @@
+ #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;
++	#ifdef __PPC64__
++		ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
++	#else
++		ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
++	#endif
+ #elif defined(__PPC__) && defined(_AIX)
+ 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
+ #elif defined(__aarch64__) && defined(__linux__)
+@@ -333,7 +337,7 @@
+ 		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(__linux__) && defined(__GLIBC__)
+ 	  {
+ 		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
+ 		int i;
+--- libgo/runtime/runtime.h
++++ libgo/runtime/runtime.h
+@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*);
+ void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
+ #else
+ #define __go_context_t	ucontext_t
+-#define __go_getcontext(c)	getcontext(c)
+-#define __go_setcontext(c)	setcontext(c)
++int  libucontext_getcontext(__go_context_t *);
++void libucontext_makecontext(__go_context_t *, void (*)(), int, ...);
++int  libucontext_setcontext(const __go_context_t *);
++#define __go_getcontext(c)	libucontext_getcontext(c)
++#define __go_setcontext(c)	libucontext_setcontext(c)
+ #define __go_makecontext(c, fn, sp, size) \
+-	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
++	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0))
+ #endif
+ 
+ // Symbols defined by the linker.
+--- 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/libgccjit/files/libgnarl-musl.patch b/srcpkgs/libgccjit/files/libgnarl-musl.patch
new file mode 100644
index 00000000000..5ed9f16f558
--- /dev/null
+++ b/srcpkgs/libgccjit/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/ada/libgnarl/s-osinte__linux.ads	2018-01-11 00:55:25.000000000 -0800
++++ 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/ada/libgnarl/s-taprop__linux.adb	2018-01-11 00:55:25.000000000 -0800
++++ 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/libgccjit/files/libssp-musl.patch b/srcpkgs/libgccjit/files/libssp-musl.patch
new file mode 100644
index 00000000000..e0b84f9acc9
--- /dev/null
+++ b/srcpkgs/libgccjit/files/libssp-musl.patch
@@ -0,0 +1,70 @@
+First part taken from Alpine.
+
+Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
+
+--- gcc/gcc.c
++++ gcc/gcc.c
+@@ -874,10 +874,15 @@ 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" \
+-		       "|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" \
+@@ -1155,7 +1160,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:\
+--- gcc/params.opt
++++ 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=
+--- gcc/config/i386/gnu-user-common.h
++++ 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
+--- gcc/config/i386/gnu.h
++++ 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/libgccjit/patches/ada-shared.patch b/srcpkgs/libgccjit/patches/ada-shared.patch
new file mode 100644
index 00000000000..7b4280620fe
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/consistent-library-paths.patch b/srcpkgs/libgccjit/patches/consistent-library-paths.patch
new file mode 100644
index 00000000000..1ec0e258526
--- /dev/null
+++ b/srcpkgs/libgccjit/patches/consistent-library-paths.patch
@@ -0,0 +1,110 @@
+Always use lib64 for 64-bit and lib32 for 32-bit.
+
+Do not change the dynamic linkers in any way, though.
+
+When adding a new platform, fix this up too.
+
+--- gcc/config/aarch64/t-aarch64-linux
++++ 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=../lib64
+ MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+ 
+ MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+--- gcc/config/i386/t-linux64
++++ 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=../lib64
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+--- gcc/config/mips/t-linux64
++++ 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))
++	../lib32 \
++	../lib \
++	../lib64
+--- 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=../lib64
++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=../lib64
++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=../lib64
++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=../lib64
++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=../lib64
++MULTILIB_OSDIRNAMES += m32=../lib32
+ MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
+--- gcc/config/s390/t-linux64
++++ 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=../lib64
++MULTILIB_OSDIRNAMES+= m32=../lib32
+-- 
+2.29.2
+
diff --git a/srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch b/srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch
new file mode 100644
index 00000000000..dda2a50460b
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/fix-musl-execinfo.patch b/srcpkgs/libgccjit/patches/fix-musl-execinfo.patch
new file mode 100644
index 00000000000..583eac7b0dc
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/fix-vtv-link-order.patch b/srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
new file mode 100644
index 00000000000..3315c3e990b
--- /dev/null
+++ b/srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
@@ -0,0 +1,20 @@
+put vtv_end.o in front of postdep_objects_CXX
+having it after crtendS.o leads to missing zero termination in eh_frame section
+
+This is in line with comment in libgcc/vtv_end.c:
+
+   When the GCC driver inserts vtv_start.o into the link line (just
+   after crtbegin.o) it also inserts vtv_end.o into the link line,
+   just before crtend.o.
+
+--- libstdc++-v3/configure
++++ libstdc++-v3/configure
+@@ -15443,7 +15443,7 @@
+ 
+ if test "$enable_vtable_verify" = yes; then
+   predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
+-  postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o"
++  postdep_objects_CXX="${glibcxx_builddir}/../libgcc/vtv_end.o ${postdep_objects_CXX}" 
+ fi
+ 
+ 
diff --git a/srcpkgs/libgccjit/patches/libffi_gnulinux.patch b/srcpkgs/libgccjit/patches/libffi_gnulinux.patch
new file mode 100644
index 00000000000..413b4aef5af
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/libgcc-ibm128-no-tag.patch b/srcpkgs/libgccjit/patches/libgcc-ibm128-no-tag.patch
new file mode 100644
index 00000000000..855f8f1b035
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/mips-sgidefs_h.patch b/srcpkgs/libgccjit/patches/mips-sgidefs_h.patch
new file mode 100644
index 00000000000..e5fdbf9f96f
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/mips-soft-float.patch b/srcpkgs/libgccjit/patches/mips-soft-float.patch
new file mode 100644
index 00000000000..4db0e2fb07a
--- /dev/null
+++ b/srcpkgs/libgccjit/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/libgccjit/patches/musl-ada.patch b/srcpkgs/libgccjit/patches/musl-ada.patch
new file mode 100644
index 00000000000..61823684da5
--- /dev/null
+++ b/srcpkgs/libgccjit/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	2020-07-23 08:35:17.052381336 +0200
++++ -	2020-08-09 19:38:24.230351406 +0200
+@@ -1533,7 +1533,7 @@
+   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 @@
+   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 @@
+ 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 @@
+   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 @@
+   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
+--- 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/libgccjit/template b/srcpkgs/libgccjit/template
new file mode 100644
index 00000000000..0e8551d062c
--- /dev/null
+++ b/srcpkgs/libgccjit/template
@@ -0,0 +1,241 @@
+# Template file for 'libgccjit'
+_majorver=10
+_minorver=${_majorver}.2
+_patchver=${_minorver}.1
+
+pkgname=libgccjit
+# we are using a 10-stable git snapshot alpine is using in order
+# to get regression fixes not yet incorporate into a stable release
+# it should be possible to switch back to stable with 10.3 or 11
+version=${_patchver}pre1
+wrksrc=gcc-${version/pre/_pre}
+revision=2
+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="https://dev.alpinelinux.org/~nenolod/gcc-${version/pre/_pre}.tar.xz"
+checksum="772cfd5d30eb9cc5a996fec9ba8cdcb45d37df1c9b5770610103b814b732c590"
+nopie=yes
+lib32disabled=yes
+
+# MIPS is untested and does not have go in crosstoolchains
+# 32-bit PowerPC seems weirdly broken since the 10.x release
+# 32-bit little endian PowerPC has no support at all (no GOARCH)
+case "$XBPS_TARGET_MACHINE" in
+	ppc64*) ;;
+	mips*-musl|ppc*) _have_gccgo=no ;;
+esac
+
+if [ "$CHROOT_READY" ]; then
+	hostmakedepends="tar texinfo perl flex"
+fi
+
+makedepends="zlib-devel gmp-devel mpfr-devel libmpc-devel 
+  libstdc++-devel-${version}_${revision} libssp-devel-${version}_${revision}"
+depends="gcc>=${_minorver}"
+checkdepends="dejagnu"
+
+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"
+		 ;;
+esac
+
+pre_configure() {
+	# _FORTIFY_SOURCE needs an optimization level.
+	sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {gcc,libiberty}/configure
+
+	# Do not run fixincludes
+	sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+
+	case "$XBPS_TARGET_MACHINE" in
+		*-musl)
+			patch -p0 -i ${FILESDIR}/libgnarl-musl.patch
+			patch -p0 -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*) _args+=" --with-arch=armv8-a";;
+		ppc64le*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpcle-linux";;
+		ppc64*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpc-linux";;
+		ppc*) _args+=" --enable-secureplt";;
+	esac
+
+	# fix: unknown long double size, cannot define BFP_FMT
+	case "$XBPS_TARGET_MACHINE" in
+		ppc*-musl) _args+=" --disable-decimal-float";;
+	esac
+
+
+	if [ "$CROSS_BUILD" ]; then
+		export CC_FOR_TARGET="$CC"
+		export GCC_FOR_TARGET="$CC"
+		export CXX_FOR_TARGET="$CXX"
+
+		_args+=" --host=$XBPS_CROSS_TRIPLET"
+		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
+	elif [ -z "$CHROOT_READY" ]; then
+		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+		_args+=" --build=${_triplet}"
+	else
+		_langs="jit,lto"
+		_args+=" --build=${_triplet}"
+	fi
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		_args+=" --disable-gnu-unique-object"
+		_args+=" --disable-symvers"
+		_args+=" libat_cv_have_ifunc=no"
+	else
+		_args+=" --enable-gnu-unique-object"
+	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+=" --with-bugurl='https://github.com/jashandeep-sohi/libgccjit-pkg/issues'" \
+	_args+=" --libexecdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
+	_args+=" --libdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
+	_args+=" --with-system-zlib"
+	_args+=" --with-linker-hash-style=$_hash"
+	_args+=" --enable-linker-build-id"
+	_args+=" --enable-threads=posix"
+	_args+=" --enable-lto"
+	_args+=" --enable-shared"
+    _args+=" --enable-host-shared"
+	_args+=" --enable-checking=release"
+	_args+=" --enable-plugins"
+	_args+=" --enable-default-ssp"
+	_args+=" --enable-default-pie"
+	_args+=" --disable-multilib"
+	_args+=" --disable-bootstrap"
+	_args+=" --enable-__cxa_atexit"
+    _args+=" --disable-libquadmath"
+    _args+=" --disable-libquadmath-support"
+    _args+=" --disable-libgomp" 
+    _args+=" --disable-liboffloadmic" 
+    _args+=" --disable-libada"
+    _args+=" --disable-libvtv"
+    _args+=" --disable-libsanitizer"
+	_args+=" --disable-werror"
+	_args+=" --disable-nls"
+	_args+=" --disable-libstdcxx-pch"
+	_args+=" --disable-sjlj-exceptions"
+	_args+=" --disable-target-libiberty"
+
+	mkdir -p build
+	cd build
+
+    # If we are checking packages, we need to have c++ compiled
+    [ -z "$XBPS_CHECK_PKGS" ] && _langs="jit" || _langs="jit,c++"
+    _args+=" --enable-languages=${_langs}"
+    CONFIG_SHELL=/bin/bash \
+	    ${wrksrc}/configure ${_args}
+
+}
+
+do_build() {
+	if [ -z "$CHROOT_READY" ]; then
+		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+	fi
+    cd build
+    make ${makejobs}
+}
+
+post_build() {
+    # Lets create a staging folder to install into
+    mkdir -p "${wrksrc}/install"
+    cd "${wrksrc}/build"
+    make DESTDIR="${wrksrc}/install" -C gcc install
+
+}
+
+do_check() {
+    cd "${wrksrc}/build/gcc"
+    make check-jit RUNTESTFLAGS="-v -v -v"
+}
+
+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() {
+    _includehostdir="usr/lib/gcc/${_triplet}/${_minorver}/include"
+    
+    # Get the shlibs over
+    cd "${wrksrc}/install"
+
+    vinstall "${wrksrc}/install/usr/lib64/libgccjit.so.0.0.1" 0755 usr/lib
+    ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so.0
+    ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so
+
+    # Get the header files in place
+    vinstall usr/include/libgccjit.h 0644 "${_includehostdir}"
+    vinstall usr/include/libgccjit++.h 0644 "${_includehostdir}"
+
+    # The most important part, the info file
+    vinstall usr/share/info/libgccjit.info 0755 "usr/share/info"
+}
+
+post_install() {
+    vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+}
diff --git a/srcpkgs/libgccjit/update b/srcpkgs/libgccjit/update
new file mode 100644
index 00000000000..fb8dd58f204
--- /dev/null
+++ b/srcpkgs/libgccjit/update
@@ -0,0 +1,2 @@
+site="https://gcc.gnu.org/releases.html"
+pattern="GCC \K[\d.]+(?=\<)"

From 50c7abf2083bd6c29c00d7e5437de59b8f933396 Mon Sep 17 00:00:00 2001
From: lane-brain <lane@mailbox.org>
Date: Tue, 16 Feb 2021 12:19:13 -0500
Subject: [PATCH 2/2] New package: New package: libgccjit-10.2.1_pre1

---
 srcpkgs/libgccjit/files/libgccjit-musl.patch  |  63 ++++++
 srcpkgs/libgccjit/files/libgnarl-musl.patch   | 126 +----------
 srcpkgs/libgccjit/files/libssp-musl.patch     |  71 +-----
 srcpkgs/libgccjit/patches                     |   1 +
 srcpkgs/libgccjit/patches/ada-shared.patch    |  28 ---
 .../patches/consistent-library-paths.patch    | 110 ----------
 .../patches/fix-cxxflags-passing.patch        |  10 -
 .../libgccjit/patches/fix-musl-execinfo.patch |  33 ---
 .../patches/fix-vtv-link-order.patch          |  20 --
 .../libgccjit/patches/libffi_gnulinux.patch   |  11 -
 .../patches/libgcc-ibm128-no-tag.patch        |  38 ----
 .../libgccjit/patches/mips-sgidefs_h.patch    |  11 -
 .../libgccjit/patches/mips-soft-float.patch   |  18 --
 srcpkgs/libgccjit/patches/musl-ada.patch      | 204 ------------------
 srcpkgs/libgccjit/template                    | 148 +++++++------
 15 files changed, 147 insertions(+), 745 deletions(-)
 create mode 100644 srcpkgs/libgccjit/files/libgccjit-musl.patch
 mode change 100644 => 120000 srcpkgs/libgccjit/files/libgnarl-musl.patch
 mode change 100644 => 120000 srcpkgs/libgccjit/files/libssp-musl.patch
 create mode 120000 srcpkgs/libgccjit/patches
 delete mode 100644 srcpkgs/libgccjit/patches/ada-shared.patch
 delete mode 100644 srcpkgs/libgccjit/patches/consistent-library-paths.patch
 delete mode 100644 srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch
 delete mode 100644 srcpkgs/libgccjit/patches/fix-musl-execinfo.patch
 delete mode 100644 srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
 delete mode 100644 srcpkgs/libgccjit/patches/libffi_gnulinux.patch
 delete mode 100644 srcpkgs/libgccjit/patches/libgcc-ibm128-no-tag.patch
 delete mode 100644 srcpkgs/libgccjit/patches/mips-sgidefs_h.patch
 delete mode 100644 srcpkgs/libgccjit/patches/mips-soft-float.patch
 delete mode 100644 srcpkgs/libgccjit/patches/musl-ada.patch

diff --git a/srcpkgs/libgccjit/files/libgccjit-musl.patch b/srcpkgs/libgccjit/files/libgccjit-musl.patch
new file mode 100644
index 00000000000..d2ed16928c8
--- /dev/null
+++ b/srcpkgs/libgccjit/files/libgccjit-musl.patch
@@ -0,0 +1,63 @@
+diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
+index 5bccf591a..35f5e35ef 100644
+--- a/gcc/jit/jit-playback.c
++++ b/gcc/jit/jit-playback.c
+@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
++
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -41,8 +43,6 @@ along with GCC; see the file COPYING3.  If not see
+ #include "diagnostic.h"
+ #include "stmt.h"
+ 
+-#include <pthread.h>
+-
+ #include "jit-playback.h"
+ #include "jit-result.h"
+ #include "jit-builtins.h"
+diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
+index a237d574f..5785e3269 100644
+--- a/gcc/jit/jit-recording.c
++++ b/gcc/jit/jit-recording.c
+@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
++
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -25,8 +27,6 @@ along with GCC; see the file COPYING3.  If not see
+ #include "pretty-print.h"
+ #include "toplev.h"
+ 
+-#include <pthread.h>
+-
+ #include "jit-builtins.h"
+ #include "jit-recording.h"
+ #include "jit-playback.h"
+diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
+index f9c33c63c..75f21d275 100644
+--- a/gcc/jit/libgccjit.c
++++ b/gcc/jit/libgccjit.c
+@@ -18,13 +18,13 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+ #include "timevar.h"
+ #include "typed-splay-tree.h"
+ #include "cppbuiltin.h"
+-#include <pthread.h>
+ 
+ #include "libgccjit.h"
+ #include "jit-recording.h"
diff --git a/srcpkgs/libgccjit/files/libgnarl-musl.patch b/srcpkgs/libgccjit/files/libgnarl-musl.patch
deleted file mode 100644
index 5ed9f16f558..00000000000
--- a/srcpkgs/libgccjit/files/libgnarl-musl.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-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/ada/libgnarl/s-osinte__linux.ads	2018-01-11 00:55:25.000000000 -0800
-+++ 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/ada/libgnarl/s-taprop__linux.adb	2018-01-11 00:55:25.000000000 -0800
-+++ 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/libgccjit/files/libgnarl-musl.patch b/srcpkgs/libgccjit/files/libgnarl-musl.patch
new file mode 120000
index 00000000000..cab291e893c
--- /dev/null
+++ b/srcpkgs/libgccjit/files/libgnarl-musl.patch
@@ -0,0 +1 @@
+../gcc/files/libgnarl-musl.patch
\ No newline at end of file
diff --git a/srcpkgs/libgccjit/files/libssp-musl.patch b/srcpkgs/libgccjit/files/libssp-musl.patch
deleted file mode 100644
index e0b84f9acc9..00000000000
--- a/srcpkgs/libgccjit/files/libssp-musl.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-First part taken from Alpine.
-
-Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
-
---- gcc/gcc.c
-+++ gcc/gcc.c
-@@ -874,10 +874,15 @@ 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" \
--		       "|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" \
-@@ -1155,7 +1160,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:\
---- gcc/params.opt
-+++ 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=
---- gcc/config/i386/gnu-user-common.h
-+++ 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
---- gcc/config/i386/gnu.h
-+++ 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/libgccjit/files/libssp-musl.patch b/srcpkgs/libgccjit/files/libssp-musl.patch
new file mode 120000
index 00000000000..bf43b096e8b
--- /dev/null
+++ b/srcpkgs/libgccjit/files/libssp-musl.patch
@@ -0,0 +1 @@
+../gcc/files/libssp-musl.patch
\ No newline at end of file
diff --git a/srcpkgs/libgccjit/patches b/srcpkgs/libgccjit/patches
new file mode 120000
index 00000000000..c42218ef09d
--- /dev/null
+++ b/srcpkgs/libgccjit/patches
@@ -0,0 +1 @@
+../gcc/patches
\ No newline at end of file
diff --git a/srcpkgs/libgccjit/patches/ada-shared.patch b/srcpkgs/libgccjit/patches/ada-shared.patch
deleted file mode 100644
index 7b4280620fe..00000000000
--- a/srcpkgs/libgccjit/patches/ada-shared.patch
+++ /dev/null
@@ -1,28 +0,0 @@
---- 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/libgccjit/patches/consistent-library-paths.patch b/srcpkgs/libgccjit/patches/consistent-library-paths.patch
deleted file mode 100644
index 1ec0e258526..00000000000
--- a/srcpkgs/libgccjit/patches/consistent-library-paths.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-Always use lib64 for 64-bit and lib32 for 32-bit.
-
-Do not change the dynamic linkers in any way, though.
-
-When adding a new platform, fix this up too.
-
---- gcc/config/aarch64/t-aarch64-linux
-+++ 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=../lib64
- MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
- 
- MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
---- gcc/config/i386/t-linux64
-+++ 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=../lib64
-+MULTILIB_OSDIRNAMES+= m32=../lib32
- MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
---- gcc/config/mips/t-linux64
-+++ 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))
-+	../lib32 \
-+	../lib \
-+	../lib64
---- 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=../lib64
-+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=../lib64
-+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=../lib64
-+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=../lib64
-+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=../lib64
-+MULTILIB_OSDIRNAMES += m32=../lib32
- MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
---- gcc/config/s390/t-linux64
-+++ 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=../lib64
-+MULTILIB_OSDIRNAMES+= m32=../lib32
--- 
-2.29.2
-
diff --git a/srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch b/srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch
deleted file mode 100644
index dda2a50460b..00000000000
--- a/srcpkgs/libgccjit/patches/fix-cxxflags-passing.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- 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/libgccjit/patches/fix-musl-execinfo.patch b/srcpkgs/libgccjit/patches/fix-musl-execinfo.patch
deleted file mode 100644
index 583eac7b0dc..00000000000
--- a/srcpkgs/libgccjit/patches/fix-musl-execinfo.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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/libgccjit/patches/fix-vtv-link-order.patch b/srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
deleted file mode 100644
index 3315c3e990b..00000000000
--- a/srcpkgs/libgccjit/patches/fix-vtv-link-order.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-put vtv_end.o in front of postdep_objects_CXX
-having it after crtendS.o leads to missing zero termination in eh_frame section
-
-This is in line with comment in libgcc/vtv_end.c:
-
-   When the GCC driver inserts vtv_start.o into the link line (just
-   after crtbegin.o) it also inserts vtv_end.o into the link line,
-   just before crtend.o.
-
---- libstdc++-v3/configure
-+++ libstdc++-v3/configure
-@@ -15443,7 +15443,7 @@
- 
- if test "$enable_vtable_verify" = yes; then
-   predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
--  postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o"
-+  postdep_objects_CXX="${glibcxx_builddir}/../libgcc/vtv_end.o ${postdep_objects_CXX}" 
- fi
- 
- 
diff --git a/srcpkgs/libgccjit/patches/libffi_gnulinux.patch b/srcpkgs/libgccjit/patches/libffi_gnulinux.patch
deleted file mode 100644
index 413b4aef5af..00000000000
--- a/srcpkgs/libgccjit/patches/libffi_gnulinux.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- 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/libgccjit/patches/libgcc-ibm128-no-tag.patch b/srcpkgs/libgccjit/patches/libgcc-ibm128-no-tag.patch
deleted file mode 100644
index 855f8f1b035..00000000000
--- a/srcpkgs/libgccjit/patches/libgcc-ibm128-no-tag.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-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/libgccjit/patches/mips-sgidefs_h.patch b/srcpkgs/libgccjit/patches/mips-sgidefs_h.patch
deleted file mode 100644
index e5fdbf9f96f..00000000000
--- a/srcpkgs/libgccjit/patches/mips-sgidefs_h.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- 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/libgccjit/patches/mips-soft-float.patch b/srcpkgs/libgccjit/patches/mips-soft-float.patch
deleted file mode 100644
index 4db0e2fb07a..00000000000
--- a/srcpkgs/libgccjit/patches/mips-soft-float.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- 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/libgccjit/patches/musl-ada.patch b/srcpkgs/libgccjit/patches/musl-ada.patch
deleted file mode 100644
index 61823684da5..00000000000
--- a/srcpkgs/libgccjit/patches/musl-ada.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-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	2020-07-23 08:35:17.052381336 +0200
-+++ -	2020-08-09 19:38:24.230351406 +0200
-@@ -1533,7 +1533,7 @@
-   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 @@
-   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 @@
- 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 @@
-   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 @@
-   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
---- 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/libgccjit/template b/srcpkgs/libgccjit/template
index 0e8551d062c..b80af58a837 100644
--- a/srcpkgs/libgccjit/template
+++ b/srcpkgs/libgccjit/template
@@ -2,41 +2,43 @@
 _majorver=10
 _minorver=${_majorver}.2
 _patchver=${_minorver}.1
+_gmp_version=6.2.0
+_mpfr_version=4.1.0
+_mpc_version=1.1.0
+_isl_version=0.21
 
 pkgname=libgccjit
 # we are using a 10-stable git snapshot alpine is using in order
 # to get regression fixes not yet incorporate into a stable release
 # it should be possible to switch back to stable with 10.3 or 11
 version=${_patchver}pre1
+revision=1
 wrksrc=gcc-${version/pre/_pre}
-revision=2
 short_desc="GNU Compiler Collection"
-maintainer="Enno Boland <gottox@voidlinux.org>"
+maintainer="Lane Biocini <lane@mailbox.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="https://dev.alpinelinux.org/~nenolod/gcc-${version/pre/_pre}.tar.xz"
-checksum="772cfd5d30eb9cc5a996fec9ba8cdcb45d37df1c9b5770610103b814b732c590"
+distfiles="
+ https://dev.alpinelinux.org/~nenolod/gcc-${version/pre/_pre}.tar.xz
+ https://gmplib.org/download/gmp/gmp-${_gmp_version}.tar.xz
+ ${GNU_SITE}/mpfr/mpfr-${_mpfr_version}.tar.xz
+ ${GNU_SITE}/mpc/mpc-${_mpc_version}.tar.gz
+ http://isl.gforge.inria.fr/isl-${_isl_version}.tar.bz2"
+checksum="772cfd5d30eb9cc5a996fec9ba8cdcb45d37df1c9b5770610103b814b732c590
+ 258e6cd51b3fbdfc185c716d55f82c08aff57df0c6fbd143cf6ed561267a1526
+ 0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f
+ 6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e
+ d18ca11f8ad1a39ab6d03d3dcb3365ab416720fcb65b42d69f34f51bf0a0e859"
+
 nopie=yes
 lib32disabled=yes
-
-# MIPS is untested and does not have go in crosstoolchains
-# 32-bit PowerPC seems weirdly broken since the 10.x release
-# 32-bit little endian PowerPC has no support at all (no GOARCH)
-case "$XBPS_TARGET_MACHINE" in
-	ppc64*) ;;
-	mips*-musl|ppc*) _have_gccgo=no ;;
-esac
-
-if [ "$CHROOT_READY" ]; then
-	hostmakedepends="tar texinfo perl flex"
-fi
-
-makedepends="zlib-devel gmp-devel mpfr-devel libmpc-devel 
-  libstdc++-devel-${version}_${revision} libssp-devel-${version}_${revision}"
-depends="gcc>=${_minorver}"
+makedepends="zlib-devel"
+hostmakedepends="tar texinfo perl flex" #gmp-devel mpfr-devel libmpc-devel isl-devel libssp-devel"
+depends="gcc"
 checkdepends="dejagnu"
 
+# needed for cross builds
 case "$XBPS_TARGET_MACHINE" in
 	i686) _triplet="i686-pc-linux-gnu";;
 	i686-musl) _triplet="i686-linux-musl";;
@@ -63,11 +65,17 @@ case "$XBPS_TARGET_MACHINE" in
 	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"
-		 ;;
-esac
+#if [ "$CROSS_BUILD" ]; then
+#	hostmakedepends+=" cross-${_triplet}"
+#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/
+}
 
 pre_configure() {
 	# _FORTIFY_SOURCE needs an optimization level.
@@ -80,7 +88,7 @@ pre_configure() {
 		*-musl)
 			patch -p0 -i ${FILESDIR}/libgnarl-musl.patch
 			patch -p0 -i ${FILESDIR}/libssp-musl.patch
-			patch -p0 -i ${FILESDIR}/gccgo-musl.patch
+			patch -p1 -i ${FILESDIR}/libgccjit-musl.patch
 			;;
 	esac
 }
@@ -107,7 +115,6 @@ do_configure() {
 		ppc*-musl) _args+=" --disable-decimal-float";;
 	esac
 
-
 	if [ "$CROSS_BUILD" ]; then
 		export CC_FOR_TARGET="$CC"
 		export GCC_FOR_TARGET="$CC"
@@ -119,7 +126,6 @@ do_configure() {
 		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_triplet}"
 	else
-		_langs="jit,lto"
 		_args+=" --build=${_triplet}"
 	fi
 
@@ -144,10 +150,15 @@ do_configure() {
 	export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
 	export LDFLAGS="${LDFLAGS//-no-pie/}"
 
+	# Needs explicit -fPIC
+	export CFLAGS+=" -fPIC"
+	export CXXFLAGS+=" -fPIC"
+	export LDFLAGS+=" -fPIC"
+
 	_args+=" --prefix=/usr"
 	_args+=" --mandir=/usr/share/man"
 	_args+=" --infodir=/usr/share/info"
-    _args+=" --with-bugurl='https://github.com/jashandeep-sohi/libgccjit-pkg/issues'" \
+	_args+=" --with-bugurl='https://github.com/jashandeep-sohi/libgccjit-pkg/issues'" \
 	_args+=" --libexecdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
 	_args+=" --libdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
 	_args+=" --with-system-zlib"
@@ -156,7 +167,7 @@ do_configure() {
 	_args+=" --enable-threads=posix"
 	_args+=" --enable-lto"
 	_args+=" --enable-shared"
-    _args+=" --enable-host-shared"
+	_args+=" --enable-host-shared"
 	_args+=" --enable-checking=release"
 	_args+=" --enable-plugins"
 	_args+=" --enable-default-ssp"
@@ -164,13 +175,13 @@ do_configure() {
 	_args+=" --disable-multilib"
 	_args+=" --disable-bootstrap"
 	_args+=" --enable-__cxa_atexit"
-    _args+=" --disable-libquadmath"
-    _args+=" --disable-libquadmath-support"
-    _args+=" --disable-libgomp" 
-    _args+=" --disable-liboffloadmic" 
-    _args+=" --disable-libada"
-    _args+=" --disable-libvtv"
-    _args+=" --disable-libsanitizer"
+	_args+=" --disable-libquadmath"
+	_args+=" --disable-libquadmath-support"
+	_args+=" --disable-libgomp"
+	_args+=" --disable-liboffloadmic"
+	_args+=" --disable-libada"
+	_args+=" --disable-libvtv"
+	_args+=" --disable-libsanitizer"
 	_args+=" --disable-werror"
 	_args+=" --disable-nls"
 	_args+=" --disable-libstdcxx-pch"
@@ -180,33 +191,32 @@ do_configure() {
 	mkdir -p build
 	cd build
 
-    # If we are checking packages, we need to have c++ compiled
-    [ -z "$XBPS_CHECK_PKGS" ] && _langs="jit" || _langs="jit,c++"
-    _args+=" --enable-languages=${_langs}"
-    CONFIG_SHELL=/bin/bash \
-	    ${wrksrc}/configure ${_args}
-
+	# If we are checking packages, we need to have c++ compiled
+	[ -z "$XBPS_CHECK_PKGS" ] && _langs="jit" || _langs="jit,c++"
+	_args+=" --enable-languages=${_langs}"
+	CONFIG_SHELL=/bin/bash \
+		${wrksrc}/configure ${_args}
 }
 
 do_build() {
-	if [ -z "$CHROOT_READY" ]; then
-		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
-	fi
-    cd build
-    make ${makejobs}
+#	if [ -z "$CHROOT_READY" ]; then
+#		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
+#	fi
+	cd build
+	make ${makejobs}
 }
 
 post_build() {
-    # Lets create a staging folder to install into
-    mkdir -p "${wrksrc}/install"
-    cd "${wrksrc}/build"
-    make DESTDIR="${wrksrc}/install" -C gcc install
+	# Lets create a staging folder to install into
+	mkdir -p "${wrksrc}/install"
+	cd "${wrksrc}/build"
+	make DESTDIR="${wrksrc}/install" -C gcc install
 
 }
 
 do_check() {
-    cd "${wrksrc}/build/gcc"
-    make check-jit RUNTESTFLAGS="-v -v -v"
+	cd "${wrksrc}/build/gcc"
+	make check-jit RUNTESTFLAGS="-v -v -v"
 }
 
 pre_install() {
@@ -219,23 +229,27 @@ pre_install() {
 }
 
 do_install() {
-    _includehostdir="usr/lib/gcc/${_triplet}/${_minorver}/include"
-    
-    # Get the shlibs over
-    cd "${wrksrc}/install"
+	if [ "$CROSS_BUILD" ]; then
+		_includehostdir="usr/lib/gcc/${XBPS_CROSS_TRIPLET}/${_minorver}/include"
+	else
+		_includehostdir="usr/lib/gcc/${_triplet}/${_minorver}/include"
+	fi
+
+	# Get the shlibs over
+	cd "${wrksrc}/install"
 
-    vinstall "${wrksrc}/install/usr/lib64/libgccjit.so.0.0.1" 0755 usr/lib
-    ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so.0
-    ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so
+	vinstall "${wrksrc}/install/usr/lib${XBPS_TARGET_WORDSIZE}/libgccjit.so.0.0.1" 0755 usr/lib
+	ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so.0
+	ln -sf libgccjit.so.0.0.1 "${DESTDIR}"/usr/lib/libgccjit.so
 
-    # Get the header files in place
-    vinstall usr/include/libgccjit.h 0644 "${_includehostdir}"
-    vinstall usr/include/libgccjit++.h 0644 "${_includehostdir}"
+	# Get the header files in place
+	vinstall usr/include/libgccjit.h 0644 "${_includehostdir}"
+	vinstall usr/include/libgccjit++.h 0644 "${_includehostdir}"
 
-    # The most important part, the info file
-    vinstall usr/share/info/libgccjit.info 0755 "usr/share/info"
+	# The most important part, the info file
+	vinstall usr/share/info/libgccjit.info 0755 "usr/share/info"
 }
 
 post_install() {
-    vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
+	vlicense ${wrksrc}/COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
 }

  parent reply	other threads:[~2021-02-16 17:19 UTC|newest]

Thread overview: 165+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16  1:36 [PR PATCH] " lane-brain
2021-02-16  1:40 ` ericonr
2021-02-16  1:50 ` [PR REVIEW] " ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  1:50 ` ericonr
2021-02-16  6:00 ` lane-brain
2021-02-16  6:00 ` lane-brain
2021-02-16  6:01 ` lane-brain
2021-02-16  6:02 ` lane-brain
2021-02-16  6:05 ` lane-brain
2021-02-16  6:23 ` lane-brain
2021-02-16  6:23 ` lane-brain
2021-02-16  6:28 ` lane-brain
2021-02-16  6:32 ` lane-brain
2021-02-16  6:33 ` lane-brain
2021-02-16  6:33 ` lane-brain
2021-02-16  6:34 ` lane-brain
2021-02-16  6:35 ` lane-brain
2021-02-16  6:35 ` lane-brain
2021-02-16  6:44 ` lane-brain
2021-02-16  6:48 ` ericonr
2021-02-16 10:03 ` [PR REVIEW] " fosslinux
2021-02-16 17:19 ` lane-brain [this message]
2021-02-16 17:25 ` [PR PATCH] [Updated] " lane-brain
2021-02-16 17:39 ` lane-brain
2021-02-16 17:54 ` [PR REVIEW] " lane-brain
2021-02-16 17:54 ` lane-brain
2021-02-16 17:55 ` lane-brain
2021-02-16 17:57 ` lane-brain
2021-02-16 17:58 ` lane-brain
2021-02-16 17:59 ` lane-brain
2021-02-16 17:59 ` lane-brain
2021-02-16 18:01 ` lane-brain
2021-02-16 18:04 ` FollieHiyuki
2021-02-16 18:07 ` [PR REVIEW] " ericonr
2021-02-16 18:07 ` ericonr
2021-02-16 18:07 ` ericonr
2021-02-16 18:07 ` ericonr
2021-02-16 18:07 ` ericonr
2021-02-16 18:10 ` ericonr
2021-02-16 18:12 ` [PR REVIEW] " lane-brain
2021-02-16 18:13 ` lane-brain
2021-02-16 18:13 ` ericonr
2021-02-16 18:13 ` ericonr
2021-02-16 18:14 ` lane-brain
2021-02-16 18:15 ` lane-brain
2021-02-16 18:16 ` ericonr
2021-02-16 18:17 ` lane-brain
2021-02-16 18:34 ` ericonr
2021-02-16 20:05 ` lane-brain
2021-02-16 20:06 ` lane-brain
2021-02-16 20:24 ` lane-brain
2021-02-17  0:43 ` [PR PATCH] [Updated] " lane-brain
2021-02-17 18:07 ` lane-brain
2021-02-18  4:03 ` lane-brain
2021-02-18  4:04 ` lane-brain
2021-02-18 18:48 ` [PR PATCH] [Updated] " lane-brain
2021-02-18 18:56 ` lane-brain
2021-02-18 18:57 ` lane-brain
2021-02-18 19:26 ` ericonr
2021-02-18 19:26 ` ericonr
2021-02-19  3:31 ` [PR PATCH] [Updated] " lane-brain
2021-02-19  5:13 ` lane-brain
2021-02-19 18:21 ` lane-brain
2021-02-19 18:44 ` lane-brain
2021-02-25  0:13 ` lane-brain
2021-02-25 14:52 ` ericonr
2021-02-25 20:24 ` lane-brain
2021-02-27  0:13 ` xianwenchen
2021-03-15  8:41 ` ramos
2021-03-18  8:28 ` xianwenchen
2021-03-18 23:22 ` lane-brain
2021-03-19 13:31 ` xianwenchen
2021-03-21  0:37 ` lane-brain
2021-03-24 10:09 ` xianwenchen
2021-03-30 22:39 ` floyza
2021-04-10  9:07 ` xianwenchen
2021-04-10 14:20 ` ericonr
2021-04-10 21:33 ` xianwenchen
2021-04-11  1:41 ` floyza
2021-04-12 23:18 ` xianwenchen
2021-04-14 22:48 ` lane-brain
2021-05-14  6:28 ` Sparkenstein
2021-07-29 10:16 ` brihadeesh
2021-07-29 12:20 ` FollieHiyuki
2021-07-29 12:21 ` FollieHiyuki
2021-07-29 16:36 ` brihadeesh
2021-08-27 17:34 ` ericonr
2021-08-31  6:00 ` lane-brain
2021-12-25 13:13 ` soanvig
2022-01-04 19:57 ` lane-brain
2022-01-17 21:31 ` michaelmrose
2022-01-17 22:16 ` lane-brain
2022-01-18  7:30 ` michaelmrose
2022-01-18 18:38 ` lane-brain
2022-03-03  7:47 ` brihadeesh
2022-03-03  8:11 ` brihadeesh
2022-03-11 19:52 ` KJ002
2022-03-12 16:47 ` lane-brain
2022-03-12 19:04 ` KJ002
2022-03-12 19:05 ` KJ002
2022-03-13  6:51 ` brihadeesh
2022-03-14 19:49 ` [PR PATCH] [Updated] " lane-brain
2022-03-14 19:56 ` lane-brain
2022-03-14 19:57 ` lane-brain
2022-03-14 19:58 ` lane-brain
2022-03-14 20:02 ` lane-brain
2022-03-14 20:02 ` lane-brain
2022-03-14 21:04 ` KJ002
2022-03-14 22:04 ` KJ002
2022-03-14 22:05 ` KJ002
2022-03-17 19:23 ` jbenden
2022-03-17 19:25 ` jbenden
2022-03-25 15:39 ` mustaqimM
2022-04-04 16:05 ` leahneukirchen
2022-04-04 16:09 ` [PR REVIEW] " leahneukirchen
2022-04-04 16:09 ` leahneukirchen
2022-04-04 16:11 ` leahneukirchen
2022-04-04 16:21 ` [PR REVIEW] " leahneukirchen
2022-04-14  2:29 ` lane-brain
2022-04-14  2:29 ` lane-brain
2022-04-14  2:31 ` lane-brain
2022-04-14  2:45 ` lane-brain
2022-04-14  3:03 ` [PR PATCH] [Updated] " lane-brain
2022-04-14  3:04 ` [PR REVIEW] " lane-brain
2022-04-14 11:30 ` leahneukirchen
2022-04-14 13:52 ` leahneukirchen
2022-04-14 15:38 ` sofeepokhrel
2022-04-14 18:11 ` lane-brain
2022-04-14 18:12 ` lane-brain
2022-04-14 18:15 ` lane-brain
2022-04-14 18:20 ` lane-brain
2022-04-14 18:21 ` lane-brain
2022-04-14 18:38 ` leahneukirchen
2022-04-14 18:40 ` leahneukirchen
2022-04-14 20:03 ` [PR PATCH] [Updated] " lane-brain
2022-04-14 20:07 ` lane-brain
2022-04-14 20:15 ` [PR REVIEW] " paper42
2022-04-14 20:15 ` paper42
2022-04-14 20:15 ` paper42
2022-04-14 20:19 ` paper42
2022-04-14 20:19 ` paper42
2022-04-14 20:19 ` paper42
2022-04-14 20:19 ` paper42
2022-04-14 20:19 ` paper42
2022-04-14 20:23 ` leahneukirchen
2022-04-14 20:25 ` leahneukirchen
2022-04-14 20:25 ` leahneukirchen
2022-04-15 15:27 ` [PR PATCH] [Updated] " leahneukirchen
2022-04-15 15:32 ` [PR REVIEW] " leahneukirchen
2022-04-16 11:48 ` [PR PATCH] [Merged]: " leahneukirchen
2022-07-02  1:39 ` [PR REVIEW] " acomeofficial

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216171935.bi2LfZ09cCPNw0li1Ssoh4ZlBcPAgSuXF2A0Gu0qHOs@z \
    --to=lane-brain@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).