[PATCH] D42980: [scudo] Allow options to be defined at compile time

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 11:09:55 PST 2018


cryptoad created this revision.
cryptoad added a reviewer: alekseyshl.
Herald added subscribers: Sanitizers, delcypher.

Allow for options to be defined at compile time, like is already the case for
other sanitizers, via `SCUDO_DEFAULT_OPTIONS`.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D42980

Files:
  lib/scudo/scudo_flags.cpp


Index: lib/scudo/scudo_flags.cpp
===================================================================
--- lib/scudo/scudo_flags.cpp
+++ lib/scudo/scudo_flags.cpp
@@ -35,6 +35,17 @@
 #undef SCUDO_FLAG
 }
 
+static const char *getCompileDefinitionScudoDefaultOptions() {
+#ifdef SCUDO_DEFAULT_OPTIONS
+// Stringize the macro value.
+# define SCUDO_STRINGIZE(x) #x
+# define SCUDO_STRINGIZE_OPTIONS(Options) SCUDO_STRINGIZE(Options)
+  return SCUDO_STRINGIZE_OPTIONS(SCUDO_DEFAULT_OPTIONS);
+#else
+  return "";
+#endif
+}
+
 static const char *getScudoDefaultOptions() {
   return (&__scudo_default_options) ? __scudo_default_options() : "";
 }
@@ -54,6 +65,9 @@
   RegisterScudoFlags(&ScudoParser, f);
   RegisterCommonFlags(&ScudoParser);
 
+  // Override from compile definition.
+  ScudoParser.ParseString(getCompileDefinitionScudoDefaultOptions());
+
   // Override from user-specified string.
   ScudoParser.ParseString(getScudoDefaultOptions());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42980.133054.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180206/72e278ef/attachment.bin>


More information about the llvm-commits mailing list