[PATCH] D42980: [scudo] Allow options to be defined at compile time
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 08:31:48 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT324620: [scudo] Allow options to be defined at compile time (authored by cryptoad, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42980?vs=133313&id=133430#toc
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D42980
Files:
lib/asan/asan_flags.cc
lib/sanitizer_common/sanitizer_internal_defs.h
lib/scudo/scudo_flags.cpp
lib/tsan/rtl/tsan_interceptors.cc
lib/xray/xray_flags.cc
Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -19,6 +19,9 @@
# define SANITIZER_DEBUG 0
#endif
+#define SANITIZER_STRINGIFY_(S) #S
+#define SANITIZER_STRINGIFY(S) SANITIZER_STRINGIFY_(S)
+
// Only use SANITIZER_*ATTRIBUTE* before the function return type!
#if SANITIZER_WINDOWS
#if SANITIZER_IMPORT_INTERFACE
Index: lib/scudo/scudo_flags.cpp
===================================================================
--- lib/scudo/scudo_flags.cpp
+++ lib/scudo/scudo_flags.cpp
@@ -35,6 +35,14 @@
#undef SCUDO_FLAG
}
+static const char *getCompileDefinitionScudoDefaultOptions() {
+#ifdef SCUDO_DEFAULT_OPTIONS
+ return SANITIZER_STRINGIFY(SCUDO_DEFAULT_OPTIONS);
+#else
+ return "";
+#endif
+}
+
static const char *getScudoDefaultOptions() {
return (&__scudo_default_options) ? __scudo_default_options() : "";
}
@@ -54,6 +62,9 @@
RegisterScudoFlags(&ScudoParser, f);
RegisterCommonFlags(&ScudoParser);
+ // Override from compile definition.
+ ScudoParser.ParseString(getCompileDefinitionScudoDefaultOptions());
+
// Override from user-specified string.
ScudoParser.ParseString(getScudoDefaultOptions());
Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -569,10 +569,8 @@
#define TSAN_INTERCEPTOR_SETJMP TSAN_INTERCEPTOR_SETJMP__(setjmp_symname)
#define TSAN_INTERCEPTOR_SIGSETJMP TSAN_INTERCEPTOR_SETJMP__(sigsetjmp_symname)
-#define TSAN_STRING_SETJMP_(x) # x
-#define TSAN_STRING_SETJMP__(x) TSAN_STRING_SETJMP_(x)
-#define TSAN_STRING_SETJMP TSAN_STRING_SETJMP__(setjmp_symname)
-#define TSAN_STRING_SIGSETJMP TSAN_STRING_SETJMP__(sigsetjmp_symname)
+#define TSAN_STRING_SETJMP SANITIZER_STRINGIFY(setjmp_symname)
+#define TSAN_STRING_SIGSETJMP SANITIZER_STRINGIFY(sigsetjmp_symname)
// Not called. Merely to satisfy TSAN_INTERCEPT().
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
Index: lib/xray/xray_flags.cc
===================================================================
--- lib/xray/xray_flags.cc
+++ lib/xray/xray_flags.cc
@@ -48,9 +48,7 @@
// provided through the XRAY_DEFAULT_OPTIONS from causing compilation issues (or
// changing the semantics of the implementation through the macro). This ensures
// that we convert whatever XRAY_DEFAULT_OPTIONS is defined as a string literal.
-#define XRAY_STRINGIZE(x) #x
-#define XRAY_STRINGIZE_OPTIONS(options) XRAY_STRINGIZE(options)
- return XRAY_STRINGIZE_OPTIONS(XRAY_DEFAULT_OPTIONS);
+ return SANITIZER_STRINGIFY(XRAY_DEFAULT_OPTIONS);
#else
return "";
#endif
Index: lib/asan/asan_flags.cc
===================================================================
--- lib/asan/asan_flags.cc
+++ lib/asan/asan_flags.cc
@@ -33,10 +33,7 @@
static const char *MaybeUseAsanDefaultOptionsCompileDefinition() {
#ifdef ASAN_DEFAULT_OPTIONS
-// Stringize the macro value.
-# define ASAN_STRINGIZE(x) #x
-# define ASAN_STRINGIZE_OPTIONS(options) ASAN_STRINGIZE(options)
- return ASAN_STRINGIZE_OPTIONS(ASAN_DEFAULT_OPTIONS);
+ return SANITIZER_STRINGIFY(ASAN_DEFAULT_OPTIONS);
#else
return "";
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42980.133430.patch
Type: text/x-patch
Size: 3322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180208/6ae98ed7/attachment.bin>
More information about the llvm-commits
mailing list