[compiler-rt] [compiler-rt][nsan] Add `-fno-rtti` to compile flags (PR #98768)
Dmitriy Chestnykh via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 13 13:18:11 PDT 2024
https://github.com/chestnykh updated https://github.com/llvm/llvm-project/pull/98768
>From 61750a121e4516bccbc9d6bc06b9845e11156f11 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Sat, 13 Jul 2024 23:01:56 +0300
Subject: [PATCH 1/2] [compiler-rt][nsan] Add `-fno-rtti` to compile flags
Other runtime libraries build scripts
like asan, dfsan, msan etc.
use this flag to avoid vtables in the runtime library
Fix #98767
---
compiler-rt/lib/nsan/CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/compiler-rt/lib/nsan/CMakeLists.txt b/compiler-rt/lib/nsan/CMakeLists.txt
index 1e138d4560c89..ed2fce495a1d9 100644
--- a/compiler-rt/lib/nsan/CMakeLists.txt
+++ b/compiler-rt/lib/nsan/CMakeLists.txt
@@ -28,6 +28,8 @@ append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC NSAN_CFLAGS)
set(NSAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
set(NSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
+append_rtti_flag(OFF NSAN_CFLAGS)
+
set(NSAN_DYNAMIC_CFLAGS ${NSAN_CFLAGS})
set(NSAN_COMMON_RUNTIME_OBJECT_LIBS
>From 623f8c0baab4a3508021b7ffbc7bf6293046739f Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Sat, 13 Jul 2024 23:15:56 +0300
Subject: [PATCH 2/2] [compiler-rt][nsan] Remove duplicate `-fPIC` setting
`-fPIC` flag appends to the SANITIZER_COMMON_CFLAGS
in the root CMakeLists.txt of compiler-rt
We set NSAN_CFLAGS to SANITIZER_COMMON_CFLAGS in nsan's CMakeLists
---
compiler-rt/lib/nsan/CMakeLists.txt | 2 --
1 file changed, 2 deletions(-)
diff --git a/compiler-rt/lib/nsan/CMakeLists.txt b/compiler-rt/lib/nsan/CMakeLists.txt
index ed2fce495a1d9..acadb09c3332b 100644
--- a/compiler-rt/lib/nsan/CMakeLists.txt
+++ b/compiler-rt/lib/nsan/CMakeLists.txt
@@ -23,8 +23,6 @@ set(NSAN_HEADERS
nsan_suppressions.h
)
-append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC NSAN_CFLAGS)
-
set(NSAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
set(NSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
More information about the llvm-commits
mailing list