Skip to content

Commit 37ee4be

Browse files
aykevldeadprogram
authored andcommitted
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%.
1 parent ca4f251 commit 37ee4be

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compileopts/target.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func LoadTarget(target string) (*TargetSpec, error) {
172172
"386": "i386",
173173
"amd64": "x86_64",
174174
"arm64": "aarch64",
175+
"arm": "thumbv7",
175176
}[goarch]
176177
if llvmarch == "" {
177178
llvmarch = goarch

0 commit comments

Comments
 (0)