aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-09-15 04:07:55 +0200
committerRon Evans <[email protected]>2021-09-15 15:28:10 +0200
commit37ee4bea40e6d0c4f14beb230aff8da2363aa0ab (patch)
treef8fc1e1fa953db0d41ba25e42ab5b3f742573f79
parentca4f2510509fc6e3195e046a5198980a4ad5fe53 (diff)
downloadtinygo-37ee4bea40e6d0c4f14beb230aff8da2363aa0ab.tar.gz
tinygo-37ee4bea40e6d0c4f14beb230aff8da2363aa0ab.zip
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%.
-rw-r--r--compileopts/target.go1
1 files changed, 1 insertions, 0 deletions
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