Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: in package .syso not working in Go 1.12 #29253

Closed
minux opened this issue Dec 14, 2018 · 1 comment
Closed

cmd/link: in package .syso not working in Go 1.12 #29253

minux opened this issue Dec 14, 2018 · 1 comment

Comments

@minux
Copy link
Member

minux commented Dec 14, 2018

Current go master (Go 1.12) broke the use of in-package syso files (broken by https://golang.org/cl/146297) with names shorter than 12 byte (because
the limitation on filename length, even though race detector relies on syso,
it is not broken by the CL.)

As a short reproduction, run the following shell script under $GOPATH/src:

#!/bin/bash

set -ex

mkdir issue
cd issue

cat <<EOF > ext.c
// +build ignore

int f(int x) { return x * 2; }
EOF
cat <<EOF > pkg.go
package issue

// extern int f(int);
import "C"

func init() {
	println(C.f(42))
}
EOF
cat <<EOF > main.go
// +build ignore

package main

import _ "issue"

func main() {}
EOF

cc -c -fPIC -o ext.syso ext.c
go run main.go

Because Go 1.12 cmd/link no longer passes the bundled syso to the external linker,
the final go run will fail to build the executable due to missing f symbol.

This is a Go 1.12 regression, so labelling it as release-broker.

@minux minux added this to the Go1.12 milestone Dec 14, 2018
@minux minux self-assigned this Dec 14, 2018
@gopherbot
Copy link

Change https://golang.org/cl/154109 mentions this issue: cmd/link: fix in-package syso linking

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants