summaryrefslogtreecommitdiff
path: root/src/cmd/cc/godefs.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-07 11:07:18 -0400
committerRuss Cox <rsc@golang.org>2014-10-07 11:07:18 -0400
commitedec49862088bc2efe851aeba6a350406f818be7 (patch)
tree938321ddd7f6261d9ac882b7e96897b6339014a5 /src/cmd/cc/godefs.c
parent8fc36a23e489c4a4fe7cb2091630d48cdb04905b (diff)
downloadgo-edec49862088bc2efe851aeba6a350406f818be7.tar.gz
runtime: crash if we see an invalid pointer into GC arena
This will help find bugs during the release freeze. It's not clear it should be kept for the release itself. That's issue 8861. The most likely thing that would trigger this is stale pointers that previously were ignored or caused memory leaks. These were allowed due to the use of conservative collection. Now that everything is precise, we should not see them anymore. The small number check reinforces what the stack copier is already doing, catching the storage of integers in pointers. It caught issue 8864. The check is disabled if _cgo_allocate is linked into the binary, which is to say if the binary is using SWIG to allocate untyped Go memory. In that case, there are invalid pointers and there's nothing we can do about it. LGTM=rlh R=golang-codereviews, dvyukov, rlh CC=golang-codereviews, iant, khr, r https://codereview.appspot.com/148470043
Diffstat (limited to 'src/cmd/cc/godefs.c')
-rw-r--r--src/cmd/cc/godefs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/cc/godefs.c b/src/cmd/cc/godefs.c
index d3ab52fde..d9f67f0ae 100644
--- a/src/cmd/cc/godefs.c
+++ b/src/cmd/cc/godefs.c
@@ -353,8 +353,10 @@ godefvar(Sym *s)
case CSTATIC:
case CEXTERN:
case CGLOBL:
- if(strchr(s->name, '$') != nil) // TODO(lvd)
- break;
+ if(strchr(s->name, '$') != nil)
+ break;
+ if(strncmp(s->name, "go.weak.", 8) == 0)
+ break;
Bprint(&outbuf, "var %U\t", s->name);
printtypename(t);
Bprint(&outbuf, "\n");