Add LSan and UBSan specific preprocessor macros trunk
authorkamil <kamil@NetBSD.org>
Sun, 22 Sep 2019 23:34:13 +0000
branchtrunk
changeset 454611 ce27b3489899
parent 454610 dbad9060e3d5
child 454612 686e7a454931
Add LSan and UBSan specific preprocessor macros __SANITIZE_LEAK__ patch: https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01270.html __SANITIZE_UNDEFINED__ https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01286.html GCC upstream does not see value in feature parity with LLVM sanitizers. For the time being this will be a NetBSD specific extension. __SANITIZE_LEAK__ is needed for __NO_LEAKS in <sys/cdefs.h> __SANITIZE_UNDEFINED__ is planned to be reused in the kernel headers.
external/gpl3/gcc/dist/gcc/cppbuiltin.c
--- a/external/gpl3/gcc/dist/gcc/cppbuiltin.c	Sun Sep 22 23:23:12 2019 +0000
+++ b/external/gpl3/gcc/dist/gcc/cppbuiltin.c	Sun Sep 22 23:34:13 2019 +0000
@@ -93,6 +93,12 @@
   if (flag_sanitize & SANITIZE_ADDRESS)
     cpp_define (pfile, "__SANITIZE_ADDRESS__");
 
+  if (flag_sanitize & SANITIZE_UNDEFINED)
+    cpp_define (pfile, "__SANITIZE_UNDEFINED__");
+
+  if (flag_sanitize & SANITIZE_LEAK)
+    cpp_define (pfile, "__SANITIZE_LEAK__");
+
   if (flag_sanitize & SANITIZE_THREAD)
     cpp_define (pfile, "__SANITIZE_THREAD__");