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

Rafael EspĂ­ndola via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 05:06:06 PDT 2016


On 21 June 2016 at 19:04, Joerg Sonnenberger via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> 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.

I should not, or there is a bug.

It changes the driver to cc1 interface, but given driver invocation we
should be creating identical defines.

Cheers,
Rafael


More information about the cfe-commits mailing list