1
0
mirror of https://github.com/golang/go synced 2024-10-03 11:11:22 -06:00

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: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
Hiroshi Ioka 2017-09-10 09:01:30 +09:00 committed by Alex Brainman
parent 8435a746f5
commit 410b73728f
3 changed files with 9 additions and 22 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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