https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121614
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED CC| |nshead at gcc dot gnu.org --- Comment #4 from Nathaniel Shead <nshead at gcc dot gnu.org> --- Hi, thanks for the report! The issue looks to be with the Makefile, GCC is behaving correctly here. A module TU also should produce an object file which has code emitted into it; in this case, the ABI says that we should be emitting vtables and typeinfo into the object file for 'foo.ccm', see https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable: > Virtual tables for dynamic classes are emitted as follows: > > - If the class is templated, the tables are emitted in every > object that references any of them. > - Otherwise, if the class is attached to a module, the tables > are uniquely emitted in the object for the module unit in > which it is defined. > - [...] By producing an object file for foo.ccm (i.e. not passing -fmodule-only) and linking that into your executable you should get a working build. Note that this means that there are *two* outputs from building a module: the object file, with definitions emitted into it, and the module CMI. You can use a module mapper (see https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html) to customise where the CMI is built, otherwise gcm.cache/modname.gcm is the default location.