diff options
author | Martin Möhrmann <martin@golang.org> | 2020-10-24 05:54:46 +0200 |
---|---|---|
committer | Martin Möhrmann <martin@golang.org> | 2021-08-23 11:23:58 +0000 |
commit | c1a14781eca85e9c705c782aa2071a5f9c23c09e (patch) | |
tree | 915b8e04227ddb1dc4b63fd43b59598f39bf9522 /src/runtime/proc.go | |
parent | 457418b47556520d73148a9a5672ee380bd0b5a4 (diff) | |
download | go-c1a14781eca85e9c705c782aa2071a5f9c23c09e.tar.gz go-c1a14781eca85e9c705c782aa2071a5f9c23c09e.zip |
runtime: remove unused cpu architecture feature variables from binaries
On amd64 this reduces go binary sizes by 176 bytes due to not referencing
internal/cpu.ARM64 and internal/cpu.ARM.
Change-Id: I8e4f31e2b1939b05eec2148b44d7cff7e0aeb30e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344329
Trust: Martin Möhrmann <martin@golang.org>
Run-TryBot: Martin Möhrmann <martin@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r-- | src/runtime/proc.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index c2e43ef5c3..55023e3f9f 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -622,13 +622,18 @@ func cpuinit() { // Support cpu feature variables are used in code generated by the compiler // to guard execution of instructions that can not be assumed to be always supported. - x86HasPOPCNT = cpu.X86.HasPOPCNT - x86HasSSE41 = cpu.X86.HasSSE41 - x86HasFMA = cpu.X86.HasFMA + switch GOARCH { + case "386", "AMD64": + x86HasPOPCNT = cpu.X86.HasPOPCNT + x86HasSSE41 = cpu.X86.HasSSE41 + x86HasFMA = cpu.X86.HasFMA - armHasVFPv4 = cpu.ARM.HasVFPv4 + case "arm": + armHasVFPv4 = cpu.ARM.HasVFPv4 - arm64HasATOMICS = cpu.ARM64.HasATOMICS + case "arm64": + arm64HasATOMICS = cpu.ARM64.HasATOMICS + } } // The bootstrap sequence is: |