go/src
Austin Clements 66065c3115 cmd/link: fix confusing error on unresolved symbol
Currently, if an assembly file includes a static reference to an
undefined symbol, and another package also has an undefined reference
to that symbol, the linker can report an error like:

  x: relocation target zero not defined for ABI0 (but is defined for ABI0)

Since the symbol is referenced in another package, the code in
ErrorUnresolved that looks for alternative ABI symbols finds that
symbol in the symbol table, but doesn't check that it's actually
defined, which is where the "but is defined for ABI0" comes from. The
"not defined for ABI0" is because ErrorUnresolved failed to turn the
static symbol's version back into an ABI, and it happened to print the
zero value for an ABI.

This CL fixes both of these problems. It explicitly maps the
relocation version back to an ABI and detects if it can't be mapped
back (e.g., because it's a static reference). Then, if it finds a
symbol with a different ABI in the symbol table, it checks to make
sure it's a definition, and not simply an unresolved reference.

Fixes #29852.

Change-Id: Ice45cc41c1907919ce5750f74588e8047eaa888c
Reviewed-on: https://go-review.googlesource.com/c/159518
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-29 02:01:16 +00:00
..
archive archive/zip: fix casting overflow on 32-bit arch 2019-01-07 04:23:06 +00:00
bufio bufio: document relationship between UnreadByte/UnreadRune and Peek 2019-01-08 23:47:27 +00:00
builtin
bytes bytes: add ReplaceAll example 2018-12-13 19:40:13 +00:00
cmd cmd/link: fix confusing error on unresolved symbol 2019-01-29 02:01:16 +00:00
compress compress/flate: fix the old url for the flate algorithm 2018-12-20 18:15:50 +00:00
container container/heap: adjust wording in comments 2018-11-13 13:42:59 +00:00
context
crypto crypto/elliptic: reduce subtraction term to prevent long busy loop 2019-01-23 22:01:56 +00:00
database/sql database/sql: fix logic for pulling a Conn from DB 2019-01-14 19:44:57 +00:00
debug debug/gosym: remove outdated comment 2019-01-09 14:44:28 +00:00
encoding encoding/json: add comment for mashalererror struct 2019-01-15 23:30:58 +00:00
errors
expvar
flag flag: improve docs for PrintDefaults; clarify how to change output destination 2019-01-21 05:30:12 +00:00
fmt fmt: include failing method name in panic message 2018-12-13 22:41:52 +00:00
go go/types: don't create new context string for each argument of each call 2019-01-09 16:10:07 +00:00
hash hash/fnv: use bits.Mul64 for 128-bit hash 2018-12-10 22:50:48 +00:00
html text/html: escape MIME type "application/ld+json" as JavaScript 2018-12-13 22:45:02 +00:00
image
index/suffixarray
internal internal/x/net/http2/hpack: update from upstream 2018-12-14 18:15:56 +00:00
io
log log: add Logger.Writer method 2018-10-25 23:23:57 +00:00
math math/big: document that Rat.SetString accepts _decimal_ float representations 2019-01-17 23:04:06 +00:00
mime mime/multipart: quote boundary in Content-Type if necessary 2018-12-13 23:58:06 +00:00
net net/http: update bundled http2 2019-01-23 21:33:28 +00:00
os os: always treat files as unpollable on FreeBSD 2019-01-09 21:50:11 +00:00
path path/filepath: skip TestIssue29372 on windows, if /tmp has symilinks 2019-01-27 04:18:10 +00:00
plugin plugin: fix build constraint to disable test on linux/arm64 2018-11-28 18:14:20 +00:00
reflect runtime: panic on uncomparable map key, even if map is empty 2018-12-29 01:00:54 +00:00
regexp regexp: use backquotes for all regular expression examples 2018-11-20 12:05:15 +00:00
runtime runtime: sample large heap allocations correctly 2019-01-18 15:29:32 +00:00
sort sort: change let to let's 2019-01-27 01:34:56 +00:00
strconv strconv: make docs for Itoa and Atoi slightly higher level 2018-12-31 22:48:43 +00:00
strings strings: add ReplaceAll example 2018-12-13 00:35:06 +00:00
sync all: use "reports whether" consistently in the few places that didn't 2018-11-02 22:47:58 +00:00
syscall syscall: revert to pre-FreeBSD 10 / POSIX-2008 timespec field names in Stat_t on FreeBSD 2018-12-30 19:36:52 +00:00
testdata
testing testing: report the failing test in a late log panic 2019-01-17 01:28:22 +00:00
text text/template/parse: simplify Tree.pipeline 2018-10-29 12:20:11 +00:00
time time: return ENOENT if a zoneinfo zip file is not found 2018-12-24 19:25:18 +00:00
unicode unicode: improve generated comments for categories 2018-11-28 03:12:48 +00:00
unsafe cmd/compile: assume unsafe pointer arithmetic generates non-nil results 2018-11-14 21:01:36 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00
make.bat build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00
make.rc build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00
naclmake.bash
nacltest.bash
race.bash cmd,runtime: enable race detector on arm64 2018-11-13 16:57:22 +00:00
race.bat
run.bash build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00
run.bat build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00
run.rc build: clear GO111MODULE during make.bash etc 2018-11-16 18:54:22 +00:00