diff --git a/src/cmd/link/internal/amd64/asm.go b/src/cmd/link/internal/amd64/asm.go index 8454e47fa2..20ef5956a9 100644 --- a/src/cmd/link/internal/amd64/asm.go +++ b/src/cmd/link/internal/amd64/asm.go @@ -239,16 +239,11 @@ func adddynrel(ctxt *ld.Link, s *ld.Symbol, r *ld.Reloc) bool { // nothing to do, the relocation will be laid out in reloc return true } - if ld.Headtype == objabi.Hwindows { - // nothing to do, the relocation will be laid out in pereloc1 - return true - } else { - // for both ELF and Mach-O - addpltsym(ctxt, targ) - r.Sym = ctxt.Syms.Lookup(".plt", 0) - r.Add = int64(targ.Plt) - return true - } + // for both ELF and Mach-O + addpltsym(ctxt, targ) + r.Sym = ctxt.Syms.Lookup(".plt", 0) + r.Add = int64(targ.Plt) + return true case objabi.R_ADDR: if s.Type == ld.STEXT && ld.Iself { @@ -359,11 +354,6 @@ func adddynrel(ctxt *ld.Link, s *ld.Symbol, r *ld.Reloc) bool { r.Type = 256 // ignore during relocsym return true } - - if ld.Headtype == objabi.Hwindows { - // nothing to do, the relocation will be laid out in pereloc1 - return true - } } return false diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 4b1d541368..45b8c0cd7d 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -803,8 +803,10 @@ func windynrelocsym(ctxt *Link, s *Symbol) { } func dynrelocsym(ctxt *Link, s *Symbol) { - if Headtype == objabi.Hwindows && Linkmode != LinkExternal { - windynrelocsym(ctxt, s) + if Headtype == objabi.Hwindows { + if Linkmode == LinkInternal { + windynrelocsym(ctxt, s) + } return } diff --git a/src/cmd/link/internal/x86/asm.go b/src/cmd/link/internal/x86/asm.go index 58f7f09d28..069ee4702e 100644 --- a/src/cmd/link/internal/x86/asm.go +++ b/src/cmd/link/internal/x86/asm.go @@ -335,11 +335,6 @@ func adddynrel(ctxt *ld.Link, s *ld.Symbol, r *ld.Reloc) bool { r.Type = 256 // ignore during relocsym return true } - - if ld.Headtype == objabi.Hwindows && s.Size == int64(ld.SysArch.PtrSize) { - // nothing to do, the relocation will be laid out in pereloc1 - return true - } } return false