mirror of
https://github.com/golang/go
synced 2024-11-17 21:04:43 -07:00
runtime/cgo: remove threadentry functions specialized for android
The specialized functions set up the g register using the pthread API instead of setg_gcc, but the inittls functions have already made sure setg_gcc works. Updates #29674 Change-Id: Ie67c068d638af8b5823978ee839f6b61b2228996 Reviewed-on: https://go-review.googlesource.com/c/go/+/169797 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
9f6b21caea
commit
b2f19dad8b
@ -7,9 +7,6 @@
|
||||
#include <signal.h>
|
||||
#include "libcgo.h"
|
||||
|
||||
static void* threadentry(void*);
|
||||
static pthread_key_t k1;
|
||||
|
||||
#define magic1 (0x23581321U)
|
||||
|
||||
static void
|
||||
@ -44,7 +41,6 @@ inittls(void)
|
||||
asm volatile("movl %%gs:0xf8, %0" : "=r"(x));
|
||||
pthread_setspecific(k, 0);
|
||||
if (x == magic1) {
|
||||
k1 = k;
|
||||
break;
|
||||
}
|
||||
if(ntofree >= nelem(tofree)) {
|
||||
@ -68,23 +64,4 @@ inittls(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
threadentry(void *v)
|
||||
{
|
||||
ThreadStart ts;
|
||||
|
||||
ts = *(ThreadStart*)v;
|
||||
free(v);
|
||||
|
||||
if (pthread_setspecific(k1, (void*)ts.g) != 0) {
|
||||
fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
crosscall_386(ts.fn);
|
||||
return nil;
|
||||
}
|
||||
|
||||
void (*x_cgo_inittls)(void) = inittls;
|
||||
void* (*x_cgo_threadentry)(void*) = threadentry;
|
||||
|
@ -7,9 +7,6 @@
|
||||
#include <signal.h>
|
||||
#include "libcgo.h"
|
||||
|
||||
static void* threadentry(void*);
|
||||
static pthread_key_t k1;
|
||||
|
||||
#define magic1 (0x23581321345589ULL)
|
||||
|
||||
static void
|
||||
@ -49,7 +46,6 @@ inittls(void)
|
||||
asm volatile("movq %%fs:0x1d0, %0" : "=r"(x));
|
||||
pthread_setspecific(k, 0);
|
||||
if(x == magic1) {
|
||||
k1 = k;
|
||||
break;
|
||||
}
|
||||
if(ntofree >= nelem(tofree)) {
|
||||
@ -73,23 +69,4 @@ inittls(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
threadentry(void *v)
|
||||
{
|
||||
ThreadStart ts;
|
||||
|
||||
ts = *(ThreadStart*)v;
|
||||
free(v);
|
||||
|
||||
if (pthread_setspecific(k1, (void*)ts.g) != 0) {
|
||||
fprintf(stderr, "runtime/cgo: pthread_setspecific failed\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
crosscall_amd64(ts.fn);
|
||||
return nil;
|
||||
}
|
||||
|
||||
void (*x_cgo_inittls)(void) = inittls;
|
||||
void* (*x_cgo_threadentry)(void*) = threadentry;
|
||||
|
@ -11,9 +11,8 @@
|
||||
static void *threadentry(void*);
|
||||
static void (*setg_gcc)(void*);
|
||||
|
||||
// These will be set in gcc_android_386.c for android-specific customization.
|
||||
// This will be set in gcc_android_386.c for android-specific customization.
|
||||
void (*x_cgo_inittls)(void);
|
||||
void* (*x_cgo_threadentry)(void*);
|
||||
|
||||
void
|
||||
x_cgo_init(G *g, void (*setg)(void*))
|
||||
@ -32,7 +31,6 @@ x_cgo_init(G *g, void (*setg)(void*))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_cgo_sys_thread_start(ThreadStart *ts)
|
||||
{
|
||||
@ -66,10 +64,6 @@ _cgo_sys_thread_start(ThreadStart *ts)
|
||||
static void*
|
||||
threadentry(void *v)
|
||||
{
|
||||
if (x_cgo_threadentry) {
|
||||
return x_cgo_threadentry(v);
|
||||
}
|
||||
|
||||
ThreadStart ts;
|
||||
|
||||
ts = *(ThreadStart*)v;
|
||||
|
@ -13,9 +13,8 @@
|
||||
static void* threadentry(void*);
|
||||
static void (*setg_gcc)(void*);
|
||||
|
||||
// These will be set in gcc_android_amd64.c for android-specific customization.
|
||||
// This will be set in gcc_android_amd64.c for android-specific customization.
|
||||
void (*x_cgo_inittls)(void);
|
||||
void* (*x_cgo_threadentry)(void*);
|
||||
|
||||
void
|
||||
x_cgo_init(G* g, void (*setg)(void*))
|
||||
@ -83,10 +82,6 @@ _cgo_sys_thread_start(ThreadStart *ts)
|
||||
static void*
|
||||
threadentry(void *v)
|
||||
{
|
||||
if (x_cgo_threadentry) {
|
||||
return x_cgo_threadentry(v);
|
||||
}
|
||||
|
||||
ThreadStart ts;
|
||||
|
||||
ts = *(ThreadStart*)v;
|
||||
|
Loading…
Reference in New Issue
Block a user