Commit 410b7372 authored by Hiroshi Ioka's avatar Hiroshi Ioka Committed by Alex Brainman

cmd/link: remove windows-specific kludges from Adddynrel

Adddynrel does nothing on windows. We can make code don't call Adddynrel
on windows in the first place.

Change-Id: I376cc36d44a5df18bda13be57e3916ca3062f181
Reviewed-on: https://go-review.googlesource.com/62611
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarAlex Brainman <alex.brainman@gmail.com>
parent 8435a746
......@@ -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
......
......@@ -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
}
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment