174 lines
5.9 KiB
Diff
174 lines
5.9 KiB
Diff
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
|
|
|
|
--- a/Makefile.in
|
|
+++ b/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} \
|
|
--- a/libgo/mksysinfo.sh
|
|
+++ b/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}
|
|
--- a/libgo/go/runtime/mem_gccgo.go
|
|
+++ b/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()
|
|
--- 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.
|
|
|
|
// +build !hurd
|
|
-// +build !linux
|
|
|
|
package syscall
|
|
|
|
--- a/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])
|
|
-}
|
|
--- 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
|
|
|
|
-//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)
|
|
--- 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
|
|
#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.
|
|
--- a/libgo/sysinfo.c
|
|
+++ b/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
|
|
--- a/libgo/go/runtime/os_linux.go
|
|
+++ b/libgo/go/runtime/os_linux.go
|
|
@@ -365,7 +365,7 @@ func setThreadCPUProfiler(hz int32) {
|
|
var sevp _sigevent
|
|
sevp.sigev_notify = _SIGEV_THREAD_ID
|
|
sevp.sigev_signo = _SIGPROF
|
|
- *((*int32)(unsafe.Pointer(&sevp._sigev_un))) = int32(mp.procid)
|
|
+ *((*int32)(unsafe.Pointer(&sevp.__sev_fields))) = 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
|