aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/cgo
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/cgo')
-rw-r--r--src/runtime/cgo/callbacks.c3
-rw-r--r--src/runtime/cgo/dragonfly.c4
-rw-r--r--src/runtime/cgo/freebsd.c4
-rw-r--r--src/runtime/cgo/gcc_setenv.c7
-rw-r--r--src/runtime/cgo/netbsd.c4
-rw-r--r--src/runtime/cgo/openbsd.c4
-rw-r--r--src/runtime/cgo/setenv.c3
7 files changed, 29 insertions, 0 deletions
diff --git a/src/runtime/cgo/callbacks.c b/src/runtime/cgo/callbacks.c
index 16614d03db..282beeea88 100644
--- a/src/runtime/cgo/callbacks.c
+++ b/src/runtime/cgo/callbacks.c
@@ -78,3 +78,6 @@ void (*_cgo_free)(void*) = x_cgo_free;
#pragma cgo_import_static x_cgo_thread_start
extern void x_cgo_thread_start(void*);
void (*_cgo_thread_start)(void*) = x_cgo_thread_start;
+
+#pragma cgo_export_static _cgo_topofstack
+#pragma cgo_export_dynamic _cgo_topofstack
diff --git a/src/runtime/cgo/dragonfly.c b/src/runtime/cgo/dragonfly.c
index acf53e2655..3c95ff354e 100644
--- a/src/runtime/cgo/dragonfly.c
+++ b/src/runtime/cgo/dragonfly.c
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "textflag.h"
+
// Supply environ and __progname, because we don't
// link against the standard DragonFly crt0.o and the
// libc dynamic library needs them.
+#pragma dataflag NOPTR
char *environ[1];
+#pragma dataflag NOPTR
char *__progname;
#pragma dynexport environ environ
diff --git a/src/runtime/cgo/freebsd.c b/src/runtime/cgo/freebsd.c
index dfcfa3a213..aefc481e64 100644
--- a/src/runtime/cgo/freebsd.c
+++ b/src/runtime/cgo/freebsd.c
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "textflag.h"
+
// Supply environ and __progname, because we don't
// link against the standard FreeBSD crt0.o and the
// libc dynamic library needs them.
+#pragma dataflag NOPTR
char *environ[1];
+#pragma dataflag NOPTR
char *__progname;
#pragma dynexport environ environ
diff --git a/src/runtime/cgo/gcc_setenv.c b/src/runtime/cgo/gcc_setenv.c
index 8b128b9465..af0fc5d8d8 100644
--- a/src/runtime/cgo/gcc_setenv.c
+++ b/src/runtime/cgo/gcc_setenv.c
@@ -14,3 +14,10 @@ x_cgo_setenv(char **arg)
{
setenv(arg[0], arg[1], 1);
}
+
+/* Stub for calling unsetenv */
+void
+x_cgo_unsetenv(char *arg)
+{
+ unsetenv(arg);
+}
diff --git a/src/runtime/cgo/netbsd.c b/src/runtime/cgo/netbsd.c
index b6403f686c..de38bb7707 100644
--- a/src/runtime/cgo/netbsd.c
+++ b/src/runtime/cgo/netbsd.c
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "textflag.h"
+
// Supply environ and __progname, because we don't
// link against the standard NetBSD crt0.o and the
// libc dynamic library needs them.
+#pragma dataflag NOPTR
char *environ[1];
+#pragma dataflag NOPTR
char *__progname;
#pragma dynexport environ environ
diff --git a/src/runtime/cgo/openbsd.c b/src/runtime/cgo/openbsd.c
index 84e9f9efff..7c2b6c1737 100644
--- a/src/runtime/cgo/openbsd.c
+++ b/src/runtime/cgo/openbsd.c
@@ -2,11 +2,15 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+#include "textflag.h"
+
// Supply environ, __progname and __guard_local, because
// we don't link against the standard OpenBSD crt0.o and
// the libc dynamic library needs them.
+#pragma dataflag NOPTR
char *environ[1];
+#pragma dataflag NOPTR
char *__progname;
long __guard_local;
diff --git a/src/runtime/cgo/setenv.c b/src/runtime/cgo/setenv.c
index ee529904f7..76d88cbf13 100644
--- a/src/runtime/cgo/setenv.c
+++ b/src/runtime/cgo/setenv.c
@@ -5,6 +5,9 @@
// +build darwin dragonfly freebsd linux netbsd openbsd
#pragma cgo_import_static x_cgo_setenv
+#pragma cgo_import_static x_cgo_unsetenv
void x_cgo_setenv(char**);
void (*runtimeĀ·_cgo_setenv)(char**) = x_cgo_setenv;
+void x_cgo_unsetenv(char**);
+void (*runtimeĀ·_cgo_unsetenv)(char**) = x_cgo_unsetenv;