From a26c01ad446d2853f0c6a7ddaacadb02efa00b7b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 3 Apr 2014 19:04:15 -0400 Subject: [PATCH] cmd/cc: emit gc bitmaps in read-only memory Cuts hello world by 70kB, because we don't write those names into the symbol table. Update #6853 LGTM=khr R=khr CC=golang-codereviews https://golang.org/cl/80370045 --- src/cmd/cc/pgen.c | 1 + src/cmd/ld/symtab.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/cc/pgen.c b/src/cmd/cc/pgen.c index d3fc4193e017e..10bebc196d193 100644 --- a/src/cmd/cc/pgen.c +++ b/src/cmd/cc/pgen.c @@ -51,6 +51,7 @@ makefuncdatasym(char *namefmt, int64 funcdatakind) nod.sym = sym; nod.class = CSTATIC; gins(AFUNCDATA, nodconst(funcdatakind), &nod); + linksym(sym)->type = SRODATA; return sym; } diff --git a/src/cmd/ld/symtab.c b/src/cmd/ld/symtab.c index 1d55119935f90..6d321c0bb94ed 100644 --- a/src/cmd/ld/symtab.c +++ b/src/cmd/ld/symtab.c @@ -425,7 +425,7 @@ symtab(void) s->hide = 1; s->outer = symgofunc; } - if(strstr(s->name, ".gcargs·") != nil || strstr(s->name, ".gclocals·") != nil || strncmp(s->name, "gcargs·", 8) == 0 || strncmp(s->name, "gclocals·", 10) == 0) { + if(strncmp(s->name, "gcargs.", 7) == 0 || strncmp(s->name, "gclocals.", 9) == 0 || strncmp(s->name, "gclocals·", 10) == 0) { s->type = SGOFUNC; s->hide = 1; s->outer = symgofunc;