Skip to content

x/sys/cpu: ARM64.HasAES = false on Apple Silicon (M1 Max) #68150

Closed as not planned
golang/sys
#202
@aadomnicai

Description

@aadomnicai

What version of Go are you using (go version)?

$ go version
go version go1.22.2 darwin/arm64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/alexandre.adomnicai/Library/Caches/go-build'
GOENV='/Users/alexandre.adomnicai/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/alexandre.adomnicai/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/alexandre.adomnicai/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.22.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.22.2/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/alexandre.adomnicai/Github/test_aes/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/31/w4yrhpr51z15j6f6wml61kvr0000gp/T/go-build1310596040=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOROOT/bin/go version: go version go1.22.2 darwin/arm64
GOROOT/bin/go tool compile -V: compile version go1.22.2
uname -v: Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
ProductName:		macOS
ProductVersion:		14.5
BuildVersion:		23F79
lldb --version: lldb-1500.0.404.7
Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)

What did you do?

Run a simple test to check whether hardware AES is used on my machine.
The following is simply run with go test -tags ""

package aes_test

import (
	"fmt"
	"testing"

	"golang.org/x/sys/cpu"
)

func TestEncryptDecryptMessage(t *testing.T) {
	fmt.Printf("Hardware AES is used: %t\n", cpu.ARM64.HasAES)
}

What did you expect to see?

I would have expected Hardware AES is used: true since AES instructions are supported.
In go/src/internal/cpu/cpu_arm64_darwin.go, the variable cpu.ARM64.HasAES should be set to true, and I cannot understand why that is not the case since the build conditions //go:build arm64 && darwin && !ios should be satisfied?

What did you see instead?

I get Hardware AES is used: false instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Darwinarch-arm64

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions