1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:24:41 -07:00

fix ELF bugs found by iant

- .text begins at INITTEXT, not 0
	   and does not include HEADR
	- .shstrtab, .gosymtab, .gopclntab have alignment 1
	- .gosymtab, .gopclntab have type SHT_PROGBITS

R=r
DELTA=9  (0 added, 0 deleted, 9 changed)
OCL=15953
CL=15956
This commit is contained in:
Russ Cox 2008-09-26 10:25:13 -07:00
parent a0e7937243
commit 2c52881a85

View File

@ -452,7 +452,7 @@ asmb(void)
INITRND); /* alignment */
linuxphdr(0x6474e551, /* gok - type = gok */
1L+2L+4L, /* gok - flags = PF_X+PF_R */
1L+2L+4L, /* gok - flags = PF_X+PF_W+PF_R */
0, /* file offset */
0, /* vaddr */
0, /* paddr */
@ -472,9 +472,9 @@ asmb(void)
0); /* entsize */
stroffset = 1; /* 0 means no name, so start at 1 */
fo = 0;
va = INITRND;
w = HEADR+textsize;
fo = HEADR;
va = (INITTEXT & ~((vlong)INITRND - 1)) + HEADR;
w = textsize;
linuxshdr(".text", /* name */
1, /* type */
@ -527,7 +527,7 @@ asmb(void)
w, /* size */
0, /* link */
0, /* info */
8, /* align */
1, /* align */
0); /* entsize */
if (debug['s'])
@ -537,28 +537,28 @@ asmb(void)
w = symsize;
linuxshdr(".gosymtab", /* name */
7, /* type */
1, /* type 1 = SHT_PROGBITS */
0, /* flags */
0, /* addr */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
8, /* align */
1, /* align */
24); /* entsize */
fo += w;
w = lcsize;
linuxshdr(".gopclntab", /* name */
7, /* type */
1, /* type 1 = SHT_PROGBITS*/
0, /* flags */
0, /* addr */
fo, /* off */
w, /* size */
0, /* link */
0, /* info */
8, /* align */
1, /* align */
24); /* entsize */
break;
}