mirror of
https://github.com/golang/go
synced 2024-11-22 02:44:39 -07:00
Pad Go symbol table out to page boundary when linking dynamically.
This avoids a crash when using cgo where glibc's malloc thinks that it can use some of the memory following the symbol table. This fails because the symbol table is mapped read-only, which affects the whole page. R=rsc CC=golang-dev https://golang.org/cl/1616042
This commit is contained in:
parent
c1e20720f7
commit
fe43325b30
@ -532,6 +532,8 @@ asmb(void)
|
|||||||
asmthumbmap();
|
asmthumbmap();
|
||||||
if(dlm)
|
if(dlm)
|
||||||
asmdyn();
|
asmdyn();
|
||||||
|
if(!debug['s'])
|
||||||
|
strnput("", INITRND-(8+symsize+lcsize)%INITRND);
|
||||||
cflush();
|
cflush();
|
||||||
seek(cout, symo, 0);
|
seek(cout, symo, 0);
|
||||||
lputl(symsize);
|
lputl(symsize);
|
||||||
@ -679,8 +681,8 @@ asmb(void)
|
|||||||
ph->off = symo;
|
ph->off = symo;
|
||||||
ph->vaddr = symdatva;
|
ph->vaddr = symdatva;
|
||||||
ph->paddr = symdatva;
|
ph->paddr = symdatva;
|
||||||
ph->filesz = 8+symsize+lcsize;
|
ph->filesz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->memsz = 8+symsize+lcsize;
|
ph->memsz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->align = INITRND;
|
ph->align = INITRND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,6 +620,8 @@ asmb(void)
|
|||||||
asmlc();
|
asmlc();
|
||||||
if(dlm)
|
if(dlm)
|
||||||
asmdyn();
|
asmdyn();
|
||||||
|
if(!debug['s'])
|
||||||
|
strnput("", INITRND-(8+symsize+lcsize)%INITRND);
|
||||||
cflush();
|
cflush();
|
||||||
seek(cout, symo, 0);
|
seek(cout, symo, 0);
|
||||||
lputl(symsize);
|
lputl(symsize);
|
||||||
@ -753,8 +755,8 @@ asmb(void)
|
|||||||
ph->off = symo;
|
ph->off = symo;
|
||||||
ph->vaddr = symdatva;
|
ph->vaddr = symdatva;
|
||||||
ph->paddr = symdatva;
|
ph->paddr = symdatva;
|
||||||
ph->filesz = 8+symsize+lcsize;
|
ph->filesz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->memsz = 8+symsize+lcsize;
|
ph->memsz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->align = INITRND;
|
ph->align = INITRND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ asmb(void)
|
|||||||
asmlc();
|
asmlc();
|
||||||
if(dlm)
|
if(dlm)
|
||||||
asmdyn();
|
asmdyn();
|
||||||
if(HEADTYPE == 10)
|
if(HEADTYPE == 10 || (iself && !debug['s']))
|
||||||
strnput("", INITRND-(8+symsize+lcsize)%INITRND);
|
strnput("", INITRND-(8+symsize+lcsize)%INITRND);
|
||||||
cflush();
|
cflush();
|
||||||
seek(cout, symo, 0);
|
seek(cout, symo, 0);
|
||||||
@ -884,8 +884,8 @@ asmb(void)
|
|||||||
ph->off = symo;
|
ph->off = symo;
|
||||||
ph->vaddr = symdatva;
|
ph->vaddr = symdatva;
|
||||||
ph->paddr = symdatva;
|
ph->paddr = symdatva;
|
||||||
ph->filesz = 8+symsize+lcsize;
|
ph->filesz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->memsz = 8+symsize+lcsize;
|
ph->memsz = rnd(8+symsize+lcsize, INITRND);
|
||||||
ph->align = INITRND;
|
ph->align = INITRND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user