mirror of
https://github.com/golang/go.git
synced 2025-05-31 23:25:39 +00:00
cmd/ld, runtime/cgo: allow a symbol to be both cgo_export and cgo_import.
Fixes #4878. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7420052
This commit is contained in:
parent
72dd01451f
commit
960d7082ee
@ -499,11 +499,16 @@ loadcgo(char *file, char *pkg, char *p, int n)
|
||||
remote = local;
|
||||
local = expandpkg(local, pkg);
|
||||
s = lookup(local, 0);
|
||||
|
||||
// export overrides import, for openbsd/cgo.
|
||||
// see issue 4878.
|
||||
if(s->dynimplib != nil) {
|
||||
fprint(2, "%s: symbol is both imported and exported: %s\n", argv0, local);
|
||||
nerrors++;
|
||||
s->dynimplib = nil;
|
||||
s->extname = nil;
|
||||
s->dynimpvers = nil;
|
||||
s->type = 0;
|
||||
}
|
||||
|
||||
|
||||
if(s->cgoexport == 0) {
|
||||
if(strcmp(f[0], "cgo_export_static") == 0)
|
||||
s->cgoexport |= CgoExportStatic;
|
||||
|
@ -48,9 +48,9 @@ tcb_fixup(int mainthread)
|
||||
bcopy(oldtcb, newtcb + TLS_SIZE, TCB_SIZE);
|
||||
__set_tcb(newtcb + TLS_SIZE);
|
||||
|
||||
// The main thread TCB is a static allocation - do not try to free it.
|
||||
if(!mainthread)
|
||||
free(oldtcb);
|
||||
// NOTE(jsing, minux): we can't free oldtcb without causing double-free
|
||||
// problem. so newtcb will be memory leaks. Get rid of this when OpenBSD
|
||||
// has proper support for PT_TLS.
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -48,9 +48,9 @@ tcb_fixup(int mainthread)
|
||||
bcopy(oldtcb, newtcb + TLS_SIZE, TCB_SIZE);
|
||||
__set_tcb(newtcb + TLS_SIZE);
|
||||
|
||||
// The main thread TCB is a static allocation - do not try to free it.
|
||||
if(!mainthread)
|
||||
free(oldtcb);
|
||||
// NOTE(jsing, minux): we can't free oldtcb without causing double-free
|
||||
// problem. so newtcb will be memory leaks. Get rid of this when OpenBSD
|
||||
// has proper support for PT_TLS.
|
||||
}
|
||||
|
||||
static void *
|
||||
|
@ -74,7 +74,6 @@ go run $GOROOT/test/run.go - .
|
||||
) || exit $?
|
||||
|
||||
[ "$CGO_ENABLED" != 1 ] ||
|
||||
[ "$GOHOSTOS" == openbsd ] || # issue 4878
|
||||
(xcd ../misc/cgo/test
|
||||
go test
|
||||
case "$GOHOSTOS-$GOARCH" in
|
||||
|
Loading…
x
Reference in New Issue
Block a user