[cfe-commits] [PATCH] ASan: support for zero-based shadow for PIE binaries (Clang part).

Alexey Samsonov samsonov at google.com
Fri Jan 18 12:41:32 PST 2013



================
Comment at: include/clang/Driver/Options.td:398-400
@@ -395,1 +397,5 @@
+                                   HelpText<"Assume that code is built with PIE in AddressSanitizer">;
+def fno_sanitize_address_assume_pie : Flag<["-"], "fno-sanitize-address-assume-pie">,
+                                      Group<f_clang_Group>,
+                                      HelpText<"Don't assume that code is built with PIE in AddressSanitizer">;
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
----------------
Richard Smith wrote:
> We generally only provide documentation for the non-default value of a flag, to keep the --help output shorter.
Done

================
Comment at: lib/Driver/Tools.cpp:1527
@@ -1518,1 +1526,3 @@
     if (!Args.hasArg(options::OPT_shared)) {
+      bool assume_pie = Args.hasFlag(
+          options::OPT_fsanitize_address_assume_pie,
----------------
Richard Smith wrote:
> AssumePie
Done

================
Comment at: lib/Driver/Tools.cpp:1530-1532
@@ +1529,5 @@
+          options::OPT_fno_sanitize_address_assume_pie, false);
+      if (assume_pie && !Args.hasArg(options::OPT_pie)) {
+        TC.getDriver().Diag(diag::err_drv_argument_only_allowed_with) <<
+            "-fsanitize-address-assume-pie" << "-pie";
+      }
----------------
Richard Smith wrote:
> Can we also issue a diagnostic in the compilation step if -fsanitize-address-assume-pie is given and we don't have -fPIC/-fPIE/-fpic/-fpie?
eugenis@ mentioned that one may compile a (very simple) source w/o -fPIE, but still be able to successfully link it with "-pie", so overall this doesn't look like a must.


http://llvm-reviews.chandlerc.com/D303



More information about the cfe-commits mailing list