~ubuntu-branches/ubuntu/utopic/golang/utopic

« back to all changes in this revision

Viewing changes to src/cmd/5c/swt.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
393
393
        }
394
394
 
395
395
        Bprint(&outbuf, "go object %s %s %s\n", getgoos(), thestring, getgoversion());
396
 
        if(ndynimp > 0 || ndynexp > 0) {
397
 
                int i;
398
 
 
 
396
        if(pragcgobuf.to > pragcgobuf.start) {
399
397
                Bprint(&outbuf, "\n");
400
398
                Bprint(&outbuf, "$$  // exports\n\n");
401
399
                Bprint(&outbuf, "$$  // local types\n\n");
402
 
                Bprint(&outbuf, "$$  // dynimport\n");
403
 
                for(i=0; i<ndynimp; i++)
404
 
                        Bprint(&outbuf, "dynimport %s %s %s\n", dynimp[i].local, dynimp[i].remote, dynimp[i].path);
405
 
                Bprint(&outbuf, "\n$$  // dynexport\n");
406
 
                for(i=0; i<ndynexp; i++)
407
 
                        Bprint(&outbuf, "dynexport %s %s\n", dynexp[i].local, dynexp[i].remote);
 
400
                Bprint(&outbuf, "$$  // cgo\n");
 
401
                Bprint(&outbuf, "%s", fmtstrflush(&pragcgobuf));
408
402
                Bprint(&outbuf, "\n$$\n\n");
409
403
        }
410
404
        Bprint(&outbuf, "!\n");
472
466
        char *p, *q, *op, c;
473
467
        Prog pg;
474
468
        int n;
475
 
 
 
469
        char *tofree;
 
470
        static int first = 1;
 
471
        static char *goroot, *goroot_final;
 
472
 
 
473
        if(first) {
 
474
                // Decide whether we need to rewrite paths from $GOROOT to $GOROOT_FINAL.
 
475
                first = 0;
 
476
                goroot = getenv("GOROOT");
 
477
                goroot_final = getenv("GOROOT_FINAL");
 
478
                if(goroot == nil)
 
479
                        goroot = "";
 
480
                if(goroot_final == nil)
 
481
                        goroot_final = goroot;
 
482
                if(strcmp(goroot, goroot_final) == 0) {
 
483
                        goroot = nil;
 
484
                        goroot_final = nil;
 
485
                }
 
486
        }
 
487
 
 
488
        tofree = nil;
476
489
        pg = zprog;
477
490
        pg.as = AHISTORY;
478
491
        c = pathchar();
479
492
        for(h = hist; h != H; h = h->link) {
480
493
                p = h->name;
 
494
                if(p != nil && goroot != nil) {
 
495
                        n = strlen(goroot);
 
496
                        if(strncmp(p, goroot, strlen(goroot)) == 0 && p[n] == '/') {
 
497
                                tofree = smprint("%s%s", goroot_final, p+n);
 
498
                                p = tofree;
 
499
                        }
 
500
                }
481
501
                op = 0;
482
502
                if(systemtype(Windows) && p && p[1] == ':'){
483
503
                        c = p[2];
525
545
                        pg.to.type = D_CONST;
526
546
 
527
547
                zwrite(b, &pg, 0, 0);
 
548
 
 
549
                if(tofree) {
 
550
                        free(tofree);
 
551
                        tofree = nil;
 
552
                }
528
553
        }
529
554
}
530
555
 
566
591
        bp[1] = a->reg;
567
592
        bp[2] = s;
568
593
        bp[3] = a->name;
569
 
        bp += 4;
 
594
        bp[4] = 0;
 
595
        bp += 5;
570
596
        switch(a->type) {
571
597
        default:
572
598
                diag(Z, "unknown type %d in zaddr", a->type);