aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/stack.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-06-12 21:12:53 -0400
committerRuss Cox <rsc@golang.org>2014-06-12 21:12:53 -0400
commit060a988011b34ded3e002e1a4cb138b7ed21b176 (patch)
tree7d7e3cef981acc1195aa43ed32d931e5247151b1 /src/pkg/runtime/stack.c
parente209a0fa06f03f098b16381fc79aa6aea9210b18 (diff)
downloadgo-060a988011b34ded3e002e1a4cb138b7ed21b176.tar.xz
runtime: revise CL 105140044 (defer nil) to work on Windows
It appears that something about Go on Windows cannot handle the fault cause by a jump to address 0. The way Go represents and calls functions, this never happened at all, until CL 105140044. This CL changes the code added in CL 105140044 to make jump to 0 impossible once again. Fixes #8047. (again, on Windows) TBR=bradfitz R=golang-codereviews, dave CC=adg, golang-codereviews, iant, r https://golang.org/cl/105120044
Diffstat (limited to 'src/pkg/runtime/stack.c')
-rw-r--r--src/pkg/runtime/stack.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c
index 1f7c2eaada..1680f004eb 100644
--- a/src/pkg/runtime/stack.c
+++ b/src/pkg/runtime/stack.c
@@ -9,6 +9,7 @@
#include "funcdata.h"
#include "typekind.h"
#include "type.h"
+#include "../../cmd/ld/textflag.h"
enum
{
@@ -851,6 +852,13 @@ runtime·newstack(void)
*(int32*)345 = 123; // never return
}
+#pragma textflag NOSPLIT
+void
+runtime·nilfunc(void)
+{
+ *(byte*)0 = 0;
+}
+
// adjust Gobuf as if it executed a call to fn
// and then did an immediate gosave.
void
@@ -858,9 +866,10 @@ runtime·gostartcallfn(Gobuf *gobuf, FuncVal *fv)
{
void *fn;
- fn = nil;
if(fv != nil)
fn = fv->fn;
+ else
+ fn = runtime·nilfunc;
runtime·gostartcall(gobuf, fn, fv);
}