Commit 9ca4a25f authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/ld: ignore PE sections that are not code or data

Update #5106
Update #5273

R=minux.ma, r
CC=golang-dev
https://golang.org/cl/8715043
parent 804ef381
......@@ -211,6 +211,13 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
sect = &obj->sect[i];
if(sect->sh.Characteristics&IMAGE_SCN_MEM_DISCARDABLE)
continue;
if((sect->sh.Characteristics&(IMAGE_SCN_CNT_CODE|IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_CNT_UNINITIALIZED_DATA)) == 0) {
// This has been seen for .idata sections, which we
// want to ignore. See issues 5106 and 5273.
continue;
}
if(map(obj, sect) < 0)
goto bad;
......@@ -232,7 +239,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
s->type = STEXT;
break;
default:
werrstr("unexpected flags %#08x for PE section %s", sect->sh.Characteristics, sect->name);
werrstr("unexpected flags %#08ux for PE section %s", sect->sh.Characteristics, sect->name);
goto bad;
}
s->p = sect->base;
......
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