Skip to content

Commit

Permalink
gcc: update to 12.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oreo639 committed Aug 12, 2022
1 parent 4a91111 commit 7d2107a
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 108 deletions.
10 changes: 5 additions & 5 deletions common/shlibs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ libcc1plugin.so.0 gcc-6.2.1_1
libitm.so.1 libitm-4.7.3_1
liblto_plugin.so.0 gcc-4.7.3_1
libgcc_s.so.1 libgcc-4.4.0_1
libgo.so.16 libgo-10.2.0_1
libgo.so.21 libgo-12.1.0_1
libgccjit.so.0 libgccjit-10.2.1pre1_1
libperl.so.5.34 perl-5.34.0_1
libgmp.so.10 gmp-5.0.1_1
Expand Down Expand Up @@ -849,8 +849,8 @@ libgdkmm-2.4.so.1 gtkmm2-2.24.0_1
libgtkmm-2.4.so.1 gtkmm2-2.24.0_1
libquadmath.so.0 libquadmath-4.4.0_1
libgfortran.so.5 libgfortran-8.2.0_1
libgnarl-10.so libada-10.2.0_1
libgnat-10.so libada-10.2.0_1
libgnarl-12.so libada-12.1.0_1
libgnat-12.so libada-12.1.0_1
libwebp.so.7 libwebp-0.6.0_1
libwebpmux.so.3 libwebp-0.6.0_1
libwebpdemux.so.2 libwebp-0.5.0_1
Expand Down Expand Up @@ -1701,8 +1701,8 @@ libextractor.so.3 libextractor-1.1_1
libextractor_common.so.1 libextractor-1.1_1
libpano13.so.3 libpano13-2.9.19_1
libubsan.so.1 libsanitizer-8.2.0_1
libtsan.so.0 libsanitizer-6.3.0_1
libasan.so.6 libsanitizer-10.2.0_1
libtsan.so.2 libsanitizer-12.1.0_1
libasan.so.8 libsanitizer-12.1.0_1
liblsan.so.0 libsanitizer-6.3.0_1
libvtv.so.0 libvtv-6.3.0_1
libatomic.so.1 libatomic-4.9.0_1
Expand Down
74 changes: 14 additions & 60 deletions srcpkgs/gcc/files/gccgo-musl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
p := sysMmap(addr, n, prot, flags, fd, off)
if uintptr(p) == _MAP_FAILED {
return nil, errno()
--- a/libgo/go/runtime/signal_gccgo.go
+++ b/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")
--- a/libgo/go/syscall/errstr.go
+++ b/libgo/go/syscall/errstr.go
@@ -5,7 +5,6 @@
Expand Down Expand Up @@ -140,55 +129,6 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
plwoff = &lwoff
}
n, err = splice(rfd, plroff, wfd, plwoff, len, flags)
--- a/libgo/mksigtab.sh
+++ b/libgo/mksigtab.sh
@@ -82,7 +82,7 @@ checksig _SIGPWR '{_SigNotify, "SIGPWR: power failure restart"}'
checksig _SIGEMT '{_SigThrow, "SIGEMT: emulate instruction executed"}'
checksig _SIGINFO '{_SigNotify, "SIGINFO: status request from keyboard"}'
checksig _SIGTHR '{_SigNotify, "SIGTHR: reserved"}'
-checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}'
+#checksig _SIGPOLL '{_SigNotify, "SIGPOLL: pollable event occurred"}'
checksig _SIGWAITING '{_SigNotify, "SIGWAITING: reserved signal no longer used by"}'
checksig _SIGLWP '{_SigNotify, "SIGLWP: reserved signal no longer used by"}'
checksig _SIGFREEZE '{_SigNotify, "SIGFREEZE: special signal used by CPR"}'
@@ -95,10 +95,12 @@ checksig _SIGLOST ' {_SigNotify, "SIGLOST: resource lost (Sun); server died (G

# Special handling of signals 32 and 33 on GNU/Linux systems,
# because they are special to glibc.
+# Signal 34 is additionally special to Linux systems with musl.
if test "${GOOS}" = "linux"; then
- SIGLIST=$SIGLIST"_32__33_"
+ SIGLIST=$SIGLIST"_32__33__34_"
echo ' 32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */'
echo ' 33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */'
+ echo ' 34: {_SigSetStack + _SigUnblock, "signal 34"}, /* see issue 30062 */'
fi

