[PATCH] If the user requested a zero-base-shadow sanitizer, infer -pie and -fPIC when appropriate.
Peter Collingbourne
peter at pcc.me.uk
Thu Mar 7 14:05:00 PST 2013
On Thu, Mar 07, 2013 at 06:07:15AM -0800, Alexey Samsonov wrote:
>
>
> ================
> Comment at: lib/Driver/SanitizerArgs.h:68
> @@ +67,3 @@
> + bool hasZeroBaseShadow() const {
> + return (Kind & HasZeroBaseShadow) || AsanZeroBaseShadow;
> + }
> ----------------
> Can you just return (needsTsanRt() || needsMsanRt() || (needsAsanRt && AsanZeroBaseShadow) w/o introducing new SanitizeKind?
I don't really mind which we do, but it seems like the custom in
this file is to introduce new SanitizerKinds for specific categories
of sanitizers.
> ================
> Comment at: lib/Driver/ToolChains.h:499
> @@ -498,2 +498,3 @@
> ArgStringList &CC1Args) const;
> + virtual bool isPICDefault() const;
>
> ----------------
> Out of curiosity - why do you need this?
The Linux toolchain needs to override this function to control when
PIC is turned on by default (see the change to ToolChains.cpp).
>
> ================
> Comment at: lib/Driver/ToolChains.h:503
> @@ -501,2 +502,3 @@
> std::vector<std::string> ExtraOpts;
> + bool HasZeroBaseShadow;
>
> ----------------
> SanitizerHasZeroBaseShadow?
Done.
> ================
> Comment at: lib/Driver/Tools.cpp:5666
> @@ +5665,3 @@
> + SanitizerArgs Sanitize(getToolChain(), Args);
> + const bool isPIE =
> + !Args.hasArg(options::OPT_shared) &&
> ----------------
> s/isPIE/IsPIE
Done.
Thanks,
--
Peter
More information about the cfe-commits
mailing list