public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dimitrije Milosevic <Dimitrije.Milosevic@Syrmia.com>
To: Xi Ruoyao <xry111@xry111.site>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Djordje Todorovic <Djordje.Todorovic@syrmia.com>
Subject: Re: [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and TSAN
Date: Mon, 30 May 2022 07:10:30 +0000	[thread overview]
Message-ID: <AM0PR03MB48824B387E68EAAEA4938B7E82DD9@AM0PR03MB4882.eurprd03.prod.outlook.com> (raw)
In-Reply-To: <e598dc5e6fb56c31e8ce8ff4569bb3bc64b49dfa.camel@xry111.site>

Hi Xi, thanks for pointing this out. I'd definitely say that the https://clang.llvm.org/docs/ThreadSanitizer.html documentation is outdated. According to https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual#supported-platforms TSAN is supported on Mips64. Furthermore, there are actual code segments (in compiler-rt/lib/tsan/rtl/tsan_platforms.h, for example) related to Mips64.
I didn't add the 64-bit target check, however. Here is the updated version of the patch.

gcc/ChangeLog:

        * config/mips/mips.cc (mips_option_override): Enable
        asyncronous unwind tables with both ASAN and TSAN.

---

 gcc/config/mips/mips.cc | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index e64928f4113..2dce4007678 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -20115,10 +20115,16 @@ 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)
+      || (TARGET_64BIT && (flag_sanitize & SANITIZE_THREAD)))
       && !global_options_set.x_flag_asynchronous_unwind_tables)
     flag_asynchronous_unwind_tables = 1;

---

________________________________
From: Xi Ruoyao <xry111@xry111.site>
Sent: Saturday, May 28, 2022 12:30 PM
To: Dimitrije Milosevic <Dimitrije.Milosevic@Syrmia.com>; gcc-patches@gcc.gnu.org <gcc-patches@gcc.gnu.org>
Cc: Djordje Todorovic <Djordje.Todorovic@syrmia.com>
Subject: Re: [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and TSAN

On Thu, 2022-05-26 at 14:18 +0000, Dimitrije Milosevic wrote:
> 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.

According to https://clang.llvm.org/docs/ThreadSanitizer.html, TSAN is
not supported on MIPS.  Is this doc outdated?

--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  parent reply	other threads:[~2022-05-30  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26 14:18 [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and LSAN Dimitrije Milosevic
     [not found] ` <e598dc5e6fb56c31e8ce8ff4569bb3bc64b49dfa.camel@xry111.site>
2022-05-30  7:10   ` Dimitrije Milosevic [this message]
2022-06-07  8:20     ` [PATCH] Mips: Enable asynchronous unwind tables with both ASAN and TSAN Xi Ruoyao
2022-06-07 10:13       ` Dimitrije Milosevic
2022-06-11 12:03         ` Xi Ruoyao
2022-07-04 14:28           ` Dimitrije Milosevic
2022-07-05  1:54             ` Xi Ruoyao
2022-07-05  4:21               ` Fangrui Song
2022-07-05  4:51                 ` Xi Ruoyao
2022-07-05  8:47                   ` Xi Ruoyao
2022-07-05  9:13                 ` Xi Ruoyao
2022-07-05  6:30               ` Dimitrije Milosevic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR03MB48824B387E68EAAEA4938B7E82DD9@AM0PR03MB4882.eurprd03.prod.outlook.com \
    --to=dimitrije.milosevic@syrmia.com \
    --cc=Djordje.Todorovic@syrmia.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).