Define __GCC_HAVE_DWARF2_CFI_ASM if applicable
authorFangrui Song <i@maskray.me>
Tue, 9 Mar 2021 18:52:26 +0000 (10:52 -0800)
committerFangrui Song <i@maskray.me>
Tue, 9 Mar 2021 18:52:26 +0000 (10:52 -0800)
commitc11ff4bbada3b5127a1f010e0a97a1e6e46fb61a
tree154e5f482ad93d1e3cce831b4f0c9ffbc83af35a
parentcc52ea30012d3d9495a41255be50dccc77464cad
Define __GCC_HAVE_DWARF2_CFI_ASM if applicable

In -fno-exceptions -fno-asynchronous-unwind-tables -g0 mode,
GCC does not emit `.cfi_*` directives.

```
% diff <(gcc -fno-asynchronous-unwind-tables -dM -E a.c) <(gcc -dM -E a.c)
130a131
> #define __GCC_HAVE_DWARF2_CFI_ASM 1
```

This macro is useful because code can decide whether inline asm should include `.cfi_*` directives.
`.cfi_*` directives without `.cfi_startproc` can cause assembler errors
(integrated assembler: `this directive must appear between .cfi_startproc and .cfi_endproc directives`).

Differential Revision: https://reviews.llvm.org/D97743
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Preprocessor/unwind-tables.c [new file with mode: 0644]