[Bug pch/71934] pch cannot be disabled so gcc cannot be position independent

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 2 13:39:51 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71934

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---

> Actually you could exactly what is done for darwin targets to get it working on PIE.

Darwin does the same as Linux - disables PIE for the $host build (although PIE
is the default for Darwin for a long time).

 - Making PCH position independent is probably a larger job than extending the
modules tree streamer to replace it (neither is a trivial activity).

> Now having PCH around might not be useful anyways.  Someone would have to check to see if anyone uses PCH still.

- a) I don't see that anything has changed to make the value go down - quite
the opposite, headers have become larger and more complex and parsing has only
increased in load.

- b) There are build recipes in the wild that use it, ripping it out would need
to be done in a way that didn't break such recipes.

> There should really be a build-time option to make gcc completely ignore the existence of .gch files and fallback to the normal headers as if they didn't exist.

This would be useful; I have a Darwin platform version that is forbidden to be
no-PIE so that PCH is disabled by local patches, I might look into a configure
option***, but see (b) above about simple removal - we'd have to figure out
what to do with command lines that depend on it.

> so, GCC has module support now...

GCC has experimental modules support with some bugs.
modules suppport is not a direct replacement for PCH (e.g. it only works with
>= C++20 and not with the other c-family FEs at all).

As noted above, though, it would seem likely that the modules tree streamer
could be generalised to support some kind of FE hook that allowed each of the
FEs to stream their own specific trees ...  but none of this is a trivial
undertaking.

*** I'll put this on my TODO for aarch64-darwin.


More information about the Gcc-bugs mailing list