206
206
p->from.offset += nstring - NSNAME;
208
208
p->to.type = D_SCONST;
209
memmove(p->to.sval, string, NSNAME);
209
memmove(p->to.u.sval, string, NSNAME);
351
351
p->to.type = D_CONST;
354
void zname(Biobuf*, Sym*, int);
355
char* zaddr(char*, Adr*, int);
356
void zwrite(Biobuf*, Prog*, int, int);
357
void outhist(Biobuf*);
360
zwrite(Biobuf *b, Prog *p, int sf, int st)
368
bf[4] = p->lineno>>8;
369
bf[5] = p->lineno>>16;
370
bf[6] = p->lineno>>24;
371
bp = zaddr(bf+7, &p->from, sf);
372
bp = zaddr(bp, &p->to, st);
373
Bwrite(b, bf, bp-bf);
379
struct { Sym *sym; short type; } h[NSYM];
385
for(p = firstp; p != P; p = p->link)
386
if(p->as != ADATA && p->as != AGLOBL)
388
for(p = firstp; p != P; p = p->link) {
390
if(p->as != ADATA && p->as != AGLOBL)
395
Bprint(&outbuf, "go object %s %s %s\n", getgoos(), thestring, getgoversion());
357
Bprint(&outbuf, "go object %s %s %s\n", getgoos(), getgoarch(), getgoversion());
396
358
if(pragcgobuf.to > pragcgobuf.start) {
397
359
Bprint(&outbuf, "\n");
398
360
Bprint(&outbuf, "$$ // exports\n\n");
404
366
Bprint(&outbuf, "!\n");
407
for(sym=0; sym<NSYM; sym++) {
412
for(p = firstp; p != P; p = p->link) {
418
if(sf < 0 || sf >= NSYM)
425
zname(&outbuf, s, t);
438
if(st < 0 || st >= NSYM)
445
zname(&outbuf, s, t);
456
zwrite(&outbuf, p, sf, st);
368
writeobj(ctxt, &outbuf);
470
static int first = 1;
471
static char *goroot, *goroot_final;
474
// Decide whether we need to rewrite paths from $GOROOT to $GOROOT_FINAL.
476
goroot = getenv("GOROOT");
477
goroot_final = getenv("GOROOT_FINAL");
480
if(goroot_final == nil)
481
goroot_final = goroot;
482
if(strcmp(goroot, goroot_final) == 0) {
492
for(h = hist; h != H; h = h->link) {
494
if(p != nil && goroot != nil) {
496
if(strncmp(p, goroot, strlen(goroot)) == 0 && p[n] == '/') {
497
tofree = smprint("%s%s", goroot_final, p+n);
502
if(systemtype(Windows) && p && p[1] == ':'){
504
} else if(p && p[0] != c && h->offset == 0 && pathname){
505
if(systemtype(Windows) && pathname[1] == ':') {
509
} else if(pathname[0] == c){
519
n = 1; /* leading "/" */
520
*p = '/'; /* don't emit "\" on windows */
542
pg.to.type = zprog.to.type;
543
pg.to.offset = h->offset;
545
pg.to.type = D_CONST;
547
zwrite(b, &pg, 0, 0);
557
zname(Biobuf *b, Sym *s, int t)
563
if(debug['T'] && t == D_EXTERN && s->sig != SIGDONE && s->type != types[TENUM] && s != symrathole){
577
bf[1] = t; /* type */
578
bf[2] = s->sym; /* sym */
581
Bwrite(b, n, strlen(n)+1);
585
zaddr(char *bp, Adr *a, int s)
598
diag(Z, "unknown type %d in zaddr", a->type);
612
bp += 4; // fall through
626
memmove(bp, a->sval, NSNAME);
631
ieeedtod(&e, a->dval);
650
373
align(int32 i, Type *t, int op, int32 *maxalign)