On Sat, Oct 03, 2015 at 05:17:53PM +0900, Oleg Endo wrote: > On Sat, 2015-10-03 at 00:50 -0400, Rich Felker wrote: > > > I have -mfdpic in the self-specs when FDPIC_DEFAULT is defined, so I > > think only the positive form is needed. > > Having positive and negative forms for options makes sense. It usually > costs nothing because anyway the compiler internally supports both and > it allows special-casing if one of them is the default, which can be > useful for testing.
What I'm saying is that the self-specs approach to FDPIC_DEFAULT has the compiler driver adding -mfdpic to its own command line (via %{!mno-fdpic:-mfdpic}) when FDPIC_DEFAULT is defined. This allows other specs simply to test %{mfdpic:...} rather than having complex separate forms depending on whether FDPIC_DEFAULT is defined. The negative form is of course supported too (and suppresses the self-spec addition of -mfdpic). I'm not sure if this approach is acceptable upstream in gcc. I like it a lot better because it isolates this kind of logic as described above rather than having it spread out all over the place in error-prone ways. I had a several-line patch for default-pie support that worked via self-specs too; the one that was actually committed to gcc was hugely invasive across many files including most targets... Rich