]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: remove windows-specific kludges from Adddynrel
authorHiroshi Ioka <hirochachacha@gmail.com>
Sun, 10 Sep 2017 00:01:30 +0000 (09:01 +0900)
committerAlex Brainman <alex.brainman@gmail.com>
Sun, 10 Sep 2017 23:19:52 +0000 (23:19 +0000)
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>
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/x86/asm.go

index 8454e47fa27ed3e57d1fd792160a68dbc4bf9f52..20ef5956a983f9258727c8c14ff772deb319e024 100644 (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
index 4b1d5413686ed4c2811e61d53c19a78b7b948aeb..45b8c0cd7de909e9210af5d1093fdf4a75b231a2 100644 (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
        }
 
index 58f7f09d28db948f54674bd7be454cbe45e2c5a5..069ee4702e8a6292db1b14d8e69a3eceb3eb2f67 100644 (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