From cc162db0de331485dbbbaa55a5e1b2f05532e58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Mon, 21 Jun 2021 19:19:41 +0700 Subject: [PATCH] gcc: convert musl patches to -Np1 --- srcpkgs/gcc/files/gccgo-musl.patch | 42 +++++++++++++-------------- srcpkgs/gcc/files/libgnarl-musl.patch | 8 ++--- srcpkgs/gcc/files/libssp-musl.patch | 16 +++++----- srcpkgs/gcc/template | 12 ++++---- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/srcpkgs/gcc/files/gccgo-musl.patch b/srcpkgs/gcc/files/gccgo-musl.patch index a2ce4b2b046..9762739615a 100644 --- a/srcpkgs/gcc/files/gccgo-musl.patch +++ b/srcpkgs/gcc/files/gccgo-musl.patch @@ -7,8 +7,8 @@ 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 +--- a/Makefile.in ++++ b/Makefile.in @@ -46325,7 +46325,7 @@ configure-target-libgo: esac; \ module_srcdir=libgo; \ @@ -18,8 +18,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \ ---- libgo/mksysinfo.sh -+++ libgo/mksysinfo.sh +--- a/libgo/mksysinfo.sh ++++ b/libgo/mksysinfo.sh @@ -379,11 +379,7 @@ fi # Some basic types. echo 'type Size_t _size_t' >> ${OUT} @@ -33,8 +33,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc 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 +--- a/libgo/go/runtime/mem_gccgo.go ++++ b/libgo/go/runtime/mem_gccgo.go @@ -16,7 +16,7 @@ import ( //go:linkname sysFree runtime.sysFree @@ -53,8 +53,8 @@ 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() ---- libgo/go/runtime/signal_gccgo.go -+++ libgo/go/runtime/signal_gccgo.go +--- 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 @@ -64,8 +64,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc return _SIG_DFL } throw("sigaction read failure") ---- libgo/go/syscall/errstr.go -+++ libgo/go/syscall/errstr.go +--- a/libgo/go/syscall/errstr.go ++++ b/libgo/go/syscall/errstr.go @@ -5,7 +5,6 @@ // license that can be found in the LICENSE file. @@ -74,7 +74,7 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc package syscall ---- libgo/go/syscall/errstr_glibc.go +--- a/libgo/go/syscall/errstr_glibc.go +++ /dev/null @@ -1,33 +0,0 @@ -// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings. @@ -110,8 +110,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc - } - return string(b[:i]) -} ---- libgo/go/syscall/libcall_linux.go -+++ libgo/go/syscall/libcall_linux.go +--- a/libgo/go/syscall/libcall_linux.go ++++ b/libgo/go/syscall/libcall_linux.go @@ -206,19 +206,19 @@ func Gettid() (tid int) { //sys Setxattr(path string, attr string, data []byte, flags int) (err error) //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int @@ -140,8 +140,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc plwoff = &lwoff } n, err = splice(rfd, plroff, wfd, plwoff, len, flags) ---- libgo/mksigtab.sh -+++ libgo/mksigtab.sh +--- 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"}' @@ -165,8 +165,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc 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 +--- 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; @@ -189,8 +189,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc { mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext; int i; ---- libgo/runtime/runtime.h -+++ libgo/runtime/runtime.h +--- a/libgo/runtime/runtime.h ++++ b/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 @@ -208,8 +208,8 @@ URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc #endif // Symbols defined by the linker. ---- libgo/sysinfo.c -+++ libgo/sysinfo.c +--- a/libgo/sysinfo.c ++++ b/libgo/sysinfo.c @@ -73,9 +73,6 @@ #include #include diff --git a/srcpkgs/gcc/files/libgnarl-musl.patch b/srcpkgs/gcc/files/libgnarl-musl.patch index 5ed9f16f558..99a734c42c9 100644 --- a/srcpkgs/gcc/files/libgnarl-musl.patch +++ b/srcpkgs/gcc/files/libgnarl-musl.patch @@ -3,8 +3,8 @@ 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 +--- 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 PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1; PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2; @@ -31,8 +31,8 @@ diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/l 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 +--- 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 pragma Import (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup"); diff --git a/srcpkgs/gcc/files/libssp-musl.patch b/srcpkgs/gcc/files/libssp-musl.patch index e0b84f9acc9..b21a2c29e57 100644 --- a/srcpkgs/gcc/files/libssp-musl.patch +++ b/srcpkgs/gcc/files/libssp-musl.patch @@ -2,8 +2,8 @@ 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 +--- a/gcc/gcc.c ++++ b/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 @@ -31,8 +31,8 @@ Second part added to prevent gccgo from thinking it can -fsplit-stack on musl. %{coverage:-fprofile-arcs -ftest-coverage}\ %{fprofile-arcs|fprofile-generate*|coverage:\ %{!fprofile-update=single:\ ---- gcc/params.opt -+++ gcc/params.opt +--- a/gcc/params.opt ++++ b/gcc/params.opt @@ -853,7 +853,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim The maximum number of SSA_NAME assignments to follow in determining a value. @@ -42,8 +42,8 @@ Second part added to prevent gccgo from thinking it can -fsplit-stack on musl. 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 +--- a/gcc/config/i386/gnu-user-common.h ++++ b/gcc/config/i386/gnu-user-common.h @@ -64,9 +64,3 @@ along with GCC; see the file COPYING3. If not see /* Static stack checking is supported by means of probes. */ @@ -54,8 +54,8 @@ Second part added to prevent gccgo from thinking it can -fsplit-stack on musl. -#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE -#define TARGET_CAN_SPLIT_STACK -#endif ---- gcc/config/i386/gnu.h -+++ gcc/config/i386/gnu.h +--- a/gcc/config/i386/gnu.h ++++ b/gcc/config/i386/gnu.h @@ -40,11 +40,6 @@ along with GCC. If not, see . /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ #define TARGET_THREAD_SSP_OFFSET 0x14 diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template index ba708493485..9ad69d9a27a 100644 --- a/srcpkgs/gcc/template +++ b/srcpkgs/gcc/template @@ -184,13 +184,11 @@ pre_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 + if [ "$XBPS_TARGET_LIBC" = musl ]; then + patch -p1 -i ${FILESDIR}/libgnarl-musl.patch + patch -p1 -i ${FILESDIR}/libssp-musl.patch + patch -p1 -i ${FILESDIR}/gccgo-musl.patch + fi } do_configure() { local _langs _args _hash