]> Cypherpunks repositories - gostls13.git/commit
cmd/link: fix duplicated "undefined reloc" errors
authorisharipo <iskander.sharipov@intel.com>
Mon, 21 May 2018 18:00:01 +0000 (21:00 +0300)
committerIan Lance Taylor <iant@golang.org>
Tue, 5 Jun 2018 16:49:07 +0000 (16:49 +0000)
commit2c01b7d632030c89ee608259597f850dd89965a0
tree8d766a867e36962e2295643339058afc0f1f0422
parent0e934dd90e81353aa006c9339c626b6c25ea923d
cmd/link: fix duplicated "undefined reloc" errors

For given program with 2 undefined relocations (main and undefined):

package main
func undefined()
func defined() int {
undefined()
undefined()
return 0
}
var x = defined()

"go tool link" produces these errors:

main.defined: relocation target main.undefined not defined
main.defined: relocation target main.undefined not defined
runtime.main_main·f: relocation target main.main not defined
main.defined: undefined: "main.undefined"
main.defined: undefined: "main.undefined"
runtime.main_main·f: undefined: "main.main"

After this CL is applied:

main.defined: relocation target main.undefined not defined
runtime.main_main·f: function main is undeclared in the main package

Fixes #10978
Improved error message for main proposed in #24809.

Change-Id: I4ba8547b1e143bbebeb4d6e29ea05d932124f037
Reviewed-on: https://go-review.googlesource.com/113955
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/ld_test.go [new file with mode: 0644]
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/testdata/issue10978/main.go [new file with mode: 0644]
src/cmd/link/internal/ld/testdata/issue10978/main.s [new file with mode: 0644]