• isharipo's avatar
    cmd/link: fix duplicated "undefined reloc" errors · 2c01b7d6
    isharipo authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    2c01b7d6
main.go 478 Bytes