}
void
-ggloblsym(Sym *s, int32 width, int dupok, int rodata)
+ggloblsym(Sym *s, int32 width, int8 flags)
{
Prog *p;
p->to.type = D_CONST;
p->to.name = D_NONE;
p->to.offset = width;
- if(dupok)
- p->reg |= DUPOK;
- if(rodata)
- p->reg |= RODATA;
+ p->reg = flags;
}
void
}
void
-ggloblsym(Sym *s, int32 width, int dupok, int rodata)
+ggloblsym(Sym *s, int32 width, int8 flags)
{
Prog *p;
p->to.type = D_CONST;
p->to.index = D_NONE;
p->to.offset = width;
- if(dupok)
- p->from.scale |= DUPOK;
- if(rodata)
- p->from.scale |= RODATA;
+ p->from.scale = flags;
}
int
}
void
-ggloblsym(Sym *s, int32 width, int dupok, int rodata)
+ggloblsym(Sym *s, int32 width, int8 flags)
{
Prog *p;
p->to.type = D_CONST;
p->to.index = D_NONE;
p->to.offset = width;
- if(dupok)
- p->from.scale |= DUPOK;
- if(rodata)
- p->from.scale |= RODATA;
+ p->from.scale = flags;
}
void
void gdatacomplex(Node*, Mpcplx*);
void gdatastring(Node*, Strlit*);
void ggloblnod(Node *nam);
-void ggloblsym(Sym *s, int32 width, int dupok, int rodata);
+void ggloblsym(Sym *s, int32 width, int8 flags);
void gvardef(Node*);
void gvarkill(Node*);
Prog* gjmp(Prog*);
#include <u.h>
#include <libc.h>
#include "go.h"
+#include "../ld/textflag.h"
/*
* architecture-independent object file output
externdcl = tmp;
zero = pkglookup("zerovalue", runtimepkg);
- ggloblsym(zero, zerosize, 1, 1);
+ ggloblsym(zero, zerosize, DUPOK|RODATA);
dumpdata();
writeobj(ctxt, bout);
for(l=funcsyms; l; l=l->next) {
n = l->n;
dsymptr(n->sym, 0, n->sym->def->shortname->sym, 0);
- ggloblsym(n->sym, widthptr, 1, 1);
+ ggloblsym(n->sym, widthptr, DUPOK|RODATA);
}
// Do not reprocess funcsyms on next dumpglobls call.
}
off = duint8(sym, off, 0); // terminating NUL for runtime
off = (off+widthptr-1)&~(widthptr-1); // round to pointer alignment
- ggloblsym(sym, off, 1, 1);
+ ggloblsym(sym, off, DUPOK|RODATA);
return sym;
}
m = len-n;
off = dsname(sym, off, s+n, m);
}
- ggloblsym(sym, off, 0, 0);
+ ggloblsym(sym, off, NOPTR);
if(nam->op != ONAME)
fatal("slicebytes %N", nam);
#include <libc.h>
#include "gg.h"
#include "opt.h"
+#include "../ld/textflag.h"
#include "../../pkg/runtime/funcdata.h"
enum { BitsPerPointer = 2 };
}
}
duint32(sym, 0, i); // number of bitmaps
- ggloblsym(sym, off, 0, 1);
+ ggloblsym(sym, off, RODATA);
}
static void
#include <u.h>
#include <libc.h>
#include "go.h"
+#include "../ld/textflag.h"
#include "../../pkg/runtime/mgc0.h"
/*
p->pathsym = n->sym;
gdatastring(n, p->path);
- ggloblsym(n->sym, types[TSTRING]->width, 1, 1);
+ ggloblsym(n->sym, types[TSTRING]->width, DUPOK|RODATA);
}
static int
tbase = t;
if(isptr[t->etype] && t->sym == S && t->type->sym != S)
tbase = t->type;
- dupok = tbase->sym == S;
+ dupok = 0;
+ if(tbase->sym == S)
+ dupok = DUPOK;
if(compiling_runtime &&
(tbase == types[tbase->etype] ||
break;
}
ot = dextratype(s, ot, t, xt);
- ggloblsym(s, ot, dupok, 1);
+ ggloblsym(s, ot, dupok|RODATA);
// generate typelink.foo pointing at s = type.foo.
// The linker will leave a table of all the typelinks for
case TMAP:
slink = typelinksym(t);
dsymptr(slink, 0, s, 0);
- ggloblsym(slink, widthptr, dupok, 1);
+ ggloblsym(slink, widthptr, dupok|RODATA);
}
}
break;
}
- ggloblsym(s, ot, 1, 1);
+ ggloblsym(s, ot, DUPOK|RODATA);
return s;
}
ot = duintptr(s, ot, t->width);
ot = dgcsym1(s, ot, t, &off, 0);
ot = duintptr(s, ot, GC_END);
- ggloblsym(s, ot, 1, 1);
+ ggloblsym(s, ot, DUPOK|RODATA);
if(t->align > 0)
off = rnd(off, t->align);
#include <u.h>
#include <libc.h>
#include "go.h"
+#include "../ld/textflag.h"
static Node* walkprint(Node*, NodeList**, int);
static Node* mapfn(char*, Type*);
l->class = PEXTERN;
l->xoffset = 0;
sym->def = l;
- ggloblsym(sym, widthptr, 1, 0);
+ ggloblsym(sym, widthptr, DUPOK|NOPTR);
}
l = nod(OADDR, sym->def, N);
l->addable = 1;