Commit 7ce1a4bd authored by Wei Guangjing's avatar Wei Guangjing Committed by Russ Cox

ld: fixes .bss for ldpe

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4794056
parent 2d972ad4
...@@ -222,6 +222,8 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -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) ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment