Skip to content

Commit

Permalink
GoArm, MinimumRequirements: add documentation on GOARM64
Browse files Browse the repository at this point in the history
Go 1.23 introduced GOARM64 environment variable; this patch documents
it.

Related to golang/go#69124

Change-Id: I148b1295d8772041f2379771a2f2e682fd4bfdbe
Reviewed-on: https://go-review.googlesource.com/c/wiki/+/609855
Reviewed-by: Cherry Mui <[email protected]>
  • Loading branch information
andreybokhanko authored and cherrymui committed Aug 30, 2024
1 parent 206fae2 commit c458843
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions GoArm.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Go supports the following ARM architectural families.
| ARMv6 | supported | GOARM=6 | GOARCH=arm |
| ARMv7 | supported | GOARM=7 | GOARCH=arm |
| ARMv8 | supported | n/a | GOARCH=arm64 |
| ARMv9 | supported | n/a | GOARCH=arm64 |

Starting from Go 1.1, the appropriate GOARM value will be chosen if you compile the program from source on the target machine. In cross compilation situations, it is recommended that you always set an appropriate GOARM value along with GOARCH.

Expand Down
10 changes: 9 additions & 1 deletion MinimumRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ See https://go.dev/doc/install/source#environment

### arm64

All ARMv8-A processors.
Until Go 1.23, the Go compiler always generated ARM64 binaries that could be executed by any ARMv8-A processor.

Go 1.23 introduced a new `GOARM64` environment variable, which specifies the minimum target version of the ARM64 architecture at compile time. Allowed values are `v8.{0-9}` and `v9.{0-5}`. This may be followed by an option specifying extensions implemented by target hardware. Valid options are `,lse` and `,crypto`.

Setting, for example, `GOARM64=v8.0,lse`, will allow the Go compiler to use LSE instructions in the generated binaries (which may improve performance in some cases); but these binaries will not run on older ARM64 processors that don’t support LSE.

The Go toolchain may also generate newer instructions, but guarded by dynamic checks to ensure they’re only executed on capable processors.

The `GOARM64` environment variable defaults to `v8.0`.

### ppc64 (big endian)

Expand Down

0 comments on commit c458843

Please sign in to comment.