From 9ca4a25f4ba0dcdb17c41374f146668e97183176 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 15 Apr 2013 10:35:37 -0700 Subject: [PATCH] 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 --- src/cmd/ld/ldpe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cmd/ld/ldpe.c b/src/cmd/ld/ldpe.c index 52134405fb..c1195a857d 100644 --- a/src/cmd/ld/ldpe.c +++ b/src/cmd/ld/ldpe.c @@ -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; -- 2.48.1