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

runtime: Add error message when running non GOAMD64=v1 on unsupported hardware #48506

martisch opened this issue Sep 21, 2021 · 2 comments


Copy link

@martisch martisch commented Sep 21, 2021

With #45453 we are introducing GOAMD64 to build binaries that are not supported on all amd64 machines.

This can lead to an illegal instruction exception when running such a binary.

We should make best effort to report when such a binary with GOAMD64 > v1 is run on unsupported hardware.

One way to check is to add some assembly early in the runtime startup like it is done to detect MMX on 386 and print a short error message then exit the go program:

TESTL $(1<<23), DX // MMX

Waiting for internal/cpu to initialise to then do the minimum hardware checks in go code is likely to late as by that time an instruction that was emitted by the go compiler could have been used that already is unsupported.

/cc @mdempsky @randall77

@martisch martisch added this to the Go1.18 milestone Sep 21, 2021
@ALTree ALTree added the NeedsDecision label Sep 21, 2021
Copy link

@gopherbot gopherbot commented Sep 24, 2021

Change mentions this issue: runtime: check amd64 microarchitecture level at startup

gopherbot pushed a commit that referenced this issue Nov 2, 2021
Make Go runtime throw if it's been compiled to assume instruction
set extensions that aren't available on the CPU.
Updates #48506

Change-Id: Ic4d6696e1cd6b28d389a86fe64e8175ea3ca135a
GitHub-Last-Rev: ba33837
GitHub-Pull-Request: #48514
Run-TryBot: Martin Möhrmann <>
TryBot-Result: Go Bot <>
Reviewed-by: Martin Möhrmann <>
Reviewed-by: Keith Randall <>
Trust: Martin Möhrmann <>
Copy link

@mknyszek mknyszek commented Nov 10, 2021

@martisch Is this fixed now? It looks like it, but I wanted to double check. Please close if so. Thanks!

@dmitshur dmitshur added NeedsFix and removed NeedsDecision labels Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

5 participants