[PATCH][2/n] LTO option handling/merging rewrite

Richard Guenther richard.guenther@gmail.com
Sun Oct 30 01:13:00 GMT 2011


On Fri, Oct 28, 2011 at 5:48 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Fri, 28 Oct 2011, Richard Guenther wrote:
>
>> +       /* Fallthru.  */
>> +     case OPT_fPIC:
>> +     case OPT_fpic:
>> +     case OPT_fpie:
>> +     case OPT_fcommon:
>> +     case OPT_fexceptions:
>> +       append_option (decoded_options, decoded_options_count, foption);
>> +       break;
>
> No doubt this is what the previous code did, but in this case shouldn't
> "union" mean the biggest PIC status of any file wins (thus, if -fPIC was
> the PIC option that actually had effect on some object, that wins over an
> explicit -fno-PIC or -fpic on another object)?  In general whether the
> options are positive or negative matters, and I don't see that handled
> here.

I tried to look at what we get for -fno-pic vs. -fpic and -fno-pic is completely
dropped from the decoded options list (not sure what happens on targets
with -fpic as default).  So it seems at most one state (the non-default one)
survives here.

But maybe I'm missing something - how can I reliably check if there is
a negative form of an option, and if, if the option is the negative form?

> (Actually, maybe the smallest PIC status should win - i.e. if any object
> is not PIC then the final code can be presumed to be non-PIC.)
>
> (Using Negative in .opt files for groups of options such as -fPIC/-fpic
> would ensure that at most one survives from any one object, but you still
> need to work out what you want to do for merging.)

Sure - I suppose we can fix that as a followup - the patch tries to do what
we do now, just at a different place (the driver).  Thus I tried to preserve
all bugs as well ;)

Richard.

> --
> Joseph S. Myers
> joseph@codesourcery.com
>



More information about the Gcc-patches mailing list