From 37ee4bea40e6d0c4f14beb230aff8da2363aa0ab Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 15 Sep 2021 04:07:55 +0200 Subject: [PATCH] arm: switch to Thumb instruction set on ARM This reduces binary size substantially, for two reasons: - It switches to a much more architecture ARMv4 vs ARMv7. - It switches to Thumb2, which is a lot denser than regular ARM. Practically all modern and not-so-modern ARM chips support Thumb2, so this seems like a safe change to me. The size in numbers: - Code size for testdata/stdlib.go is reduced by about 35%. - Binary size for testdata/stdlib.go (when compiling with -no-debug to strip debug information) is reduced by about 16%. --- compileopts/target.go | 1 + 1 file changed, 1 insertion(+) diff --git a/compileopts/target.go b/compileopts/target.go index 19951426b..a84896c9b 100644 --- a/compileopts/target.go +++ b/compileopts/target.go @@ -172,6 +172,7 @@ func LoadTarget(target string) (*TargetSpec, error) { "386": "i386", "amd64": "x86_64", "arm64": "aarch64", + "arm": "thumbv7", }[goarch] if llvmarch == "" { llvmarch = goarch