1
0
mirror of https://github.com/golang/go synced 2024-09-23 19:20:13 -06:00

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
This commit is contained in:
Ian Lance Taylor 2013-04-15 10:35:37 -07:00
parent 804ef381db
commit 9ca4a25f4b

View File

@ -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;