if test "${GOOS}" = "aix"; then
--- a/libgo/runtime/go-signal.c 2020-07-23 08:35:19.004402840 +0200
+++ b/libgo/runtime/go-signal.c 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;
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*);
Expand Down Expand Up @@ -220,3 +160,17 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
#if defined(HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
#endif
--- a/libgo/go/runtime/os_linux.go
+++ a/libgo/go/runtime/os_linux.go
@@ -363,9 +363,9 @@

var timerid int32
var sevp _sigevent
- sevp.sigev_notify = _SIGEV_THREAD_ID
+ sevp.sigev_notify = 4
sevp.sigev_signo = _SIGPROF
- *((*int32)(unsafe.Pointer(&sevp._sigev_un))) = int32(mp.procid)
+ *((*int32)(unsafe.Pointer(&sevp.sigev_notify_function))) = int32(mp.procid)
ret := timer_create(_CLOCK_THREAD_CPUTIME_ID, &sevp, &timerid)
if ret != 0 {
// If we cannot create a timer for this M, leave profileTimerValid false
18 changes: 9 additions & 9 deletions srcpkgs/gcc/files/libgnarl-musl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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
--- a/gcc/ada/libgnarl/s-osinte__linux.ads 2018-01-11 00:55:25.000000000 -0800
+++ b/gcc/ada/libgnarl/s-osinte__linux.ads 2018-11-01 16:16:23.372452951 -0700
@@ -394,12 +394,6 @@ package System.OS_Interface is
@@ -403,12 +403,6 @@ package System.OS_Interface is
PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1;
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;

Expand All @@ -18,7 +18,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
function pthread_rwlock_init
(mutex : access pthread_rwlock_t;
attr : access pthread_rwlockattr_t) return int;
@@ -464,11 +458,6 @@ package System.OS_Interface is
@@ -470,11 +464,6 @@ package System.OS_Interface is
protocol : int) return int;
pragma Import (C, pthread_mutexattr_setprotocol);

