-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/go: provide build tags for architecture environment variables #45454
Comments
Is it possible that we will add subset options in the future? (For example, something intermediate between AMD64 v1 and v2?) If so, then I think we should set a build tag for the default, so that carefully-written code can fall back to a platform-independent implementation if compiled on a subset smaller than that default (such as in the case of the 386 |
I'm hoping we don't have to, but I wouldn't want to rule it out yet either. |
GOWASM established the pattern that this environment variable can be a comma-separated list. So we need to figure out how a list maps. Presumably each item in the list becomes a separate "arch.thing" tag. We also need to figure out inclusion. Presumably if you write code with a special case for It doesn't seem like we should apply any special shortenings like ppc64le.9. Let's just use what the environment variable syntax is. (ppc64le.power9 makes sense for ppc64le anywaybecause they call the architecture "POWER9".) |
This proposal has been added to the active column of the proposals project |
Will leave in the minutes for another week before moving to likely accept, but it seems like it's headed there. Last call for objections. |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. 🎉 |
Change https://go.dev/cl/421434 mentions this issue: |
Implement proposal golang#45454, providing build tags based on the sub-architecture information in the GO$GOARCH variable (for example, GOARM for GOARCH=arm). For example, when GOAMD64=v2, the additional build tags amd64.v1 and amd64.v2 are defined to be true. Fixes golang#45454. Change-Id: I7be56060d47fc61843b97fd8a78498e8202c1ee7 Reviewed-on: https://go-review.googlesource.com/c/go/+/421434 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]> Auto-Submit: Russ Cox <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
Change https://go.dev/cl/422615 mentions this issue: |
…ToolTags So it's consistent when running "go list -f '{{context.ToolTags}}'" and printing the content of "build.Default.ToolTags". Updates #45454 Change-Id: I7a3cbf3cdf9a6ce2b8c89e9bcf5fc5e9086d48e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/422615 Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]>
This proposal is to have cmd/go automatically set build tags when architecture environment variables are specified.
If an architecture option GO[arch]=[option] is enabled, then cmd/go should set the [arch].[option] build tag. For example, if GOARM=6 is enabled, then cmd/go should set the "arm.6" build tag; if GOARM=7 is enabled, then it should set both the "arm.6" and "arm.7" build tags (since GOARM=7 is a superset of GOARM=6).
Precedent: We already set goexperiment.foo for each GOEXPERIMENT=foo option that's set.
Questions:
What to do about default flags? Do we need/want to still set "arm.5", even though that's always implied?
GOARM uses just "5", "6", "7", but GOPPC64 uses "power8", "power9". Should cmd/go use "ppc64.power9"? Or should it be "ppc64le.power9" for GOARCH=ppc64le?
What about hardfloat/sse2 vs softfloat? Is there any reason to provide 386.sse2, or should users just check for !386.softfloat? In fact, since softfloat exists across architectures, maybe a common "softfloat" tag should be used instead or in addition?
The text was updated successfully, but these errors were encountered: