[PATCH] Restructure the propagation of -fPIC/-fPIE.

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 16:04:07 PDT 2016


On Tue, Jun 21, 2016 at 06:53:03PM -0400, Rafael EspĂ­ndola via cfe-commits wrote:
> diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
> index 27ef59a..6b93c69 100644
> --- a/lib/Frontend/InitPreprocessor.cpp
> +++ b/lib/Frontend/InitPreprocessor.cpp
> @@ -873,10 +873,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
>    if (unsigned PICLevel = LangOpts.PICLevel) {
>      Builder.defineMacro("__PIC__", Twine(PICLevel));
>      Builder.defineMacro("__pic__", Twine(PICLevel));
> -  }
> -  if (unsigned PIELevel = LangOpts.PIELevel) {
> -    Builder.defineMacro("__PIE__", Twine(PIELevel));
> -    Builder.defineMacro("__pie__", Twine(PIELevel));
> +    if (LangOpts.PIE) {
> +      Builder.defineMacro("__PIE__", Twine(PICLevel));
> +      Builder.defineMacro("__pie__", Twine(PICLevel));
> +    }
>    }
>  
>    // Macros to control C99 numerics and <float.h>

This is the only part that I am somewhat nervous about, since it changes
behavior in an externally visible way. I'm not sure what the code
expectations are in the wild world right now.

Joerg


More information about the cfe-commits mailing list