[compiler-rt] r360982 - [GWP-ASan] Fixed issue with c++ standard library dependency.
Mitch Phillips via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 20:20:53 PDT 2019
Author: hctim
Date: Thu May 16 20:20:53 2019
New Revision: 360982
URL: http://llvm.org/viewvc/llvm-project?rev=360982&view=rev
Log:
[GWP-ASan] Fixed issue with c++ standard library dependency.
Summary:
Removed dependency on c++ standard library. Some supporting allocators (namely Scudo on Fuchsia, and shortly, scudo standalone) has a hard requirement of no c++stdlib.
This patch updates the build system so that we don't have any c++ stdlib dependencies. It also will conveniently fix a racy build-order bug discrepency between GWP-ASan and libc++.
Reviewers: phosek, morehouse
Reviewed By: phosek, morehouse
Subscribers: kubamracek, mgorny, cryptoad, #sanitizers, llvm-commits, beanz, smeenai, vitalybuka
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D62048
Modified:
compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt
compiler-rt/trunk/lib/gwp_asan/random.cpp
compiler-rt/trunk/lib/gwp_asan/random.h
Modified: compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt?rev=360982&r1=360981&r2=360982&view=diff
==============================================================================
--- compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/gwp_asan/CMakeLists.txt Thu May 16 20:20:53 2019
@@ -10,10 +10,10 @@ set(GWP_ASAN_HEADERS
random.h
)
-# Disable RTTI and exception support, as we want these libraries to be
-# C-compatible. Regular C source files can be linked against the generated
-# GwpAsan libraries using the Clang C compiler.
-set(GWP_ASAN_CFLAGS -fno-rtti -fno-exceptions)
+# Ensure that GWP-ASan meets the delegated requirements of some supporting
+# allocators. Some supporting allocators (e.g. scudo standalone) cannot use any
+# parts of the C++ standard library.
+set(GWP_ASAN_CFLAGS -fno-rtti -fno-exceptions -nostdinc++)
if (COMPILER_RT_HAS_GWP_ASAN)
foreach(arch ${GWP_ASAN_SUPPORTED_ARCH})
Modified: compiler-rt/trunk/lib/gwp_asan/random.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/gwp_asan/random.cpp?rev=360982&r1=360981&r2=360982&view=diff
==============================================================================
--- compiler-rt/trunk/lib/gwp_asan/random.cpp (original)
+++ compiler-rt/trunk/lib/gwp_asan/random.cpp Thu May 16 20:20:53 2019
@@ -8,7 +8,7 @@
#include "gwp_asan/random.h"
-#include <ctime>
+#include <time.h>
namespace gwp_asan {
uint32_t getRandomUnsigned32() {
Modified: compiler-rt/trunk/lib/gwp_asan/random.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/gwp_asan/random.h?rev=360982&r1=360981&r2=360982&view=diff
==============================================================================
--- compiler-rt/trunk/lib/gwp_asan/random.h (original)
+++ compiler-rt/trunk/lib/gwp_asan/random.h Thu May 16 20:20:53 2019
@@ -9,7 +9,7 @@
#ifndef GWP_ASAN_RANDOM_H_
#define GWP_ASAN_RANDOM_H_
-#include <cstdint>
+#include <stdint.h>
namespace gwp_asan {
// xorshift (32-bit output), extremely fast PRNG that uses arithmetic operations
More information about the llvm-commits
mailing list