1 // Copyright 2016 The Fuchsia Authors 2 // Copyright (c) 2008-2013 Travis Geiselbrecht 3 // 4 // Use of this source code is governed by a MIT-style 5 // license that can be found in the LICENSE file or at 6 // https://opensource.org/licenses/MIT 7 8 #pragma once 9 10 #ifndef __ASSEMBLER__ 11 #error for assembly files only 12 #endif 13 14 #include <arch/asm_macros.h> 15 16 // for functions that don't have an "end" or don't want .cfi_startproc 17 #define LOCAL_FUNCTION_LABEL(x) .type x,STT_FUNC; x: 18 #define FUNCTION_LABEL(x) .global x; .hidden x; LOCAL_FUNCTION_LABEL(x) 19 20 #define LOCAL_FUNCTION(x) LOCAL_FUNCTION_LABEL(x) .cfi_startproc 21 #define FUNCTION(x) .global x; .hidden x; LOCAL_FUNCTION(x) 22 23 // for local or global functions 24 #define END_FUNCTION(x) .cfi_endproc; .size x, . - x 25 26 #define LOCAL_DATA(x) .type x,STT_OBJECT; x: 27 #define DATA(x) .global x; .hidden x; LOCAL_DATA(x) 28 29 // for local or global data 30 #define END_DATA(x) .size x, . - x 31 32 // Some DWARF constants for CFI description. 33 #define DW_CFA_val_expression 0x16 34 #define DW_OP_lit0 0x30 35 36 .macro cfi_register_is_zero reg 37 .cfi_escape DW_CFA_val_expression, \reg, 1, DW_OP_lit0 38 .endm 39 40 // We want .debug_frame not .eh_frame. 41 // WARNING: This is a subtle side-effect of including this file. Heads up! 42 .cfi_sections .debug_frame 43