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: non-retpoline-compatible errors #57097

Closed
trippleflux opened this issue Dec 5, 2022 · 4 comments
Closed

cmd/compile: non-retpoline-compatible errors #57097

trippleflux opened this issue Dec 5, 2022 · 4 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@trippleflux
Copy link

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

$ v1.19.3

Does this issue reproduce with the latest release?

Yes

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

Debian SID latest updates on x86_64

What did you do?

On nextdns compilation for x86_64 OpenWrt Snapshot, the compilation stopped at :

/home/username/works/openwrt/staging_dir/target-x86_64_glibc_custom/usr/share/gocode/src does not exist, skipping symlinks

touch /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.configured_eb3faa8116006abaa5579256904571c0
rm -f /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.built
touch /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.built_check
CONFIG_GOLANG_MOD_CACHE_WORLD_READABLE="y" GO_BUILD_CACHE_DIR="/home/username/works/openwrt/tmp/go-build" GO_MOD_CACHE_DIR="/home/username/works/openwrt/dl/go-mod-cache" GO_MOD_ARGS="-modcacherw" GO_PKG="github.com/nextdns/nextdns" GO_INSTALL_EXTRA="" GO_INSTALL_ALL="" GO_SOURCE_ONLY="" GO_BUILD_PKG="github.com/nextdns/nextdns/..." GO_EXCLUDES="" GO_GO_GENERATE="" GO_INSTALL_BIN_PATH="/usr/bin" BUILD_DIR="/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0" GO_BUILD_DIR="/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.go_work/build" GO_BUILD_BIN_DIR="/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.go_work/build/bin" GO_BUILD_DEPENDS_PATH="/usr/share/gocode" GO_BUILD_DEPENDS_SRC="/home/username/works/openwrt/staging_dir/target-x86_64_glibc_custom/usr/share/gocode/src" GOOS="linux" GOARCH="amd64" GO386="" GOAMD64="v1" GOARM="" GOMIPS="" GOMIPS64="" GOPPC64="" CGO_ENABLED=1 CC="ccache_cc" CXX="ccache_cxx" CGO_CFLAGS="-mtune=tigerlake -march=tigerlake -O3 -funsafe-math-optimizations -ftree-vectorize -fno-caller-saves -fno-plt -mtune=tigerlake -march=tigerlake -O3 -funsafe-math-optimizations -ftree-vectorize -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0=nextdns-1.38.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" CGO_CPPFLAGS="-I/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/usr/include -I/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/include" CGO_CXXFLAGS="-mtune=tigerlake -march=tigerlake -O3 -funsafe-math-optimizations -ftree-vectorize -fno-caller-saves -fno-plt -mtune=tigerlake -march=tigerlake -O3 -funsafe-math-optimizations -ftree-vectorize -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0=nextdns-1.38.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" CGO_LDFLAGS="-L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/usr/lib -L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/lib -znow -zrelro" GOPATH="/home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.go_work/build" GOCACHE="/home/username/works/openwrt/tmp/go-build" GOMODCACHE="/home/username/works/openwrt/dl/go-mod-cache" GOENV=off /usr/bin/env bash ../../lang/golang//golang-build.sh build -v -buildvcs=false -trimpath -ldflags "all=-buildid '1670156506' -linkmode external -extldflags '-L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/usr/lib -L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/lib -Wl,-z,now -Wl,-z,relro'" -gcflags "all=-spectre all" -asmflags "all=-spectre all"      -ldflags " -X main.version=1.38.0 -buildid '1670156506' -linkmode external -extldflags '-L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/usr/lib -L/home/username/works/openwrt/staging_dir/toolchain-x86_64_gcc-12.2.0_glibc/lib -Wl,-z,now -Wl,-z,relro'"
Finding targets

Building targets
runtime
# runtime
<autogenerated>:1: non-retpoline-compatible: 00200 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/time.go:915)       JMP     (R15)(R12*8)
<autogenerated>:1: non-retpoline-compatible: 00115 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/type.go:614)       JMP     (AX)(SI*8)
<autogenerated>:1: non-retpoline-compatible: 00028 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/time.go:452)       JMP     (R11)(R10*8)
<autogenerated>:1: non-retpoline-compatible: 00021 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/error.go:261)      JMP     (DX)(CX*8)
<autogenerated>:1: non-retpoline-compatible: 00050 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/time.go:691)       JMP     (CX)(R12*8)
<autogenerated>:1: non-retpoline-compatible: 00024 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/debuglog.go:616)   JMP     (CX)(SI*8)
<autogenerated>:1: non-retpoline-compatible: 00079 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/time.go:617)       JMP     (R9)(R8*8)
<autogenerated>:1: non-retpoline-compatible: 00025 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/cgocall.go:453)    JMP     (R9)(DX*8)
<autogenerated>:1: non-retpoline-compatible: 00018 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/type.go:66)        JMP     (DX)(CX*8)
<autogenerated>:1: non-retpoline-compatible: 00020 (/home/username/works/openwrt/staging_dir/hostpkg/lib/go-cross/src/runtime/alg.go:156)        JMP     (SI)(DX*8)
<autogenerated>:1: too many errors

make[2]: *** [Makefile:86: /home/username/works/openwrt/build_dir/target-x86_64_glibc_custom/nextdns-1.38.0/.built] Error 2
make[2]: Leaving directory '/home/username/works/openwrt/feeds/packages/net/nextdns'
time: package/feeds/packages/nextdns/compile#2.11#1.64#2.44
    ERROR: package/feeds/packages/nextdns failed to build.
make[1]: *** [package/Makefile:116: package/feeds/packages/nextdns/compile] Error 1
make[1]: Leaving directory '/home/username/works/openwrt'
make: *** [/home/username/works/openwrt/include/toplevel.mk:231: package/nextdns/compile] Error 2

Downgrading golang-compiler into version 1.18.8 has no such issues as above

Also reported in OpenWrt.

What did you expect to see?

Compilation continue until the end / succeed.

What did you see instead?

Compilation stopped at non-retpoline-compatible

@randall77
Copy link
Contributor

This looks like the new jump tables, https://go-review.googlesource.com/c/go/+/357330 , which aren't compatible with retpolines, I guess. Even though they aren't returns.

I think we just need to disable jump tables when retpolines are on. We could make them work with retpolines but probably not worth the complexity or slowdown.

@randall77
Copy link
Contributor

@gopherbot please open a backport issue to 1.19.

This issue makes large switches fail to compile in -spectre=all or -spectre=ret mode.

@gopherbot
Copy link

Backport issue(s) opened: #57100 (for 1.19).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@seankhliao seankhliao changed the title golang-compiler: non-retpoline-compatible errors cmd/compile: non-retpoline-compatible errors Dec 6, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 6, 2022
@gopherbot
Copy link

Change https://go.dev/cl/455336 mentions this issue: cmd/compile: turn off jump tables when spectre retpolines are on

@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 6, 2022
@dmitshur dmitshur added this to the Go1.20 milestone Dec 7, 2022
@golang golang locked and limited conversation to collaborators Dec 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants