Commit b7e9e918 authored by Russ Cox's avatar Russ Cox

6l, 8l: make etext accurate; introduce rodata, erodata.

Makes binaries work with 6cov again.

R=ken2
CC=golang-dev
https://golang.org/cl/2192041
parent caf3b4a7
......@@ -45,6 +45,9 @@ span(void)
Sym *s;
xdefine("etext", STEXT, 0L);
xdefine("rodata", SRODATA, 0L);
xdefine("erodata", SRODATA, 0L);
idat = INITDAT;
for(p = firstp; p != P; p = p->link) {
if(p->as == ATEXT)
......@@ -122,11 +125,13 @@ loop:
textsize = c;
goto loop;
}
xdefine("etext", STEXT, c);
/*
* allocate read-only data to the text segment.
*/
c = rnd(c, 8);
xdefine("rodata", SRODATA, c);
for(i=0; i<NHASH; i++)
for(s = hash[i]; s != S; s = s->link) {
if(s->type != SRODATA)
......@@ -137,6 +142,7 @@ loop:
s->value = c;
c += v;
}
xdefine("erodata", SRODATA, c);
if(INITRND) {
INITDAT = rnd(c, INITRND);
......@@ -146,7 +152,6 @@ loop:
}
}
xdefine("etext", STEXT, c);
if(debug['v'])
Bprint(&bso, "etext = %llux\n", c);
Bflush(&bso);
......
......@@ -40,6 +40,9 @@ span(void)
Sym *s;
xdefine("etext", STEXT, 0L);
xdefine("rodata", SRODATA, 0L);
xdefine("erodata", SRODATA, 0L);
idat = INITDAT;
for(p = firstp; p != P; p = p->link) {
if(p->as == ATEXT)
......@@ -107,11 +110,13 @@ start:
textsize = c;
n++;
}while(again);
xdefine("etext", STEXT, c);
/*
* allocate read-only data to the text segment.
*/
c = rnd(c, 8);
xdefine("rodata", SRODATA, c);
for(i=0; i<NHASH; i++)
for(s = hash[i]; s != S; s = s->link) {
if(s->type != SRODATA)
......@@ -122,6 +127,7 @@ start:
s->value = c;
c += v;
}
xdefine("erodata", SRODATA, c);
if(INITRND) {
INITDAT = rnd(c+textpad, INITRND);
......@@ -131,7 +137,6 @@ start:
}
}
xdefine("etext", STEXT, c);
if(debug['v'])
Bprint(&bso, "etext = %lux\n", c);
Bflush(&bso);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment