// Define assembler macros for generating DWARF CFI instructions that use DWARF expressions. // Assemblers don't natively support DWARF expressions, so use the C preprocessor and assembler // macros to lower them to .cfi_escape directives. // // Signal trampolines need to use DWARF expressions to record the locations of saved registers, // because the offsets from the restored SP to the saved registers is variable. e.g. A signal frame // can have optional FP/SIMD extensions, and there may be extra padding if the interrupted SP wasn't // aligned.
// Return the size of a small uleb128 value: either 1 or 2 bytes #define ULEB128_14BIT_SIZE(val) \
(1 + (((val) > 0x7f) & 1))
// Return the size of a small sleb128 value: either 1 or 2 bytes #define SLEB128_14BIT_SIZE(val) \
(1 + (((val) < -0x40) & 1) + \
(((val) > 0x3f) & 1) )
// Output a 1 or 2-byte CFI uleb128 absolute value.
.macro m_cfi_uleb128 val
.if (\val) < 0 || (\val) > 0x3fff
.error "m_cfi_uleb128 value is out of range (\val)"
.elseif (\val) > 0x7f
.cfi_escape ((\val) & 0x7f) | 0x80
.cfi_escape (\val) >> 7
.else
.cfi_escape (\val)
.endif
.endm
// Output a 1 or 2-byte CFI sleb128 absolute value.
.macro m_cfi_sleb128 val
.if (\val) < -0x2000 || (\val) > 0x1fff
.error "m_cfi_sleb128 value is out of range (\val)"
.elseif (\val) < -0x40 || (\val) > 0x3f
.cfi_escape ((\val) & 0x7f) | 0x80
.cfi_escape ((\val) >> 7) & 0x7f
.else
.cfi_escape (\val) & 0x7f
.endif
.endm
.macro check_base_reg reg_no
.if (\reg_no) < 0 || (\reg_no) > 31
.error "base register is out of range for DW_OP_breg0..DW_OP_breg31 (\reg_no)"
.endif
.endm
// Set CFA to the expression, *(base_reg + offset)
.macro m_cfi_def_cfa_deref base_reg, offset
check_base_reg (\base_reg)
.cfi_escape DW_CFA_def_cfa_expression
m_cfi_uleb128 (1 + SLEB128_14BIT_SIZE(\offset) + 1) // size of DWARF expression in bytes
.cfi_escape DW_OP_breg0 + (\base_reg) // expr: 1 byte
m_cfi_sleb128 (\offset) // expr: 1 or 2 bytes
.cfi_escape DW_OP_deref // expr: 1 byte
.endm
// Set the address of the register's previous value to the expression, (base_reg + offset)
.macro m_cfi_breg_offset dest_reg, base_reg, offset
check_base_reg (\base_reg)
.cfi_escape DW_CFA_expression
m_cfi_uleb128 (\dest_reg)
m_cfi_uleb128 (1 + SLEB128_14BIT_SIZE(\offset)) // size of DWARF expression in bytes
.cfi_escape DW_OP_breg0 + (\base_reg) // expr: 1 byte
m_cfi_sleb128 (\offset) // expr: 1 or 2 bytes
.endm
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.