Expand All @@ -33,7 +33,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l
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
--- a/gcc/ada/libgnarl/s-taprop__linux.adb 2018-01-11 00:55:25.000000000 -0800
+++ b/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
@@ -198,9 +198,6 @@ package body System.Task_Primitives.Oper
pragma Import
(C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");

Expand All @@ -43,7 +43,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
-- We do not have pragma Linker_Options ("-lcap"); here, because this
-- library is not present on many Linux systems. 'libcap' is the Linux
-- "capabilities" library, called by __gnat_has_cap_sys_nice.
@@ -214,38 +211,6 @@ package body System.Task_Primitives.Oper
@@ -210,38 +207,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.

Expand Down Expand Up @@ -76,13 +76,13 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
- return Ceiling_Support;
- end Get_Ceiling_Support;
-
- pragma Warnings (Off, "non-static call not allowed in preelaborated unit");
- pragma Warnings (Off, "non-preelaborable call not allowed*");
- Ceiling_Support : constant Boolean := Get_Ceiling_Support;
- pragma Warnings (On, "non-static call not allowed in preelaborated unit");
- pragma Warnings (On, "non-preelaborable call not allowed*");
-- True if the locking policy is Ceiling_Locking, and the current process
-- has permission to use this policy. The process has permission if it is
-- running as 'root', or if the capability was set by the setcap command,
@@ -348,7 +313,9 @@ package body System.Task_Primitives.Oper
@@ -344,7 +309,9 @@ package body System.Task_Primitives.Oper
-- Init_Mutex --
----------------

Expand All @@ -92,7 +92,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Mutex_Attr : aliased pthread_mutexattr_t;
Result, Result_2 : C.int;

@@ -360,16 +327,7 @@ package body System.Task_Primitives.Oper
@@ -356,16 +323,7 @@ package body System.Task_Primitives.Oper
return Result;
end if;

Expand All @@ -110,7 +110,7 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/l
Result := pthread_mutexattr_setprotocol
(Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
pragma Assert (Result = 0);
@@ -409,11 +367,6 @@ package body System.Task_Primitives.Oper
@@ -405,11 +363,6 @@ package body System.Task_Primitives.Oper
Result := pthread_rwlockattr_init (RWlock_Attr'Access);
pragma Assert (Result = 0);

Expand Down
10 changes: 5 additions & 5 deletions srcpkgs/gcc/files/libssp-musl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ First part taken from Alpine.

Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.

--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -874,10 +874,15 @@ proper position among the other output files. */
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -984,10 +984,15 @@ proper position among the other output f
#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
#endif

Expand All @@ -22,10 +22,10 @@ Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
#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 =
@@ -1280,7 +1285,7 @@ static const char *cc1_options =
%{-version:--version}\
%{-help=*:--help=%*}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
- %{fsyntax-only:-o %j} %{-param*}\
+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
%{coverage:-fprofile-arcs -ftest-coverage}\
Expand Down
105 changes: 105 additions & 0 deletions srcpkgs/gcc/patches/3b21c21f3f5726823e19728fdd1571a14aae0fb3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
From 3b21c21f3f5726823e19728fdd1571a14aae0fb3 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <[email protected]>
Date: Mon, 27 Jun 2022 13:27:24 +0100
Subject: [PATCH] c++: avoid <memory> poisoning on musl [PR106102]

On musl <pthread.h> uses calloc() (via <sched.h>). <memory> includes
it indirectly and exposes use of poisoned calloc() when module code
is built:

/build/build/./prev-gcc/xg++ ... ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc
In file included from /<<NIX>>/musl-1.2.3-dev/include/pthread.h:30,
from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35,
....
from /build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77,
from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24,
from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25,
from ../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23,
from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32:
/<<NIX>>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc"
84 | void *calloc(size_t, size_t);
| ^
/<<NIX>>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned "calloc"
124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
| ^

gcc/cp/

PR c++/106102
* mapper-client.cc: Include <memory> via "system.h".
* mapper-resolver.cc: Ditto.
* module.cc: Ditto.

libcc1/

PR c++/106102
* libcc1plugin.cc: Include <memory> via "system.h".
* libcp1plugin.cc: Ditto.
---
gcc/cp/mapper-client.cc | 1 +
gcc/cp/mapper-resolver.cc | 1 +
gcc/cp/module.cc | 1 +
libcc1/libcc1plugin.cc | 1 +
libcc1/libcp1plugin.cc | 1 +
5 files changed, 5 insertions(+)

diff --git a/gcc/cp/mapper-client.cc b/gcc/cp/mapper-client.cc
index 8603a886a099..fe9544b5ba43 100644
--- a/gcc/cp/mapper-client.cc
+++ b/gcc/cp/mapper-client.cc
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#define INCLUDE_STRING
#define INCLUDE_VECTOR
#define INCLUDE_MAP
+#define INCLUDE_MEMORY
#include "system.h"

#include "line-map.h"
diff --git a/gcc/cp/mapper-resolver.cc b/gcc/cp/mapper-resolver.cc
index e3d29fb5ada1..e70d1b4ae2ca 100644
--- a/gcc/cp/mapper-resolver.cc
+++ b/gcc/cp/mapper-resolver.cc
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#define INCLUDE_VECTOR
#define INCLUDE_ALGORITHM
#define INCLUDE_MAP
+#define INCLUDE_MEMORY
#include "system.h"

// We don't want or need to be aware of networking
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 753963a4b246..8bb22c2b305a 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -206,6 +206,7 @@ Classes used:

#define _DEFAULT_SOURCE 1 /* To get TZ field of struct tm, if available. */
#include "config.h"
+#define INCLUDE_MEMORY
#define INCLUDE_STRING
#define INCLUDE_VECTOR
#include "system.h"
diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
index 12ab5a57c8dd..bdd0bdabe77f 100644
--- a/libcc1/libcc1plugin.cc
+++ b/libcc1/libcc1plugin.cc
@@ -31,6 +31,7 @@
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

+#define INCLUDE_MEMORY
#include "gcc-plugin.h"
#include "system.h"
#include "coretypes.h"
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 83dab7f58b11..e2d5039a0a1f 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -32,6 +32,7 @@
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

+#define INCLUDE_MEMORY
#include "gcc-plugin.h"
#include "system.h"
#include "coretypes.h"
Loading

0 comments on commit 7d2107a

Please sign in to comment.