]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: mark some C globals as having no pointers.
authorKeith Randall <khr@golang.org>
Sat, 31 May 2014 23:21:17 +0000 (19:21 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 31 May 2014 23:21:17 +0000 (19:21 -0400)
C globals are conservatively scanned.  This helps
avoid false retention, especially for 32 bit.

LGTM=rsc
R=golang-codereviews, khr, rsc
CC=golang-codereviews
https://golang.org/cl/102040043

src/pkg/runtime/alg.goc
src/pkg/runtime/heapdump.c
src/pkg/runtime/malloc.goc
src/pkg/runtime/msize.c
src/pkg/runtime/os_darwin.c
src/pkg/runtime/os_dragonfly.c
src/pkg/runtime/os_freebsd.c
src/pkg/runtime/os_netbsd.c
src/pkg/runtime/os_openbsd.c
src/pkg/runtime/os_solaris.c
src/pkg/runtime/proc.c

index 9fb54cac3ff00fcbe0f01e7275c53468a79b0f7f..f1b8d5982b1e6f5d7caa84e11a661325076455c3 100644 (file)
@@ -465,6 +465,7 @@ runtime·algarray[] =
 // Runtime helpers.
 
 // used in asm_{386,amd64}.s
+#pragma dataflag NOPTR
 byte runtime·aeskeysched[HashRandomBytes];
 
 void
index 0799a102c4a224f869db5101e71c6679342b37da..744c59f9bcc1786607835570b294b714e4adb7a2 100644 (file)
@@ -17,6 +17,7 @@
 #include "typekind.h"
 #include "funcdata.h"
 #include "zaexperiment.h"
+#include "../../cmd/ld/textflag.h"
 
 extern byte data[];
 extern byte edata[];
@@ -67,6 +68,7 @@ static uintptr dumpfd;
 enum {
        BufSize = 4096,
 };
+#pragma dataflag NOPTR
 static byte buf[BufSize];
 static uintptr nbuf;
 
index 6e1068d93d2f0f7015f699bdb7e634b02baa06e0..7b7e350d8d8f2b9f57d9ca199a682896e9e4a9fb 100644 (file)
@@ -19,6 +19,7 @@ package runtime
 // Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
 #pragma dataflag NOPTR
 MHeap runtime·mheap;
+#pragma dataflag NOPTR
 MStats mstats;
 
 int32  runtime·checking;
index 63d5ef490e8087ab9e7676e0cb4f471d1cc2c4b7..2fbd5e1042c9a08518c38538641d8451e8dfacb2 100644 (file)
 #include "runtime.h"
 #include "arch_GOARCH.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
+#pragma dataflag NOPTR
 int32 runtime·class_to_size[NumSizeClasses];
+#pragma dataflag NOPTR
 int32 runtime·class_to_allocnpages[NumSizeClasses];
 
 // The SizeToClass lookup is implemented using two arrays,
@@ -41,7 +44,9 @@ int32 runtime·class_to_allocnpages[NumSizeClasses];
 // size divided by 128 (rounded up).  The arrays are filled in
 // by InitSizes.
 
+#pragma dataflag NOPTR
 int8 runtime·size_to_class8[1024/8 + 1];
+#pragma dataflag NOPTR
 int8 runtime·size_to_class128[(MaxSmallSize-1024)/128 + 1];
 
 void runtime·testdefersizes(void);
index a1165dd7be614e05d722217524f905c997ac19f7..33a2df958f9c690e47693e5d1f6cfef6f8de67ca 100644 (file)
@@ -59,6 +59,7 @@ runtime·osinit(void)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 35a7de96fe02d185369b97edda70919a8c38ecb4..e7fd2cc06f5ca92cf87a869255d1dafa8c7812a1 100644 (file)
@@ -122,6 +122,7 @@ runtime·osinit(void)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 9a8de4206bb5edd69f797e795a5936e345cad0c5..02b13472c8a89b0e9707e9929cf3ed017f4d0bee 100644 (file)
@@ -130,6 +130,7 @@ runtime·osinit(void)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 7f4b97271c99aa47f8d4c5c0c03c19a751d57142..93229bffeb4fdd00f1e1db258d762d7f298739a7 100644 (file)
@@ -188,6 +188,7 @@ runtime·osinit(void)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 0eec7956cf348c33a07b7e72235eeff90449d492..08a290a0557319ba796759009f30841178483dc7 100644 (file)
@@ -167,6 +167,7 @@ runtime·osinit(void)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 75e7c18f4fdaf3d4a7b8b7f86153c39b823a5c7a..c6bbea3116ec5b60893f6f0c1c6bf71958ad5a09 100644 (file)
@@ -161,6 +161,7 @@ runtime·newosproc(M *mp, void *stk)
 void
 runtime·get_random_data(byte **rnd, int32 *rnd_len)
 {
+       #pragma dataflag NOPTR
        static byte urandom_data[HashRandomBytes];
        int32 fd;
        fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
index 665d34a40e073a5b089a5884da334d6a0e3dc6a1..da2e0f9fa4a62272d0e4f1d1854af3f8a136d7b7 100644 (file)
@@ -2597,6 +2597,7 @@ struct Pdesc
        uint32  syscalltick;
        int64   syscallwhen;
 };
+#pragma dataflag NOPTR
 static Pdesc pdesc[MaxGomaxprocs];
 
 static uint32