[PATCH] D69778: Make -fmodules-codegen and -fmodules-debuginfo work also with precompiled headers

Luboš Luňák via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 15:08:11 PDT 2020


llunak added a comment.

In D69778#1927526 <https://reviews.llvm.org/D69778#1927526>, @dblaikie wrote:

> @rnk  - know anything about the history of -building-pch-with-obj and whether it could be replaced/merged with -fmodules-codegen? (-fmodules-codegen + -fmodules-debuginfo, perhaps?)


It comes from 08c5a7b8fda1b97df9d027d1ac096f93edeb6c2f . AFAICT -fmodules-codegen is a superset of -building-pch-with-obj, the important difference is that -building-pch-with-obj decides which code will be shared while building TUs, while -fmodules-codegen decides while building the PCH. This in practice means that -building-pch-with-obj shares only code that would be actually used, which makes the result easier to use - using PCH with -fmodules-codegen pretty much requires something like -Wl,--gc-sections, otherwise there are many undefined references to internal symbols from other libraries caused by emitted code that isn't actually used. Since -building-pch-with-obj is internally used by clang-cl /Yc , -fmodules-codegen cannot be a drop-in replacement for it, unless the Microsoft linker automatically discards unused symbols (I don't know, no idea about Windows stuff).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69778/new/

https://reviews.llvm.org/D69778





More information about the cfe-commits mailing list