Update to go1.24.1
This commit is contained in:
@@ -25,7 +25,8 @@ package cgo
|
||||
|
||||
// Use -fno-stack-protector to avoid problems locating the
|
||||
// proper support functions. See issues #52919, #54313, #58385.
|
||||
#cgo CFLAGS: -Wall -Werror -fno-stack-protector
|
||||
// Use -Wdeclaration-after-statement because some CI builds use it.
|
||||
#cgo CFLAGS: -Wall -Werror -fno-stack-protector -Wdeclaration-after-statement
|
||||
|
||||
#cgo solaris CPPFLAGS: -D_POSIX_PTHREAD_SEMANTICS
|
||||
|
||||
|
||||
@@ -76,19 +76,27 @@ threadentry(void *v)
|
||||
static void
|
||||
init_working_dir()
|
||||
{
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFBundleRef bundle;
|
||||
CFURLRef url_ref;
|
||||
CFStringRef url_str_ref;
|
||||
char buf[MAXPATHLEN];
|
||||
Boolean res;
|
||||
int url_len;
|
||||
char *dir;
|
||||
CFStringRef wd_ref;
|
||||
|
||||
bundle = CFBundleGetMainBundle();
|
||||
if (bundle == NULL) {
|
||||
fprintf(stderr, "runtime/cgo: no main bundle\n");
|
||||
return;
|
||||
}
|
||||
CFURLRef url_ref = CFBundleCopyResourceURL(bundle, CFSTR("Info"), CFSTR("plist"), NULL);
|
||||
url_ref = CFBundleCopyResourceURL(bundle, CFSTR("Info"), CFSTR("plist"), NULL);
|
||||
if (url_ref == NULL) {
|
||||
// No Info.plist found. It can happen on Corellium virtual devices.
|
||||
return;
|
||||
}
|
||||
CFStringRef url_str_ref = CFURLGetString(url_ref);
|
||||
char buf[MAXPATHLEN];
|
||||
Boolean res = CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8);
|
||||
url_str_ref = CFURLGetString(url_ref);
|
||||
res = CFStringGetCString(url_str_ref, buf, sizeof(buf), kCFStringEncodingUTF8);
|
||||
CFRelease(url_ref);
|
||||
if (!res) {
|
||||
fprintf(stderr, "runtime/cgo: cannot get URL string\n");
|
||||
@@ -97,13 +105,13 @@ init_working_dir()
|
||||
|
||||
// url is of the form "file:///path/to/Info.plist".
|
||||
// strip it down to the working directory "/path/to".
|
||||
int url_len = strlen(buf);
|
||||
url_len = strlen(buf);
|
||||
if (url_len < sizeof("file://")+sizeof("/Info.plist")) {
|
||||
fprintf(stderr, "runtime/cgo: bad URL: %s\n", buf);
|
||||
return;
|
||||
}
|
||||
buf[url_len-sizeof("/Info.plist")+1] = 0;
|
||||
char *dir = &buf[0] + sizeof("file://")-1;
|
||||
dir = &buf[0] + sizeof("file://")-1;
|
||||
|
||||
if (chdir(dir) != 0) {
|
||||
fprintf(stderr, "runtime/cgo: chdir(%s) failed\n", dir);
|
||||
@@ -111,7 +119,7 @@ init_working_dir()
|
||||
|
||||
// The test harness in go_ios_exec passes the relative working directory
|
||||
// in the GoExecWrapperWorkingDirectory property of the app bundle.
|
||||
CFStringRef wd_ref = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("GoExecWrapperWorkingDirectory"));
|
||||
wd_ref = CFBundleGetValueForInfoDictionaryKey(bundle, CFSTR("GoExecWrapperWorkingDirectory"));
|
||||
if (wd_ref != NULL) {
|
||||
if (!CFStringGetCString(wd_ref, buf, sizeof(buf), kCFStringEncodingUTF8)) {
|
||||
fprintf(stderr, "runtime/cgo: cannot get GoExecWrapperWorkingDirectory string\n");
|
||||
|
||||
@@ -39,10 +39,11 @@ void
|
||||
x_cgo_sys_thread_create(void* (*func)(void*), void* arg) {
|
||||
pthread_attr_t attr;
|
||||
pthread_t p;
|
||||
int err;
|
||||
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
int err = _cgo_try_pthread_create(&p, &attr, func, arg);
|
||||
err = _cgo_try_pthread_create(&p, &attr, func, arg);
|
||||
if (err != 0) {
|
||||
fprintf(stderr, "pthread_create failed: %s", strerror(err));
|
||||
abort();
|
||||
@@ -52,9 +53,11 @@ x_cgo_sys_thread_create(void* (*func)(void*), void* arg) {
|
||||
uintptr_t
|
||||
_cgo_wait_runtime_init_done(void) {
|
||||
void (*pfn)(struct context_arg*);
|
||||
int done;
|
||||
|
||||
pfn = __atomic_load_n(&cgo_context_function, __ATOMIC_CONSUME);
|
||||
|
||||
int done = 2;
|
||||
done = 2;
|
||||
if (__atomic_load_n(&runtime_init_done, __ATOMIC_CONSUME) != done) {
|
||||
pthread_mutex_lock(&runtime_init_mu);
|
||||
while (__atomic_load_n(&runtime_init_done, __ATOMIC_CONSUME) == 0) {
|
||||
|
||||
@@ -75,8 +75,10 @@ x_cgo_sys_thread_create(void (*func)(void*), void* arg) {
|
||||
|
||||
int
|
||||
_cgo_is_runtime_initialized() {
|
||||
int status;
|
||||
|
||||
EnterCriticalSection(&runtime_init_cs);
|
||||
int status = runtime_init_done;
|
||||
status = runtime_init_done;
|
||||
LeaveCriticalSection(&runtime_init_cs);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,10 @@ import (
|
||||
// unreachable at the same time, their cleanups all become eligible to run
|
||||
// and can run in any order. This is true even if the objects form a cycle.
|
||||
//
|
||||
// A single goroutine runs all cleanup calls for a program, sequentially. If a
|
||||
// cleanup function must run for a long time, it should create a new goroutine.
|
||||
// Cleanups run concurrently with any user-created goroutines.
|
||||
// Cleanups may also run concurrently with one another (unlike finalizers).
|
||||
// If a cleanup function must run for a long time, it should create a new goroutine
|
||||
// to avoid blocking the execution of other cleanups.
|
||||
//
|
||||
// If ptr has both a cleanup and a finalizer, the cleanup will only run once
|
||||
// it has been finalized and becomes unreachable without an associated finalizer.
|
||||
|
||||
@@ -391,10 +391,15 @@ func deferrangefunc() any {
|
||||
throw("defer on system stack")
|
||||
}
|
||||
|
||||
fn := findfunc(sys.GetCallerPC())
|
||||
if fn.deferreturn == 0 {
|
||||
throw("no deferreturn")
|
||||
}
|
||||
|
||||
d := newdefer()
|
||||
d.link = gp._defer
|
||||
gp._defer = d
|
||||
d.pc = sys.GetCallerPC()
|
||||
d.pc = fn.entry() + uintptr(fn.deferreturn)
|
||||
// We must not be preempted between calling GetCallerSP and
|
||||
// storing it to d.sp because GetCallerSP's result is a
|
||||
// uintptr stack pointer.
|
||||
@@ -1246,6 +1251,8 @@ func recovery(gp *g) {
|
||||
// only gets us to the caller's fp.
|
||||
gp.sched.bp = sp - goarch.PtrSize
|
||||
}
|
||||
// The value in ret is delivered IN A REGISTER, even if there is a
|
||||
// stack ABI.
|
||||
gp.sched.ret = 1
|
||||
gogo(&gp.sched)
|
||||
}
|
||||
|
||||
@@ -312,6 +312,16 @@ func asmcgocall(fn, arg unsafe.Pointer) int32
|
||||
|
||||
func morestack()
|
||||
|
||||
// morestack_noctxt should be an internal detail,
|
||||
// but widely used packages access it using linkname.
|
||||
// Notable members of the hall of shame include:
|
||||
// - github.com/bytedance/sonic
|
||||
//
|
||||
// Do not remove or change the type signature.
|
||||
// See go.dev/issues/67401.
|
||||
// See go.dev/issues/71672.
|
||||
//
|
||||
//go:linkname morestack_noctxt
|
||||
func morestack_noctxt()
|
||||
|
||||
func rt0_go()
|
||||
|
||||
@@ -480,7 +480,18 @@ var pinnedTypemaps []map[typeOff]*_type
|
||||
// the relocated one.
|
||||
var aixStaticDataBase uintptr // linker symbol
|
||||
|
||||
var firstmoduledata moduledata // linker symbol
|
||||
var firstmoduledata moduledata // linker symbol
|
||||
|
||||
// lastmoduledatap should be an internal detail,
|
||||
// but widely used packages access it using linkname.
|
||||
// Notable members of the hall of shame include:
|
||||
// - github.com/bytedance/sonic
|
||||
//
|
||||
// Do not remove or change the type signature.
|
||||
// See go.dev/issues/67401.
|
||||
// See go.dev/issues/71672.
|
||||
//
|
||||
//go:linkname lastmoduledatap
|
||||
var lastmoduledatap *moduledata // linker symbol
|
||||
|
||||
var modulesSlice *[]*moduledata // see activeModules
|
||||
@@ -591,6 +602,16 @@ func moduledataverify() {
|
||||
|
||||
const debugPcln = false
|
||||
|
||||
// moduledataverify1 should be an internal detail,
|
||||
// but widely used packages access it using linkname.
|
||||
// Notable members of the hall of shame include:
|
||||
// - github.com/bytedance/sonic
|
||||
//
|
||||
// Do not remove or change the type signature.
|
||||
// See go.dev/issues/67401.
|
||||
// See go.dev/issues/71672.
|
||||
//
|
||||
//go:linkname moduledataverify1
|
||||
func moduledataverify1(datap *moduledata) {
|
||||
// Check that the pclntab's format is valid.
|
||||
hdr := datap.pcHeader
|
||||
|
||||
@@ -112,9 +112,10 @@ TEXT runtime·usleep(SB),NOSPLIT,$16-4
|
||||
MOVW $1000000, R3
|
||||
DIVD R3, R2
|
||||
MOVD R2, 8(R15)
|
||||
MOVW $1000, R3
|
||||
MULLD R2, R3
|
||||
MULLD R2, R3 // Convert sec to usec and subtract
|
||||
SUB R3, R4
|
||||
MOVW $1000, R3
|
||||
MULLD R3, R4 // Convert remaining usec into nsec.
|
||||
MOVD R4, 16(R15)
|
||||
|
||||
// nanosleep(&ts, 0)
|
||||
|
||||
Reference in New Issue
Block a user