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

ld: fixes .bss for ldpe

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4794056
This commit is contained in:
Wei Guangjing 2011-07-23 12:21:13 -04:00 committed by Russ Cox
parent 2d972ad493
commit 7ce1a4bdc0

View File

@ -222,6 +222,8 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
s->type = SRODATA;
break;
case IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.bss
s->type = SBSS;
break;
case IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.data
s->type = SDATA;
break;
@ -382,6 +384,8 @@ map(PeObj *obj, PeSect *sect)
return 0;
sect->base = mal(sect->sh.SizeOfRawData);
if(sect->sh.PointerToRawData == 0) // .bss don't has data in object file.
return 0;
werrstr("short read");
if(Bseek(obj->f, obj->base+sect->sh.PointerToRawData, 0) < 0 ||
Bread(obj->f, sect->base, sect->sh.SizeOfRawData) != sect->sh.SizeOfRawData)