Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mangling extension for C++20 Modules #134

Open
urnathan opened this issue Jan 27, 2022 · 3 comments
Open

Mangling extension for C++20 Modules #134

urnathan opened this issue Jan 27, 2022 · 3 comments

Comments

@urnathan
Copy link
Contributor

Both GCC and Clang added mangling for c++20 module purview symbols. While we tried to do the same thing, we failed :( It also turns out the scheme we designed is undemangleable. Plus the modules-ts evolved.

Here is a newer scheme: https://drive.google.com/file/d/1qQjqptzOFT_lfXH8L6-iD9nCRi34wjft/view?usp=sharing

  1. is demangleable
  2. changes to the strong-ownership model
  3. Addresses issue P1874: Dynamic Initialization Order of Non-Local Variables in Modules #99
urnathan added a commit to llvm/llvm-project that referenced this issue Mar 8, 2022
The existing module symbol mangling scheme turns out to be
undemangleable.  It is also desirable to switch to the
strong-ownership model as the hoped-for C++17 compatibility turns out
to be fragile, and we also now have a better way of controlling that.

The issue is captured on the ABI list at:
  itanium-cxx-abi/cxx-abi#134

A document describing the issues and new mangling is at:
  https://drive.google.com/file/d/1qQjqptzOFT_lfXH8L6-iD9nCRi34wjft/view

This patch is the code-generation part.  I have a demangler too, but
that patch is based on some to-be-landed refactoring of the demangler.

The old mangling is unceremoniously dropped.  No backwards
compatibility, no deprectated old-mangling flag.  It was always
labelled experimental.  (Old and new manglings cannot be confused.)

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D118352
urnathan added a commit to llvm/llvm-project that referenced this issue Mar 30, 2022
Implement a demangleable strong ownership symbol mangling.

 * The original module symbol mangling scheme turned out to be
undemangleable.

 * The hoped-for C++17 compatibility of weak ownership turns out to be
fragile

* C++20 now has better ways of controlling C++17 compatibility

The issue is captured on the ABI list at:
  itanium-cxx-abi/cxx-abi#134

GCC implements this new mangling.

The old mangling is unceremoniously dropped.  No backwards
compatibility, no deprectated old-mangling flag.  It was always
labelled experimental.  (Old and new manglings cannot be confused.)

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D122256
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
Implement a demangleable strong ownership symbol mangling.

 * The original module symbol mangling scheme turned out to be
undemangleable.

 * The hoped-for C++17 compatibility of weak ownership turns out to be
fragile

* C++20 now has better ways of controlling C++17 compatibility

The issue is captured on the ABI list at:
  itanium-cxx-abi/cxx-abi#134

GCC implements this new mangling.

The old mangling is unceremoniously dropped.  No backwards
compatibility, no deprectated old-mangling flag.  It was always
labelled experimental.  (Old and new manglings cannot be confused.)

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D122256
@tchaikov
Copy link

the referenced google document

Both GCC and Clang added mangling for c++20 module purview symbols. While we tried to do the same thing, we failed :( It also turns out the scheme we designed is undemangleable. Plus the modules-ts evolved.

Here is a newer scheme: https://drive.google.com/file/d/1qQjqptzOFT_lfXH8L6-iD9nCRi34wjft/view?usp=sharing

hello,

the referenced google document is not reachable anymore. was it moved / removed ?

  1. is demangleable
  2. changes to the strong-ownership model
  3. Addresses issue P1874: Dynamic Initialization Order of Non-Local Variables in Modules #99

@ChuanqiXu9
Copy link

ChuanqiXu9 commented Jan 11, 2024

@urnathan hi, would you like to send the documentation again? This is somewhat embrassing that the implementation were already merged into GCC and Clang but the document doesn't merge into the Itanium C++ ABI specification... so they is the status quo standard now. I think it may be better to summarize them into the ABI specification formally.

CC @rjmccall I found this when I try to summarize the ABI related things with modules

@urnathan
Copy link
Contributor Author

urnathan commented Jan 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants