diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-06-22 21:17:56 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2020-01-18 14:56:37 +0100 |
commit | a0323937ff4b36594e26b5c1a143af188c75abfc (patch) | |
tree | c72205ba55e37fe8bdc934b52097dd8074cbac13 /configure.ac | |
parent | 68c934c08401d1edbd89746dd0d554d7fc80665b (diff) |
support Clang's -fmodules-codegen/debuginfo options for PCH building
These (starting with my patches for Clang-to-be-10) allowing emitting
debuginfo and functions into a dedicated object file, so that all
the normal compilations using the PCH can skip those, thus saving
the time. The debuginfo option seems to always be worth it. The codegen
option is more tricky, it doesn't seem to be worth it for optimized
builds (optimizing all the functions in that one object file costs
too much).
This requires also using --Wl,--gc-sections . The reason is that
the object file contains all template instances instantiated from the PCH,
so that they can be shared, but the template instance may come
from another library or use a private symbol from that library.
For example the std::unique_ptr<ScInterpreterContext>
in ScInterpreterContextPool in the header refers to ScInterpreterContext
dtor. But even though both these classes are private, the header
gets used also by scfilt, because there it is included by document.hxx
because of a private ScDocument data member. So even though nothing
in scfilt uses ScInterpreterContext, the PCH object file will refer to it.
Fortunately that template instance itself is not used by scfilt,
so --gc-sections will remove it.
Change-Id: I2a06ebcc4dd4175424b3a72ab3ebcaf2ac3ee295
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87011
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 1f7eb690b6cc..5b9fd601ef9e 100644 --- a/configure.ac +++ b/configure.ac @@ -5202,6 +5202,37 @@ if test -n "$ENABLE_PCH"; then fi AC_SUBST(BUILDING_PCH_WITH_OBJ) +PCH_MODULES_CODEGEN= +if test -n "$BUILDING_PCH_WITH_OBJ"; then + AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-codegen]) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror -Xclang -fmodules-codegen" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_CODEGEN="-Xclang -fmodules-codegen" ],[]) + CFLAGS=$save_CFLAGS + if test -n "$PCH_MODULES_CODEGEN"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + CFLAGS=$save_CFLAGS +fi +AC_SUBST(PCH_MODULES_CODEGEN) +PCH_MODULES_DEBUGINFO= +if test -n "$BUILDING_PCH_WITH_OBJ"; then + AC_MSG_CHECKING([whether $CC supports -Xclang -fmodules-debuginfo]) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror -Xclang -fmodules-debuginfo" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_MODULES_DEBUGINFO="-Xclang -fmodules-debuginfo" ],[]) + CFLAGS=$save_CFLAGS + if test -n "$PCH_MODULES_DEBUGINFO"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + CFLAGS=$save_CFLAGS +fi +AC_SUBST(PCH_MODULES_DEBUGINFO) + TAB=`printf '\t'` AC_MSG_CHECKING([the GNU Make version]) |