[PATCH 0/4] config: Allow a host to opt out of PCH.

Iain Sandoe iains.gcc@gmail.com
Thu Nov 4 20:02:14 GMT 2021

GCC (currently) has an implementation of pre-compiled-headers, that relies
on being able to launch the compiler executable at the same address each
time.  This constraint is not permitted by some system security models.

The facility is an optimisation; saving the output of parsing a covering
header file (that may include many others) so that the parsing need not be
repeated when the same set of headers is needed in many places in a project.

The patch series disables the operation of the PCH-related command lines,
but does not cause an error to be emitted.  The intent is that build
recipes that expect PCH to work will continue to operate, but the compiler
no longer acts on them and therefore is no longer bound to the requirement
to launch at a fixed address.

 * When invoked to "generate PCH" the compiler will carry out the parsing
   as before - producing any diagnostics if relevant and then saving a
   stub file (to satisfy build recipe targets).  The stub file is marked as
   invalid PCH.

 * When an include directive is encountered, the compiler no longer checks
   to see if a PCH header is available.

 * The top-level configure option (--disable-host-pch-support) is also
   propagated to libstdc++ where it causes the automatic invocation of the
   existing --disable-libstdxx-pch.

tested on x86_64-darwin, aarch64-darwin, and on x86_64, powerpc64le-linux,
OK for master?

Iain Sandoe (4):
  config: Add top-level flag to disable host PCH.
  libstdc++: Adjust build of PCH files accounting configured host
  libcpp: Honour a configuration without host support for PCH.
  c-family, gcc: Allow configuring without support for PCH.

 Makefile.def              |  9 ++--
 Makefile.in               | 87 +++++++++++++++++++++++++--------------
 configure                 | 42 +++++++++++++++++++
 configure.ac              | 35 ++++++++++++++++
 gcc/c-family/c-pch.c      | 23 ++++++++++-
 gcc/config.in             |  6 +++
 gcc/config/host-darwin.c  | 18 ++++++++
 gcc/configure             | 29 ++++++++++++-
 gcc/configure.ac          | 17 ++++++++
 gcc/doc/install.texi      |  6 +++
 libcpp/config.in          |  3 ++
 libcpp/configure          | 24 +++++++++++
 libcpp/configure.ac       | 16 +++++++
 libcpp/files.c            | 14 +++++++
 libcpp/pch.c              | 12 ++++++
 libstdc++-v3/acinclude.m4 | 49 +++++++++++++---------
 libstdc++-v3/configure    | 71 +++++++++++++++++++++-----------
 libstdc++-v3/configure.ac | 11 ++++-
 18 files changed, 391 insertions(+), 81 deletions(-)

2.24.3 (Apple Git-128)

More information about the Gcc-patches mailing list