]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/cgo: fix stackguard on FreeBSD/amd64
authorAnthony Martin <ality@pbrane.org>
Thu, 6 Jan 2011 16:36:47 +0000 (11:36 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 6 Jan 2011 16:36:47 +0000 (11:36 -0500)
A cursory reading of the cgo code suggests this
should be necessary, though I don't have access
to a FreeBSD machine for testing.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3746047

src/pkg/runtime/cgo/freebsd_amd64.c

index a02fbf1519d56d9a62c3e52fabc88d484e4362c8..fe6ce391f3f9c6607105d3f58846474305f55ade 100644 (file)
@@ -37,6 +37,12 @@ threadentry(void *v)
 
        ts.g->stackbase = (uintptr)&ts;
 
+       /*
+        * libcgo_sys_thread_start set stackguard to stack size;
+        * change to actual guard pointer.
+        */
+       ts.g->stackguard = (uintptr)&ts - ts.g->stackguard + 4096;
+
        /*
         * Set specific keys.  On FreeBSD/ELF, the thread local storage
         * is just before %fs:0.  Our dynamic 6.out's reserve 16 bytes