-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go/internal/work: wrong arch detection for s390x #73382
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
Comments
Related Issues
Related Code Changes (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
Hi @seankhliao, thanks for quickly triaging this issue! Yep, it appears to be coming from there. By any chance can we add conditional detection, otherwise default to Edit: I think with conditional detection, we should also be able to turn on specific hardware support i.e., |
I have temporarily patched Golang on my side and have verified that the referenced file is causing the problem. Please let me know if the Golang team is looking into a patch or if I should try and make one on my own, and create a PR :) |
CC @golang/s390x |
I think a patch would be welcome, but it would be good to get feedback from the s390x maintainers. |
@taronaeo thank's for raising the issue. Due to this later argument(-march=z196) overrides the earlier one(-march=z15) and exception happening |
Change https://go.dev/cl/666995 mentions this issue: |
@taronaeo you can use cflags(CGO_CFLAGS) which is standard practice in many of the projects.
|
Hi @srinivas-pokala, thanks for verifying the problem on your end. I can reproduce the successful compilation using the suggested I noticed this in the platform detection code,
Feel free to correct me if I'm wrong. In my opinion, the easiest way is to change Apart from the start of support (mentioned here), was there a documented reason why the Golang team chose Documentation for |
Go version
go version devel go1.25-5eaeb7b455 Thu Apr 3 15:36:36 2025 -0700 linux/s390x
Output of
go env
in your module/workspace:What did you do?
I'm trying to compile
Ollama
with-march=z15 -mtune=z15 -mvx -mzvector
butruntime/cgo
is reporting that hardware vector support is not available on z196 while my actual machine is z15.Running a check on the environment variables reported that the machine type is indeed enforced as z196, which is incorrect.
Trying to override the
GOGCCFLAGS
was met withgo: GOGCCFLAGS cannot be modified
as follows$ go env -w GOGCCFLAGS="-fPIC -m64 -march=z15 -mtune=z15 -mvx -mzvector -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2459717027=/tmp/go-build -gno-record-gcc-switches" go: GOGCCFLAGS cannot be modified
What did you see happen?
My Ollama development project fails to compile with
-march=z15 -mtune=z15 -mvx -mzvector
because the machine type is enforced toz196
which is incorrect.What did you expect to see?
I was expecting Go to use the correct machine type i.e., z15 =
-march=z15
, z16 =-march=z16
instead of defaulting to-march=z196
which is very old. Otherwise, a possible method of overriding theGOGCCFLAGS
to fix this bug.The text was updated successfully, but these errors were encountered: