compiler: add minsize attribute for -Oz

This matches the behavior of Clang, which uses optsize for -Os and adds
minsize for -Oz.

The code size change is all over the map, but using a hacked together
size comparison tool I've found that there is a slight reduction in
binary size overall (-1.6% with the tinygo smoke tests and -0.8% for the
drivers smoke test).
This commit is contained in:
Ayke van Laethem
2021-11-01 18:37:00 +01:00
committed by Ron Evans
parent d7b7583e83
commit 7c24925aa7
3 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -180,8 +180,8 @@ func CallGraph(f *elf.File, callsIndirectFunction []string) (map[string][]*CallN
// used for getting a function pointer
isCall = false
case elf.R_ARM_ABS32:
// used in the reset vector for pointers
isCall = false
// when compiling with -Oz (minsize), used for calling
isCall = true
default:
return nil, fmt.Errorf("unknown relocation: %s", relocType)
}