]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: address comments from CL 28540
authorDavid Crawshaw <crawshaw@golang.org>
Tue, 6 Sep 2016 11:46:59 +0000 (07:46 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 13 Sep 2016 23:34:46 +0000 (23:34 +0000)
Change-Id: I11899096c71ee0e24e902c87914601fcd7ffd7a9
Reviewed-on: https://go-review.googlesource.com/28967
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/ld/data.go

index 9dd55727a0a1e51de017f62bad93b37f4f8eb490..fe145d0b6705625fa4c85d572db137a7b6c6c7d0 100644 (file)
@@ -798,6 +798,9 @@ func tlsIEtoLE(s *ld.Symbol, off, size int) {
        //
        // To determine the instruction and register, we study the op codes.
        // Consult an AMD64 instruction encoding guide to decipher this.
+       if off < 3 {
+               log.Fatal("R_X86_64_GOTTPOFF reloc not preceded by MOVQ or ADDQ instruction")
+       }
        op := s.P[off-3 : off]
        reg := op[2] >> 3
 
index fd536181d76f940e96d682337d3eb189b0704ceb..04e6d3bdb7278b871053fc44c48e437c267b3991 100644 (file)
@@ -456,6 +456,9 @@ func relocsym(ctxt *Link, s *Symbol) {
                                }
                                Thearch.TLSIEtoLE(s, int(off), int(r.Siz))
                                o = int64(ctxt.Tlsoffset)
+                               // TODO: o += r.Add when SysArch.Family != sys.AMD64?
+                               // Why do we treat r.Add differently on AMD64?
+                               // Is the external linker using Xadd at all?
                        } else {
                                log.Fatalf("cannot handle R_TLS_IE (sym %s) when linking internally", s.Name)
                        }