Commit 548b15de authored by Keith Randall's avatar Keith Randall Committed by Russ Cox

runtime: mark some C globals as having no pointers.

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
parent 14d2ee1d
...@@ -465,6 +465,7 @@ runtime·algarray[] = ...@@ -465,6 +465,7 @@ runtime·algarray[] =
// Runtime helpers. // Runtime helpers.
// used in asm_{386,amd64}.s // used in asm_{386,amd64}.s
#pragma dataflag NOPTR
byte runtime·aeskeysched[HashRandomBytes]; byte runtime·aeskeysched[HashRandomBytes];
void void
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "typekind.h" #include "typekind.h"
#include "funcdata.h" #include "funcdata.h"
#include "zaexperiment.h" #include "zaexperiment.h"
#include "../../cmd/ld/textflag.h"
extern byte data[]; extern byte data[];
extern byte edata[]; extern byte edata[];
...@@ -67,6 +68,7 @@ static uintptr dumpfd; ...@@ -67,6 +68,7 @@ static uintptr dumpfd;
enum { enum {
BufSize = 4096, BufSize = 4096,
}; };
#pragma dataflag NOPTR
static byte buf[BufSize]; static byte buf[BufSize];
static uintptr nbuf; static uintptr nbuf;
......
...@@ -19,6 +19,7 @@ package runtime ...@@ -19,6 +19,7 @@ package runtime
// Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K. // Mark mheap as 'no pointers', it does not contain interesting pointers but occupies ~45K.
#pragma dataflag NOPTR #pragma dataflag NOPTR
MHeap runtime·mheap; MHeap runtime·mheap;
#pragma dataflag NOPTR
MStats mstats; MStats mstats;
int32 runtime·checking; int32 runtime·checking;
......
...@@ -28,8 +28,11 @@ ...@@ -28,8 +28,11 @@
#include "runtime.h" #include "runtime.h"
#include "arch_GOARCH.h" #include "arch_GOARCH.h"
#include "malloc.h" #include "malloc.h"
#include "../../cmd/ld/textflag.h"
#pragma dataflag NOPTR
int32 runtime·class_to_size[NumSizeClasses]; int32 runtime·class_to_size[NumSizeClasses];
#pragma dataflag NOPTR
int32 runtime·class_to_allocnpages[NumSizeClasses]; int32 runtime·class_to_allocnpages[NumSizeClasses];
// The SizeToClass lookup is implemented using two arrays, // The SizeToClass lookup is implemented using two arrays,
...@@ -41,7 +44,9 @@ int32 runtime·class_to_allocnpages[NumSizeClasses]; ...@@ -41,7 +44,9 @@ int32 runtime·class_to_allocnpages[NumSizeClasses];
// size divided by 128 (rounded up). The arrays are filled in // size divided by 128 (rounded up). The arrays are filled in
// by InitSizes. // by InitSizes.
#pragma dataflag NOPTR
int8 runtime·size_to_class8[1024/8 + 1]; int8 runtime·size_to_class8[1024/8 + 1];
#pragma dataflag NOPTR
int8 runtime·size_to_class128[(MaxSmallSize-1024)/128 + 1]; int8 runtime·size_to_class128[(MaxSmallSize-1024)/128 + 1];
void runtime·testdefersizes(void); void runtime·testdefersizes(void);
......
...@@ -59,6 +59,7 @@ runtime·osinit(void) ...@@ -59,6 +59,7 @@ runtime·osinit(void)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -122,6 +122,7 @@ runtime·osinit(void) ...@@ -122,6 +122,7 @@ runtime·osinit(void)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -130,6 +130,7 @@ runtime·osinit(void) ...@@ -130,6 +130,7 @@ runtime·osinit(void)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -188,6 +188,7 @@ runtime·osinit(void) ...@@ -188,6 +188,7 @@ runtime·osinit(void)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -167,6 +167,7 @@ runtime·osinit(void) ...@@ -167,6 +167,7 @@ runtime·osinit(void)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -161,6 +161,7 @@ runtime·newosproc(M *mp, void *stk) ...@@ -161,6 +161,7 @@ runtime·newosproc(M *mp, void *stk)
void void
runtime·get_random_data(byte **rnd, int32 *rnd_len) runtime·get_random_data(byte **rnd, int32 *rnd_len)
{ {
#pragma dataflag NOPTR
static byte urandom_data[HashRandomBytes]; static byte urandom_data[HashRandomBytes];
int32 fd; int32 fd;
fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0); fd = runtime·open("/dev/urandom", 0 /* O_RDONLY */, 0);
......
...@@ -2597,6 +2597,7 @@ struct Pdesc ...@@ -2597,6 +2597,7 @@ struct Pdesc
uint32 syscalltick; uint32 syscalltick;
int64 syscallwhen; int64 syscallwhen;
}; };
#pragma dataflag NOPTR
static Pdesc pdesc[MaxGomaxprocs]; static Pdesc pdesc[MaxGomaxprocs];
static uint32 static uint32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment