]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: do not relocate ignored PE sections
authorAlex Brainman <alex.brainman@gmail.com>
Sat, 20 Apr 2013 07:42:14 +0000 (17:42 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Sat, 20 Apr 2013 07:42:14 +0000 (17:42 +1000)
This should have been part of CL8715043.

Update #5106

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/8676050

src/cmd/ld/ldpe.c

index c1195a857d24216416025e806342ff3656dfd2e4..7a5bc0c6083ff4d6274e7636626b93a6193869e1 100644 (file)
@@ -257,6 +257,11 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
                        continue;
                if(rsect->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;
+               }
                r = mal(rsect->sh.NumberOfRelocations*sizeof r[0]);
                Bseek(f, obj->base+rsect->sh.PointerToRelocations, 0);
                for(j=0; j<rsect->sh.NumberOfRelocations; j++) {