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
Closed

cmd/asm: s390x asm doesn't accept syntax for internal constants #28648

billotosyr opened this issue Nov 7, 2018 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@billotosyr
Copy link

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 the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 8, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.13 milestone Nov 8, 2018
@ianlancetaylor
Copy link
Contributor

CC @mundaym

@martisch
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

Ok, I have this working now. Thanks.

@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.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants