diff --git a/src/cmd/ld/ldpe.c b/src/cmd/ld/ldpe.c index 3423b71a18e..049edeb23f6 100644 --- a/src/cmd/ld/ldpe.c +++ b/src/cmd/ld/ldpe.c @@ -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)