diff --git a/1.20_linux/runtime/cgo/gcc_linux_amd64.c.patch b/1.20_linux/runtime/cgo/gcc_linux_amd64.c.patch new file mode 100644 index 0000000..b9d7289 --- /dev/null +++ b/1.20_linux/runtime/cgo/gcc_linux_amd64.c.patch @@ -0,0 +1,59 @@ +//--from +#include +#include +#include // strerror +#include +#include +#include "libcgo.h" +#include "libcgo_unix.h" +//--to +#include +#include +#include // strerror +#include +#include "libcgo.h" +#include "libcgo_unix.h" +//--from +void +_cgo_sys_thread_start(ThreadStart *ts) +{ + pthread_attr_t attr; + sigset_t ign, oset; + pthread_t p; + size_t size; + int err; + + sigfillset(&ign); + pthread_sigmask(SIG_SETMASK, &ign, &oset); + + pthread_attr_init(&attr); + pthread_attr_getstacksize(&attr, &size); + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts->g->stackhi = size; + err = _cgo_try_pthread_create(&p, &attr, threadentry, ts); + + pthread_sigmask(SIG_SETMASK, &oset, nil); + + if (err != 0) { + fatalf("pthread_create failed: %s", strerror(err)); + } +} +//--to +void +_cgo_sys_thread_start(ThreadStart *ts) +{ + pthread_attr_t attr; + pthread_t p; + size_t size; + int err; + + pthread_attr_init(&attr); + pthread_attr_getstacksize(&attr, &size); + // Leave stacklo=0 and set stackhi=size; mstart will do the rest. + ts->g->stackhi = size; + err = _cgo_try_pthread_create(&p, &attr, threadentry, ts); + + if (err != 0) { + fatalf("pthread_create failed: %s", strerror(err)); + } +}