Commit b2f19dad authored by Elias Naur's avatar Elias Naur

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/+/169797Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 9f6b21ca
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment