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:
parent
2d972ad493
commit
7ce1a4bdc0
@ -222,6 +222,8 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
s->type = SRODATA;
|
s->type = SRODATA;
|
||||||
break;
|
break;
|
||||||
case IMAGE_SCN_CNT_UNINITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.bss
|
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
|
case IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE: //.data
|
||||||
s->type = SDATA;
|
s->type = SDATA;
|
||||||
break;
|
break;
|
||||||
@ -382,6 +384,8 @@ map(PeObj *obj, PeSect *sect)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sect->base = mal(sect->sh.SizeOfRawData);
|
sect->base = mal(sect->sh.SizeOfRawData);
|
||||||
|
if(sect->sh.PointerToRawData == 0) // .bss don't has data in object file.
|
||||||
|
return 0;
|
||||||
werrstr("short read");
|
werrstr("short read");
|
||||||
if(Bseek(obj->f, obj->base+sect->sh.PointerToRawData, 0) < 0 ||
|
if(Bseek(obj->f, obj->base+sect->sh.PointerToRawData, 0) < 0 ||
|
||||||
Bread(obj->f, sect->base, sect->sh.SizeOfRawData) != sect->sh.SizeOfRawData)
|
Bread(obj->f, sect->base, sect->sh.SizeOfRawData) != sect->sh.SizeOfRawData)
|
||||||
|
Loading…
Reference in New Issue
Block a user