Skip to content

Commit 782a578

Browse files
committed
cmd/ld: do not relocate ignored PE sections
This should have been part of CL8715043. Update #5106 R=golang-dev, r, iant CC=golang-dev https://golang.org/cl/8676050
1 parent 41451dd commit 782a578

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cmd/ld/ldpe.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
257257
continue;
258258
if(rsect->sh.Characteristics&IMAGE_SCN_MEM_DISCARDABLE)
259259
continue;
260+
if((sect->sh.Characteristics&(IMAGE_SCN_CNT_CODE|IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_CNT_UNINITIALIZED_DATA)) == 0) {
261+
// This has been seen for .idata sections, which we
262+
// want to ignore. See issues 5106 and 5273.
263+
continue;
264+
}
260265
r = mal(rsect->sh.NumberOfRelocations*sizeof r[0]);
261266
Bseek(f, obj->base+rsect->sh.PointerToRelocations, 0);
262267
for(j=0; j<rsect->sh.NumberOfRelocations; j++) {

0 commit comments

Comments
 (0)