Enable asynchronous unwind tables with both ASAN and TSAN for correct back-trace. LLVM currently enables asynchronous unwind tables for: ASAN, HWSAN, TSAN, MSAN, and DFSAN. HWSAN is currently available only on AArch64, while MSAN and DFSAN are not available at all. Also, LLVM checks is '-ffreestanding' is not passed in. '-ffreestanding' is only available in C-family frontends, hence why no such check is included. TODO: Not sure if any tests should be added.
gcc/ChangeLog: * config/mips/mips.cc (mips_option_override): Enable asyncronous unwind tables with both ASAN and TSAN. --- gcc/config/mips/mips.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc index e64928f4113..ea2a038216c 100644 --- a/gcc/config/mips/mips.cc +++ b/gcc/config/mips/mips.cc @@ -20115,10 +20115,15 @@ mips_option_override (void) target_flags |= MASK_64BIT; } - /* -fsanitize=address needs to turn on -fasynchronous-unwind-tables in - order for tracebacks to be complete but not if any - -fasynchronous-unwind-table were already specified. */ - if (flag_sanitize & SANITIZE_USER_ADDRESS + /* -fsanitize=address, and -fsanitize=thread need to turn + on -fasynchronous-unwind-tables in order for tracebacks + to be complete but not if any -fasynchronous-unwind-table + were already specified. */ + /* FIXME: HWSAN is currently only available on AArch64, + but could also utilize -fasynchronous-unwind-tables. + FIXME: We would also like to check if -ffreestanding is passed in. + However, it is only available in C-ish frontends. */ + if (flag_sanitize & (SANITIZE_USER_ADDRESS | SANITIZE_THREAD) && !global_options_set.x_flag_asynchronous_unwind_tables) flag_asynchronous_unwind_tables = 1; ---