diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-07 16:29:22 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-07 16:29:22 +0000 |
commit | 3dcd5df11c166b18d445c366cd57d6245391df2e (patch) | |
tree | 6f429f963a824f06c51ad8534931937fd85f61e3 /gcc/dwarf2out.c | |
parent | 0729edb47e264da6bb70fc7a4c19369897ca7ad2 (diff) | |
download | gcc-3dcd5df11c166b18d445c366cd57d6245391df2e.tar.gz |
* configure.ac (HAVE_GAS_CFI_PERSONALITY_DIRECTIVE): New.
* configure, config.in: Rebuild.
* debug.h (dwarf2out_do_cfi_asm): Declare.
* c-cppbuiltin.c (c_cpp_builtins): Use it.
* dwarf2out.c (dwarf2out_do_cfi_asm): New.
(dwarf2out_cfi_label, add_fde_cfi, output_call_frame_info,
dwarf2out_begin_prologue, dwarf2out_end_epilogue): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138846 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ad09949cc15..ced629dfda7 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -130,6 +130,32 @@ dwarf2out_do_frame (void) ); } +/* Decide whether to emit frame unwind via assembler directives. */ + +int +dwarf2out_do_cfi_asm (void) +{ + int enc; + + if (!flag_dwarf2_cfi_asm || !dwarf2out_do_frame ()) + return false; + if (!eh_personality_libfunc) + return true; + if (!HAVE_GAS_CFI_PERSONALITY_DIRECTIVE) + return false; + + /* Make sure the personality encoding is one the assembler can support. + In particular, aligned addresses can't be handled. */ + enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/2,/*global=*/1); + if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel) + return false; + enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0,/*global=*/0); + if ((enc & 0x70) != 0 && (enc & 0x70) != DW_EH_PE_pcrel) + return false; + + return true; +} + /* The size of the target's pointer type. */ #ifndef PTR_SIZE #define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT) @@ -667,7 +693,7 @@ dwarf2out_cfi_label (void) { static char label[20]; - if (flag_dwarf2_cfi_asm) + if (dwarf2out_do_cfi_asm ()) { /* In this case, we will be emitting the asm directive instead of the label, so just return a placeholder to keep the rest of the @@ -691,7 +717,7 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi) { dw_cfi_ref *list_head = &cie_cfi_head; - if (flag_dwarf2_cfi_asm) + if (dwarf2out_do_cfi_asm ()) { if (label) { @@ -2767,7 +2793,7 @@ output_call_frame_info (int for_eh) return; /* Nothing to do if the assembler's doing it all. */ - if (flag_dwarf2_cfi_asm) + if (dwarf2out_do_cfi_asm ()) return; /* If we make FDEs linkonce, we may have to emit an empty label for @@ -3187,7 +3213,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, dwarf2out_source_line (line, file); #endif - if (flag_dwarf2_cfi_asm) + if (dwarf2out_do_cfi_asm ()) { int enc; rtx ref; @@ -3242,7 +3268,7 @@ dwarf2out_end_epilogue (unsigned int line ATTRIBUTE_UNUSED, dw_fde_ref fde; char label[MAX_ARTIFICIAL_LABEL_BYTES]; - if (flag_dwarf2_cfi_asm) + if (dwarf2out_do_cfi_asm ()) fprintf (asm_out_file, "\t.cfi_endproc\n"); /* Output a label to mark the endpoint of the code generated for this |