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[] =
// Runtime helpers.
// used in asm_{386,amd64}.s
#pragma dataflag NOPTR
byte runtime·aeskeysched[HashRandomBytes];
void
......
......@@ -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;
......
......@@ -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;
......
......@@ -28,8 +28,11 @@
#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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -2597,6 +2597,7 @@ struct Pdesc
uint32 syscalltick;
int64 syscallwhen;
};
#pragma dataflag NOPTR
static Pdesc pdesc[MaxGomaxprocs];
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