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

x/tools/go/analysis/passes/asmdecl: allow syscall write registers implicitly #69352

Closed
mengzhuo opened this issue Sep 9, 2024 · 3 comments
Closed
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@mengzhuo
Copy link
Contributor

mengzhuo commented Sep 9, 2024

Go version

master

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB='*'
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/root/godev'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/root/godev/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.24-2707d42966 Thu Sep 5 01:59:23 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1468563689=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Consider compile this fucntion with syscall only src/runtime/sys_linux_riscv64.s

 // func rtsigprocmask(how int32, new, old *sigset, size int32)
-TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28
-       MOVW    how+0(FP), A0
-       MOV     new+8(FP), A1
-       MOV     old+16(FP), A2
-       MOVW    size+24(FP), A3
+TEXT runtime·rtsigprocmask<ABIInternal>(SB),NOSPLIT|NOFRAME,$0
        MOV     $SYS_rt_sigprocmask, A7
        ECALL
        MOV     $-4096, T0

What did you see happen?

./sys_linux_riscv64.s:395:1: [riscv64] rt_sigaction: RET without writing to result register

What did you expect to see?

Build complete.

ECALL changed A0 (result register)
I think we should allow all syscall that changed result register implicitly.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 9, 2024
@gopherbot gopherbot added this to the Unreleased milestone Sep 9, 2024
@gabyhelp
Copy link

gabyhelp commented Sep 9, 2024

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/611815 mentions this issue: go/analysis/passes/asmdecl: allow syscall write registers implicitly

@timothy-king timothy-king added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 9, 2024
@timothy-king timothy-king modified the milestones: Unreleased, Go1.24 Sep 9, 2024
@timothy-king
Copy link
Contributor

CC @golang/compiler, @cherrymui as cmd/asm owners.

This seems like the relevant expertise to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants