[PATCH] D119409: [C++20] [Modules] Remain dynamic initializing internal-linkage variables in module interface unit

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 27 19:30:53 PDT 2022


ChuanqiXu added a comment.

In D119409#3409806 <https://reviews.llvm.org/D119409#3409806>, @iains wrote:

> I think that this problem might well be a consequence of the bug which is fixed by D122413 <https://reviews.llvm.org/D122413>.
>
> We have been generating code with module internal entities (always) given the special ModuleInternalLinkage (which means that, although the linkage is formally 'internal', the entities are made global when emitted.  We should only be doing this for fmodules-ts, not for regular standard modules.
>
> If you apply D122413 <https://reviews.llvm.org/D122413> (which I hope to land soon), then I would expect that iostream should work as expected (with one internal instance of std::__ioinit in each TU that includes iostream).
>
> IFF (after applying D122413 <https://reviews.llvm.org/D122413> ) you add to the command line -fmodules-ts, then the patch here (D119409 <https://reviews.llvm.org/D119409>) would, presumably, be needed to work around multiple instances of the globalised std::__ioinit.

Sadly it wouldn't work after D122413 <https://reviews.llvm.org/D122413> applied. Since the <iostream> is lived in GlobalModuleFragment, the calculated linkage wouldn't affect them. So I met the same segfault as before.

> addendum: note we still have work to do on the module initialisers - those are not correct yet (so probably some nesting of modules might not work).

What does the nesting of modules mean?


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

https://reviews.llvm.org/D119409



More information about the cfe-commits mailing list