cmd/link: "relocation target * not defined" for .syso symbol with LinkMode=external #30890
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?(Also tested with go1.12 and go1.12.1).
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Tried to use the toolchain trick described in "Use syso file to embed arbitrary self-contained C code".
code.go
,code.s
andcode.syso
in a package with the following described below.go build
.code.syso
I generated a .syso file in the same directory as the package with the following command:
gcc -x c -c -o code.syso - <<<'void nop1() {}'
. Note, I'm aware of the limitations of syso files with respect to calling convention, I'm just using this as an easy way to get an object file for purposes of demonstrating that linking is not working as I'd expect.code.go
code.s
Then I ran
go build
.What did you expect to see?
A successfully compiled binary.
What did you see instead?
Additional notes
golang.org/x/sys/unix
, then the binary compiles.GOPATH
or modules./cc @ianlancetaylor for the linker.
@gopherbot label needsinvestigation
The text was updated successfully, but these errors were encountered: