]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/vl/obj.c
cc, ?a, ?l: change thunk type to uintptr
[plan9front.git] / sys / src / cmd / vl / obj.c
index 8289c5884a8aca6c786d125b8be1bd558cd9f6ee..c20e5c98be1f4bd88b3ecce73bb714162e086ad5 100644 (file)
@@ -14,7 +14,7 @@ char  *thestring      = "mips";
 /*
  *     -H0 -T0x40004C -D0x10000000     is abbrev unix
  *     -H1 -T0x80020000 -R4            is bootp() format for 3k
- *     -H2 -T4128 -R4096               is plan9 format
+ *     -H2 -T0x4020 -R0x4000           is plan9 format
  *     -H3 -T0x80020000 -R8            is bootp() format for 4k
  *     -H4 -T0x400000 -R4              is sgi unix coff executable
  *     -H5 -T0x4000A0 -R4              is sgi unix elf executable
@@ -124,12 +124,12 @@ main(int argc, char *argv[])
                break;
        case 2: /* plan 9 */
                HEADR = 32L;
-               if(INITTEXT == -1)
-                       INITTEXT = 4128;
                if(INITDAT == -1)
                        INITDAT = 0;
                if(INITRND == -1)
-                       INITRND = 4096;
+                       INITRND = 16*1024;
+               if(INITTEXT == -1)
+                       INITTEXT = INITRND+HEADR;
                break;
        case 3: /* boot for 4k */
                HEADR = 20L+56L+3*40L;
@@ -240,7 +240,7 @@ main(int argc, char *argv[])
 out:
        if(debug['v']) {
                Bprint(&bso, "%5.2f cpu time\n", cputime());
-               Bprint(&bso, "%ld memory used\n", thunk);
+               Bprint(&bso, "%zud memory used\n", thunk);
                Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
                Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
        }
@@ -294,11 +294,9 @@ objfile(char *file)
 
        if(file[0] == '-' && file[1] == 'l') {
                if(debug['9'])
-                       sprint(name, "/%s/lib/lib", thestring);
+                       snprint(name, sizeof name, "/%s/lib/lib%s.a", thestring, file+2);
                else
-                       sprint(name, "/usr/%clib/lib", thechar);
-               strcat(name, file+2);
-               strcat(name, ".a");
+                       snprint(name, sizeof name, "/usr/%clib/lib%s.a", thechar, file+2);
                file = name;
        }
        if(debug['v'])
@@ -358,7 +356,7 @@ objfile(char *file)
                        s = lookup(e+5, 0);
                        if(s->type != SXREF)
                                continue;
-                       sprint(pname, "%s(%s)", file, s->name);
+                       snprint(pname, sizeof pname, "%s(%s)", file, s->name);
                        if(debug['v'])
                                Bprint(&bso, "%5.2f library: %s\n", cputime(), pname);
                        Bflush(&bso);
@@ -505,17 +503,17 @@ addlib(char *obj)
                return;
 
        if(histfrog[0]->name[1] == '/') {
-               sprint(name, "");
+               name[0] = 0;
                i = 1;
        } else
        if(histfrog[0]->name[1] == '.') {
-               sprint(name, ".");
+               snprint(name, sizeof name, ".");
                i = 0;
        } else {
                if(debug['9'])
-                       sprint(name, "/%s/lib", thestring);
+                       snprint(name, sizeof name, "/%s/lib", thestring);
                else
-                       sprint(name, "/usr/%clib", thechar);
+                       snprint(name, sizeof name, "/usr/%clib", thechar);
                i = 0;
        }
 
@@ -805,6 +803,8 @@ loop:
                        diag("GLOBL must have a name\n%P", p);
                        errorexit();
                }
+               if (p->reg & DUPOK)
+                       s->dupok = 1;
                if(s->type == 0 || s->type == SXREF) {
                        s->type = SBSS;
                        s->value = 0;
@@ -933,7 +933,7 @@ loop:
 
                if(p->from.type == D_FCONST) {
                        /* size sb 9 max */
-                       sprint(literal, "$%lux", ieeedtof(p->from.ieee));
+                       snprint(literal, sizeof literal, "$%lux", ieeedtof(p->from.ieee));
                        s = lookup(literal, 0);
                        if(s->type == 0) {
                                s->type = SBSS;
@@ -962,7 +962,7 @@ loop:
 
                if(p->from.type == D_FCONST) {
                        /* size sb 18 max */
-                       sprint(literal, "$%lux.%lux",
+                       snprint(literal, sizeof literal, "$%lux.%lux",
                                p->from.ieee->l, p->from.ieee->h);
                        s = lookup(literal, 0);
                        if(s->type == 0) {
@@ -1038,6 +1038,7 @@ lookup(char *symb, int v)
        s->type = 0;
        s->version = v;
        s->value = 0;
+       s->dupok = 0;
        hash[h] = s;
        return s;
 }