mirror of
https://github.com/golang/go
synced 2024-11-25 06:47:56 -07:00
6l, 8l: make etext accurate; introduce rodata, erodata.
Makes binaries work with 6cov again. R=ken2 CC=golang-dev https://golang.org/cl/2192041
This commit is contained in:
parent
caf3b4a749
commit
b7e9e9188a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user