]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: ignore PE sections that are not code or data
authorIan Lance Taylor <iant@golang.org>
Mon, 15 Apr 2013 17:35:37 +0000 (10:35 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 15 Apr 2013 17:35:37 +0000 (10:35 -0700)
Update #5106
Update #5273

R=minux.ma, r
CC=golang-dev
https://golang.org/cl/8715043

src/cmd/ld/ldpe.c

index 52134405fb649d22d8591c7f2a8aea1943da3b75..c1195a857d24216416025e806342ff3656dfd2e4 100644 (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;