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/compile: missing references to symbols in .syso #52863

Open
sbinet opened this issue May 12, 2022 · 6 comments
Open

cmd/compile: missing references to symbols in .syso #52863

sbinet opened this issue May 12, 2022 · 6 comments
Labels
NeedsInvestigation WaitingForInfo
Milestone

Comments

@sbinet
Copy link
Member

@sbinet sbinet commented May 12, 2022

What version of Go are you using (go version)?

$ go version
go version devel go1.19-2bea43b0e7 Thu May 12 04:47:29 2022 +0000 linux/amd64

Does this issue reproduce with the latest release?

yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/binet/.cache/go-build"
GOENV="/home/binet/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/binet/dev/go/gocode/pkg/mod"
GONOPROXY="gitlab.cern.ch/tile-in-one/tio-go"
GONOSUMDB="gitlab.cern.ch/tile-in-one/tio-go"
GOOS="linux"
GOPATH="/home/binet/dev/go/gocode"
GOPRIVATE="gitlab.cern.ch/tile-in-one/tio-go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/binet/sdk/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/binet/sdk/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.19-2bea43b0e7 Thu May 12 04:47:29 2022 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3696923155=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$> cd somewhere
$> git clone git@github.com:gioui/gio gio && cd gio
$> go build ./...
[...]
gioui.org/widget/material
gioui.org/gpu/internal/vulkan
gioui.org/gpu
gioui.org/internal/egl
# gioui.org/internal/egl
/usr/bin/ld: /home/binet/work/gio/pkg/mod/gioui.org/shader@v1.0.6/piet/backdrop_linux_amd64.syso: in function `backdrop_coroutine_begin':
:(.text+0x2b): undefined reference to `coroutine_alloc_frame'
/usr/bin/ld: /home/binet/work/gio/pkg/mod/gioui.org/shader@v1.0.6/piet/backdrop_linux_amd64.syso: in function `backdrop_coroutine_begin.destroy':
:(.text+0x2a42): undefined reference to `coroutine_free_frame'
/usr/bin/ld: /home/binet/work/gio/pkg/mod/gioui.org/shader@v1.0.6/piet/backdrop_linux_amd64.syso: in function `backdrop_coroutine_begin.cleanup':
:(.text+0x2a54): undefined reference to `coroutine_free_frame'
/usr/bin/ld: /home/binet/work/gio/pkg/mod/gioui.org/shader@v1.0.6/piet/binning_linux_amd64.syso: in function `binning_coroutine_begin':
:(.text+0x24): undefined reference to `coroutine_alloc_frame'
/usr/bin/ld: /home/binet/work/gio/pkg/mod/gioui.org/shader@v1.0.6/piet/binning_linux_amd64.syso: in function `binning_coroutine_begin.resume':
:(.text+0x13fe): undefined reference to `floorf'
/usr/bin/ld: :(.text+0x140f): undefined reference to `floorf'
/usr/bin/ld: :(.text+0x1421): undefined reference to `floorf'
/usr/bin/ld: :(.text+0x1434): undefined reference to `floorf'
/usr/bin/ld: :(.text+0x1464): undefined reference to `floorf'

everything works fine w/ Go-1.18.x

What did you expect to see?

a valid build.

@heschi
Copy link
Contributor

@heschi heschi commented May 12, 2022

cc @golang/runtime

Hard to say without investigating if this is a new bug in the compiler or a latent bug in gioui.

@heschi heschi added the NeedsInvestigation label May 12, 2022
@heschi heschi added this to the Go1.19 milestone May 12, 2022
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented May 12, 2022

What is in the syso and how is it built? It looks like those symbols are from C libraries. floorf is a C function that needs to be linked with -lm. coroutine_alloc_frame is from LLVM. gio probably needs to pass the right flags to the C linker to link with those libraries.

@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented May 12, 2022

@seankhliao seankhliao changed the title compile: missing references to symbols in .syso cmd/compile: missing references to symbols in .syso May 12, 2022
@sbinet
Copy link
Member Author

@sbinet sbinet commented May 16, 2022

it seems the build is taken care of by:

https://git.sr.ht/~eliasnaur/gio-shader/tree/main/item/piet/gencpu.sh

the program that actually creates the .syso seems to be:
https://git.sr.ht/~eliasnaur/gio-cpu/tree/main/item/cmd/compile/main.go#L120
(I have highlighted the part that does symbol renaming, which may have changed behaviour from 1.18 to 1.19)

@eliasnaur
Copy link
Contributor

@eliasnaur eliasnaur commented May 17, 2022

Does -x reveal the external linker invocation? FWIW, -lm is specified in https://git.sr.ht/~eliasnaur/gio-shader/tree/main/item/piet/backdrop_abi.go#L13, and coroutine_ functions are defined in support.c.

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented May 17, 2022

go build -x doesn't print external linker invocation, but -ldflags=-v does. Yeah, it would be good to show the external linker invocation to see what's missing.

@cherrymui cherrymui added the WaitingForInfo label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation WaitingForInfo
Projects
None yet
Development

No branches or pull requests

5 participants