aboutsummaryrefslogtreecommitdiffhomepage
path: root/stacksize
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-09-16 01:07:46 +0200
committerRon Evans <[email protected]>2020-09-16 05:06:34 +0200
commitfcedf0beaa44c080e583c4b7eb6932f8ea4117e0 (patch)
tree80cff78ea511030f190e6eb98da908a8e1150b41 /stacksize
parent4dadb31e18ffbd74b86ef0e775ec378bb2c2161f (diff)
downloadtinygo-fcedf0beaa44c080e583c4b7eb6932f8ea4117e0.tar.gz
tinygo-fcedf0beaa44c080e583c4b7eb6932f8ea4117e0.zip
stacksize: deal with DW_CFA_advance_loc1
In some cases this operation is emitted. It appears to be emitted when a switch is lowered to a jump table in the ARM backend.
Diffstat (limited to 'stacksize')
-rw-r--r--stacksize/dwarf.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/stacksize/dwarf.go b/stacksize/dwarf.go
index 6186a8c2f..d4e714277 100644
--- a/stacksize/dwarf.go
+++ b/stacksize/dwarf.go
@@ -207,6 +207,16 @@ func (fi *frameInfo) exec(bytecode []byte) ([]frameInfoLine, error) {
switch lowBits {
case 0: // DW_CFA_nop
// no operation
+ case 0x02: // DW_CFA_advance_loc1
+ // Very similar to DW_CFA_advance_loc but allows for a slightly
+ // larger range.
+ offset, err := r.ReadByte()
+ if err != nil {
+ return nil, err
+ }
+ fi.loc += uint64(offset) * fi.cie.codeAlignmentFactor
+ entries = append(entries, fi.newLine())
+ // TODO: DW_CFA_advance_loc2 etc
case 0x07: // DW_CFA_undefined
// Marks a single register as undefined. This is used to stop
// unwinding in tinygo_startTask using: