https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121614
--- Comment #5 from mtxn at duck dot com <mtxn at duck dot com> --- (In reply to Nathaniel Shead from comment #4) > 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. Thank you for your explanation! I would try to make a feature request for gcc to add an option to check whether CMI is included in the archive with object (also not yet implemented "module : private;" may work in a similar way); this addition makes sense for me but I'm not sure if It's good idea to make suggestion or request like this.