1
0
mirror of https://github.com/golang/go synced 2024-11-20 09:04:44 -07: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 // nothing to do, the relocation will be laid out in reloc
return true return true
} }
if ld.Headtype == objabi.Hwindows { // for both ELF and Mach-O
// nothing to do, the relocation will be laid out in pereloc1 addpltsym(ctxt, targ)
return true r.Sym = ctxt.Syms.Lookup(".plt", 0)
} else { r.Add = int64(targ.Plt)
// for both ELF and Mach-O return true
addpltsym(ctxt, targ)
r.Sym = ctxt.Syms.Lookup(".plt", 0)
r.Add = int64(targ.Plt)
return true
}
case objabi.R_ADDR: case objabi.R_ADDR:
if s.Type == ld.STEXT && ld.Iself { 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 r.Type = 256 // ignore during relocsym
return true return true
} }
if ld.Headtype == objabi.Hwindows {
// nothing to do, the relocation will be laid out in pereloc1
return true
}
} }
return false return false

View File

@ -803,8 +803,10 @@ func windynrelocsym(ctxt *Link, s *Symbol) {
} }
func dynrelocsym(ctxt *Link, s *Symbol) { func dynrelocsym(ctxt *Link, s *Symbol) {
if Headtype == objabi.Hwindows && Linkmode != LinkExternal { if Headtype == objabi.Hwindows {
windynrelocsym(ctxt, s) if Linkmode == LinkInternal {
windynrelocsym(ctxt, s)
}
return 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 r.Type = 256 // ignore during relocsym
return true 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 return false