aboutsummaryrefslogtreecommitdiffhomepage
path: root/stacksize/stacksize.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-11-01 22:03:01 +0100
committerRon Evans <[email protected]>2021-11-03 18:42:16 +0100
commit02ef64f012bc6dd715e341d431b6f86a0ed7ab39 (patch)
treeba2f333c081871c9f4d02e1cd9e5e520d0cab051 /stacksize/stacksize.go
parent5792f3a1cf7687d483f0ae37dabfd40219b7d7cb (diff)
downloadtinygo-02ef64f012bc6dd715e341d431b6f86a0ed7ab39.tar.gz
tinygo-02ef64f012bc6dd715e341d431b6f86a0ed7ab39.zip
stacksize: hardcode some more frame sizes for __aeabi_* functions
These functions are defined in compiler-rt in assembly and therefore don't have stack size information. However, they're often called so these missing functions often inhibit stack size calculation. Example, before: $ tinygo build -o test.elf -target=cortex-m-qemu -print-stacks ./testdata/float.go function stack usage (in bytes) Reset_Handler unknown, __aeabi_memclr does not have stack frame information runtime.run$1 unknown, __aeabi_dcmpgt does not have stack frame information After: $ tinygo build -o test.elf -target=cortex-m-qemu -print-stacks ./testdata/float.go function stack usage (in bytes) Reset_Handler 260 runtime.run$1 224
Diffstat (limited to 'stacksize/stacksize.go')
-rw-r--r--stacksize/stacksize.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/stacksize/stacksize.go b/stacksize/stacksize.go
index ee5ca472a..8cccbaec6 100644
--- a/stacksize/stacksize.go
+++ b/stacksize/stacksize.go
@@ -201,7 +201,25 @@ func CallGraph(f *elf.File, callsIndirectFunction []string) (map[string][]*CallN
case elf.EM_ARM:
knownFrameSizes := map[string]uint64{
// implemented with assembly in compiler-rt
+ "__aeabi_idivmod": 3 * 4, // 3 registers on thumb1 but 1 register on thumb2
"__aeabi_uidivmod": 3 * 4, // 3 registers on thumb1 but 1 register on thumb2
+ "__aeabi_ldivmod": 2 * 4,
+ "__aeabi_uldivmod": 2 * 4,
+ "__aeabi_memclr": 2 * 4, // 2 registers on thumb1
+ "__aeabi_memset": 2 * 4, // 2 registers on thumb1
+ "__aeabi_memcmp": 2 * 4, // 2 registers on thumb1
+ "__aeabi_memcpy": 2 * 4, // 2 registers on thumb1
+ "__aeabi_memmove": 2 * 4, // 2 registers on thumb1
+ "__aeabi_dcmpeq": 2 * 4,
+ "__aeabi_dcmplt": 2 * 4,
+ "__aeabi_dcmple": 2 * 4,
+ "__aeabi_dcmpge": 2 * 4,
+ "__aeabi_dcmpgt": 2 * 4,
+ "__aeabi_fcmpeq": 2 * 4,
+ "__aeabi_fcmplt": 2 * 4,
+ "__aeabi_fcmple": 2 * 4,
+ "__aeabi_fcmpge": 2 * 4,
+ "__aeabi_fcmpgt": 2 * 4,
}
for name, size := range knownFrameSizes {
if sym, ok := symbolNames[name]; ok {