Skip to content

Commit

Permalink
[GWP-ASan] Fixed issue with c++ standard library dependency.
Browse files Browse the repository at this point in the history
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

llvm-svn: 360982
  • Loading branch information
hctim committed May 17, 2019
1 parent aa6102a commit 364f662
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions compiler-rt/lib/gwp_asan/CMakeLists.txt
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/gwp_asan/random.cpp
Expand Up @@ -8,7 +8,7 @@

#include "gwp_asan/random.h"

#include <ctime>
#include <time.h>

namespace gwp_asan {
uint32_t getRandomUnsigned32() {
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/gwp_asan/random.h
Expand Up @@ -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
Expand Down

0 comments on commit 364f662

Please sign in to comment.