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/asm: s390x asm doesn't accept syntax for internal constants #28648

Closed
billotosyr opened this issue Nov 7, 2018 · 4 comments

Comments

@billotosyr
Copy link

@billotosyr billotosyr commented Nov 7, 2018

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

$ go version
1.12 master tip

Does this issue reproduce with the latest release?

yes

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

Linux s390x

go env Output
$ go env
GOARCH="s390x"
GOBIN=""
GOCACHE="/gsa/tlbgsa/home/b/i/billo/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="s390x"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/gsa/tlbgsa/home/b/i/billo/work"
GOPROXY=""
GORACE=""
GOROOT="/sandbox/billo/masterellipticfinal/go"
GOTMPDIR=""
GOTOOLDIR="/sandbox/billo/masterellipticfinal/go/pkg/tool/linux_s390x"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -march=z196 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build825300130=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tried to access internal contants in the cpu package with synax like

MOVB internal\cpu·S390X·HasVE1(SB), R7

but the just gives me synax errors like:

expected '(', found \

I believe this works in amd64 assembly

What did you expect to see?

correct assembly

What did you see instead?

synax error

@ianlancetaylor ianlancetaylor added this to the Go1.13 milestone Nov 8, 2018
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 8, 2018

@martisch

This comment has been minimized.

Copy link
Member

@martisch martisch commented Nov 8, 2018

There are 3 usual pitfalls with these asm statements accessing fields in a variable in another package:
Have you tried "internal∕cpu·S390X+constant" where '∕' should be a unicode '∕' (U+2215) easily mistaken on some terminals with ASCII '/', using a '+' before the constant offset to the field in the variable and the constant offset has to be defined in the package the asm file is in not in internal/cpu?

e.g. offsets used in internal/bytealg assembly for amd64 are defined in:
bytealg.go: offsetX86HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)

@billotosyr

This comment has been minimized.

Copy link
Author

@billotosyr billotosyr commented Nov 13, 2018

Thanks for the tips :-) Another thing I found is that I seem to need to include go_asm.h, otherwise the whole constant offset syntax isn't recognized. I haven't seen this documented.

@billotosyr

This comment has been minimized.

Copy link
Author

@billotosyr billotosyr commented Nov 13, 2018

Ok, I have this working now. Thanks.

@billotosyr billotosyr closed this Nov 13, 2018
@golang golang locked and limited conversation to collaborators Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.