Commit 9f9c5fa8 authored by Clément Chigot's avatar Clément Chigot Committed by Ian Lance Taylor

cmd/link: fix -a with external linker

This commit fixes a panic when -a was used with external linkmode.

Fixes #29807

Change-Id: I8cd42775f2953cec620cbc9ab345421c2694c9a2
Reviewed-on: https://go-review.googlesource.com/c/158998Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent b00ef3b8
...@@ -824,8 +824,10 @@ func Datblk(ctxt *Link, addr int64, size int64) { ...@@ -824,8 +824,10 @@ func Datblk(ctxt *Link, addr int64, size int64) {
for i := range sym.R { for i := range sym.R {
r := &sym.R[i] // Copying sym.Reloc has measurable impact on performance r := &sym.R[i] // Copying sym.Reloc has measurable impact on performance
rsname := "" rsname := ""
rsval := int64(0)
if r.Sym != nil { if r.Sym != nil {
rsname = r.Sym.Name rsname = r.Sym.Name
rsval = r.Sym.Value
} }
typ := "?" typ := "?"
switch r.Type { switch r.Type {
...@@ -836,7 +838,7 @@ func Datblk(ctxt *Link, addr int64, size int64) { ...@@ -836,7 +838,7 @@ func Datblk(ctxt *Link, addr int64, size int64) {
case objabi.R_CALL: case objabi.R_CALL:
typ = "call" typ = "call"
} }
ctxt.Logf("\treloc %.8x/%d %s %s+%#x [%#x]\n", uint(sym.Value+int64(r.Off)), r.Siz, typ, rsname, r.Add, r.Sym.Value+r.Add) ctxt.Logf("\treloc %.8x/%d %s %s+%#x [%#x]\n", uint(sym.Value+int64(r.Off)), r.Siz, typ, rsname, r.Add, rsval+r.Add)
} }
} }
......
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