diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 848087d7436..5209878b78c 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -1313,7 +1313,7 @@ func (ctxt *Link) dodata() { case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePlugin: hasinitarr = true } - if hasinitarr { + if hasinitarr && len(data[sym.SINITARR]) > 0 { sect := addsection(ctxt.Arch, &Segdata, ".init_array", 06) sect.Align = dataMaxAlign[sym.SINITARR] datsize = Rnd(datsize, int64(sect.Align))