diff options
| author | David Boddie <david@boddie.org.uk> | 2023-04-02 18:24:44 +0200 |
|---|---|---|
| committer | David Boddie <david@boddie.org.uk> | 2023-11-16 16:44:28 +0100 |
| commit | 691df57aba2063cba34cc3bcf0cea90a54e83e76 (patch) | |
| tree | 7035b23f6c1d2fb1ef0c7e95dd9d180fe251ae8e | |
| parent | d8023f9f90be42752d6f61a1a436444f0cfad288 (diff) | |
Enabled assembly of constant strings into the text segment.
| -rw-r--r-- | utils/tl/asm.c | 22 | ||||
| -rw-r--r-- | utils/tl/l.h | 2 | ||||
| -rw-r--r-- | utils/tl/span.c | 2 | ||||
| -rw-r--r-- | utils/tl/thumb.c | 6 |
4 files changed, 23 insertions, 9 deletions
diff --git a/utils/tl/asm.c b/utils/tl/asm.c index 66a7f0c6..ec0f63a8 100644 --- a/utils/tl/asm.c +++ b/utils/tl/asm.c @@ -63,17 +63,15 @@ asmb(void) asmout(p, o); pc += o->size; } - while(pc-INITTEXT < textsize) { - cput(0); - pc++; + + /* output strings in text segment */ + while (pc < INITRODAT) { + cput(0); pc++; } - if(debug['a']) - Bprint(&bso, "\n"); Bflush(&bso); cflush(); - /* output strings in text segment */ etext = INITTEXT + textsize; for(t = pc; t < etext; t += sizeof(buf)-100) { if(etext-t > sizeof(buf)-100) @@ -82,6 +80,18 @@ asmb(void) datblk(t, etext-t, 1); } + pc = t; + + while(pc-INITTEXT < textsize) { + cput(0); + pc++; + } + + if(debug['a']) + Bprint(&bso, "\n"); + Bflush(&bso); + cflush(); + curtext = P; switch(HEADTYPE) { case 0: diff --git a/utils/tl/l.h b/utils/tl/l.h index f2e6ad02..3e84ff66 100644 --- a/utils/tl/l.h +++ b/utils/tl/l.h @@ -90,6 +90,7 @@ struct Sym uchar fnptr; // used as fn ptr Use* use; Sym* link; + long base; }; #define SIGNINTERN (1729*325*1729) @@ -248,6 +249,7 @@ EXTERN union EXTERN long HEADR; /* length of header */ EXTERN int HEADTYPE; /* type of header */ EXTERN long INITDAT; /* data location */ +EXTERN long INITRODAT; /* read-only data location */ EXTERN long INITRND; /* data round above text location */ EXTERN long INITTEXT; /* text location */ EXTERN char* INITENTRY; /* entry point */ diff --git a/utils/tl/span.c b/utils/tl/span.c index 8ceaf631..6d5a0443 100644 --- a/utils/tl/span.c +++ b/utils/tl/span.c @@ -350,6 +350,7 @@ span(void) * add strings to text segment */ c = rnd(c, 8); + INITRODAT = c; for(i=0; i<NHASH; i++) for(s = hash[i]; s != S; s = s->link) { if(s->type != SSTRING) @@ -358,6 +359,7 @@ span(void) while(v & 3) v++; s->value = c; + s->base = -INITDAT; // compensate for assumptions in thumb.c c += v; } } diff --git a/utils/tl/thumb.c b/utils/tl/thumb.c index ff089918..d3324ebf 100644 --- a/utils/tl/thumb.c +++ b/utils/tl/thumb.c @@ -181,7 +181,7 @@ thumbaclass(Adr *a, Prog *p) a->sym->name, TNAME); a->sym->type = SDATA; } - instoffset = a->sym->value + a->offset + INITDAT; + instoffset = a->sym->value + a->offset + INITDAT + a->sym->base; return C_LEXT; /* INITDAT unknown at this stage */ // return immacon(instoffset, p, C_SEXT, C_LEXT); case D_AUTO: @@ -213,7 +213,7 @@ thumbaclass(Adr *a, Prog *p) s->name, TNAME); s->type = SDATA; } - instoffset = s->value + a->offset + INITDAT; + instoffset = s->value + a->offset + INITDAT + s->base; if(s->type == STEXT || s->type == SLEAF){ instoffset = s->value + a->offset; #ifdef CALLEEBX @@ -262,7 +262,7 @@ thumbaclass(Adr *a, Prog *p) #endif return C_LCON; } - instoffset = s->value + a->offset + INITDAT; + instoffset = s->value + a->offset + INITDAT + s->base; return C_LCON; /* INITDAT unknown at this stage */ // return immcon(instoffset, p); case D_AUTO: |
