aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2013-08-29 12:36:59 -0700
committerKeith Randall <khr@golang.org>2013-08-29 12:36:59 -0700
commited467db6d8db16dcc2956d85f0ce114635e12f06 (patch)
tree2cae5751925bdc6138cebd7a8c6c4d2380330420 /src/cmd
parentf5f0e40e803125e47c64372fc7d808cbd8b9577a (diff)
downloadgo-ed467db6d8db16dcc2956d85f0ce114635e12f06.tar.xz
cmd/cc,runtime: change preprocessor to expand macros inside of
#pragma textflag and #pragma dataflag directives. Update dataflag directives to use symbols instead of integer constants. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/13310043
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/cc/dpchk.c28
-rw-r--r--src/cmd/ld/textflag.h10
2 files changed, 31 insertions, 7 deletions
diff --git a/src/cmd/cc/dpchk.c b/src/cmd/cc/dpchk.c
index 34163ff926..606bf40dd9 100644
--- a/src/cmd/cc/dpchk.c
+++ b/src/cmd/cc/dpchk.c
@@ -567,7 +567,19 @@ pragfpround(void)
void
pragtextflag(void)
{
- textflag = getnsn();
+ Sym *s;
+
+ s = getsym();
+ if(s == S) {
+ textflag = getnsn();
+ } else {
+ if(s->macro) {
+ macexpand(s, symb);
+ }
+ if(symb[0] < '0' || symb[0] > '9')
+ yyerror("pragma textflag not an integer");
+ textflag = atoi(symb);
+ }
while(getnsc() != '\n')
;
if(debug['f'])
@@ -577,7 +589,19 @@ pragtextflag(void)
void
pragdataflag(void)
{
- dataflag = getnsn();
+ Sym *s;
+
+ s = getsym();
+ if(s == S) {
+ dataflag = getnsn();
+ } else {
+ if(s->macro) {
+ macexpand(s, symb);
+ }
+ if(symb[0] < '0' || symb[0] > '9')
+ yyerror("pragma dataflag not an integer");
+ dataflag = atoi(symb);
+ }
while(getnsc() != '\n')
;
if(debug['f'])
diff --git a/src/cmd/ld/textflag.h b/src/cmd/ld/textflag.h
index 7b16865be4..64ae647fb6 100644
--- a/src/cmd/ld/textflag.h
+++ b/src/cmd/ld/textflag.h
@@ -7,13 +7,13 @@
// all agree on these values.
// Don't profile the marked routine. This flag is deprecated.
-#define NOPROF (1<<0)
+#define NOPROF 1
// It is ok for the linker to get multiple of these symbols. It will
// pick one of the duplicates to use.
-#define DUPOK (1<<1)
+#define DUPOK 2
// Don't insert stack check preamble.
-#define NOSPLIT (1<<2)
+#define NOSPLIT 4
// Put this data in a read-only section.
-#define RODATA (1<<3)
+#define RODATA 8
// This data contains no pointers.
-#define NOPTR (1<<4)
+#define NOPTR 16