void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

gccgo-musl.patch (8425B)


      1This is not among the normal patches as these changes are musl specific and
      2there is no way to easily conditionalize it in source for some of the changes.
      3
      4Added by q66: runtime.h now uses libucontext_ prefixed APIs to allow build
      5with freestanding versions of libucontext
      6
      7Souurce: Adélie Linux, q66
      8URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
      9
     10--- Makefile.in
     11+++ Makefile.in
     12@@ -46325,7 +46325,7 @@ configure-target-libgo:
     13 	esac; \
     14 	module_srcdir=libgo; \
     15 	rm -f no-such-file || : ; \
     16-	CONFIG_SITE=no-such-file $(SHELL) \
     17+	CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
     18 	  $$s/$$module_srcdir/configure \
     19 	  --srcdir=$${topdir}/$$module_srcdir \
     20 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
     21--- libgo/mksysinfo.sh
     22+++ libgo/mksysinfo.sh
     23@@ -379,11 +379,7 @@ fi
     24 # Some basic types.
     25 echo 'type Size_t _size_t' >> ${OUT}
     26 echo "type Ssize_t _ssize_t" >> ${OUT}
     27-if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then
     28-  echo "type Offset_t _off64_t" >> ${OUT}
     29-else
     30-  echo "type Offset_t _off_t" >> ${OUT}
     31-fi
     32+echo "type Offset_t _off_t" >> ${OUT}
     33 echo "type Mode_t _mode_t" >> ${OUT}
     34 echo "type Pid_t _pid_t" >> ${OUT}
     35 echo "type Uid_t _uid_t" >> ${OUT}
     36--- libgo/go/runtime/mem_gccgo.go
     37+++ libgo/go/runtime/mem_gccgo.go
     38@@ -16,7 +16,7 @@ import (
     39 //go:linkname sysFree runtime.sysFree
     40 
     41 //extern mmap
     42-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
     43+func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) unsafe.Pointer
     44 
     45 //extern munmap
     46 func munmap(addr unsafe.Pointer, length uintptr) int32
     47@@ -38,7 +38,7 @@ func init() {
     48 	}
     49 }
     50 
     51-func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
     52+func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) (unsafe.Pointer, int) {
     53 	p := sysMmap(addr, n, prot, flags, fd, off)
     54 	if uintptr(p) == _MAP_FAILED {
     55 		return nil, errno()
     56--- libgo/go/runtime/signal_gccgo.go
     57+++ libgo/go/runtime/signal_gccgo.go
     58@@ -111,7 +111,7 @@ func getsig(i uint32) uintptr {
     59 	if sigaction(i, nil, &sa) < 0 {
     60 		// On GNU/Linux glibc rejects attempts to call
     61 		// sigaction with signal 32 (SIGCANCEL) or 33 (SIGSETXID).
     62-		if GOOS == "linux" && (i == 32 || i == 33) {
     63+		if GOOS == "linux" && (i == 32 || i == 33 || i == 34) {
     64 			return _SIG_DFL
     65 		}
     66 		throw("sigaction read failure")
     67--- libgo/go/syscall/errstr.go
     68+++ libgo/go/syscall/errstr.go
     69@@ -5,7 +5,6 @@
     70 // license that can be found in the LICENSE file.
     71 
     72 // +build !hurd
     73-// +build !linux
     74 
     75 package syscall
     76 
     77--- libgo/go/syscall/errstr_glibc.go
     78+++ /dev/null
     79@@ -1,33 +0,0 @@
     80-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
     81-
     82-// Copyright 2010 The Go Authors. All rights reserved.
     83-// Use of this source code is governed by a BSD-style
     84-// license that can be found in the LICENSE file.
     85-
     86-// We use this rather than errstr.go because on GNU/Linux sterror_r
     87-// returns a pointer to the error message, and may not use buf at all.
     88-
     89-// +build hurd linux
     90-
     91-package syscall
     92-
     93-import "unsafe"
     94-
     95-//sysnb	strerror_r(errnum int, b []byte) (errstr *byte)
     96-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
     97-
     98-func Errstr(errnum int) string {
     99-	a := make([]byte, 128)
    100-	p := strerror_r(errnum, a)
    101-	b := (*[1000]byte)(unsafe.Pointer(p))
    102-	i := 0
    103-	for b[i] != 0 {
    104-		i++
    105-	}
    106-	// Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
    107-	if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
    108-		c := b[0] + 'a' - 'A'
    109-		return string(c) + string(b[1:i])
    110-	}
    111-	return string(b[:i])
    112-}
    113--- libgo/go/syscall/libcall_linux.go
    114+++ libgo/go/syscall/libcall_linux.go
    115@@ -206,19 +206,19 @@ func Gettid() (tid int) {
    116 //sys	Setxattr(path string, attr string, data []byte, flags int) (err error)
    117 //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
    118 
    119-//sys	splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
    120-//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
    121+//sys	splice(rfd int, roff *_off_t, wfd int, woff *_off_t, len int, flags int) (n int64, err error)
    122+//splice(rfd _C_int, roff *_off_t, wfd _C_int, woff *_off_t, len Size_t, flags _C_uint) Ssize_t
    123 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
    124-	var lroff _loff_t
    125-	var plroff *_loff_t
    126+	var lroff _off_t
    127+	var plroff *_off_t
    128 	if roff != nil {
    129-		lroff = _loff_t(*roff)
    130+		lroff = _off_t(*roff)
    131 		plroff = &lroff
    132 	}
    133-	var lwoff _loff_t
    134-	var plwoff *_loff_t
    135+	var lwoff _off_t
    136+	var plwoff *_off_t
    137 	if woff != nil {
    138-		lwoff = _loff_t(*woff)
    139+		lwoff = _off_t(*woff)
    140 		plwoff = &lwoff
    141 	}
    142 	n, err = splice(rfd, plroff, wfd, plwoff, len, flags)
    143--- libgo/mksigtab.sh
    144+++ libgo/mksigtab.sh
    145@@ -82,7 +82,7 @@ checksig _SIGPWR     '{_SigNotify, "SIGPWR: power failure restart"}'
    146 checksig _SIGEMT     '{_SigThrow, "SIGEMT: emulate instruction executed"}'
    147 checksig _SIGINFO    '{_SigNotify, "SIGINFO: status request from keyboard"}'
    148 checksig _SIGTHR     '{_SigNotify, "SIGTHR: reserved"}'
    149-checksig _SIGPOLL    '{_SigNotify, "SIGPOLL: pollable event occurred"}'
    150+#checksig _SIGPOLL    '{_SigNotify, "SIGPOLL: pollable event occurred"}'
    151 checksig _SIGWAITING '{_SigNotify, "SIGWAITING: reserved signal no longer used by"}'
    152 checksig _SIGLWP     '{_SigNotify, "SIGLWP: reserved signal no longer used by"}'
    153 checksig _SIGFREEZE  '{_SigNotify, "SIGFREEZE: special signal used by CPR"}'
    154@@ -95,10 +95,12 @@ checksig _SIGLOST '   {_SigNotify, "SIGLOST: resource lost (Sun); server died (G
    155 
    156 # Special handling of signals 32 and 33 on GNU/Linux systems,
    157 # because they are special to glibc.
    158+# Signal 34 is additionally special to Linux systems with musl.
    159 if test "${GOOS}" = "linux"; then
    160-    SIGLIST=$SIGLIST"_32__33_"
    161+    SIGLIST=$SIGLIST"_32__33__34_"
    162     echo '	32: {_SigSetStack + _SigUnblock, "signal 32"}, /* SIGCANCEL; see issue 6997 */'
    163     echo '	33: {_SigSetStack + _SigUnblock, "signal 33"}, /* SIGSETXID; see issues 3871, 9400, 12498 */'
    164+    echo '	34: {_SigSetStack + _SigUnblock, "signal 34"}, /* see issue 30062 */'
    165 fi
    166 
    167 if test "${GOOS}" = "aix"; then
    168--- libgo/runtime/go-signal.c	2020-07-23 08:35:19.004402840 +0200
    169+++ -	2020-08-09 21:35:54.352886232 +0200
    170@@ -224,7 +224,11 @@
    171 #elif defined(__alpha__) && defined(__linux__)
    172 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
    173 #elif defined(__PPC__) && defined(__linux__)
    174-	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
    175+	#ifdef __PPC64__
    176+		ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
    177+	#else
    178+		ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[32];
    179+	#endif
    180 #elif defined(__PPC__) && defined(_AIX)
    181 	ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
    182 #elif defined(__aarch64__) && defined(__linux__)
    183@@ -333,7 +337,7 @@
    184 		runtime_printf("sp  %X\n", m->sc_regs[30]);
    185 		runtime_printf("pc  %X\n", m->sc_pc);
    186 	  }
    187-#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__)
    188+#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__) && defined(__GLIBC__)
    189 	  {
    190 		mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
    191 		int i;
    192--- libgo/runtime/runtime.h
    193+++ libgo/runtime/runtime.h
    194@@ -500,10 +500,13 @@ int __go_setcontext(__go_context_t*);
    195 void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
    196 #else
    197 #define __go_context_t	ucontext_t
    198-#define __go_getcontext(c)	getcontext(c)
    199-#define __go_setcontext(c)	setcontext(c)
    200+int  libucontext_getcontext(__go_context_t *);
    201+void libucontext_makecontext(__go_context_t *, void (*)(), int, ...);
    202+int  libucontext_setcontext(const __go_context_t *);
    203+#define __go_getcontext(c)	libucontext_getcontext(c)
    204+#define __go_setcontext(c)	libucontext_setcontext(c)
    205 #define __go_makecontext(c, fn, sp, size) \
    206-	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
    207+	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0))
    208 #endif
    209 
    210 // Symbols defined by the linker.
    211--- libgo/sysinfo.c
    212+++ libgo/sysinfo.c
    213@@ -73,9 +73,6 @@
    214 #include <sys/times.h>
    215 #include <sys/wait.h>
    216 #include <sys/un.h>
    217-#if defined(HAVE_SYS_USER_H)
    218-#include <sys/user.h>
    219-#endif
    220 #if defined(HAVE_SYS_UTSNAME_H)
    221 #include <sys/utsname.h>
    222 #endif