[cfe-dev] [RFC][Clang] Flag for Switching between C++ ABIs

Leonard Chan via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 5 16:11:10 PDT 2020


Hi all,

We would like to propose a new frontend flag for Clang that would switch
between different C++ ABIs. Right now, Fuchsia is in the process of
switching between the Itanium C++ ABI and the Fuchsia C++ ABI, which would
include Relative VTables <https://reviews.llvm.org/D72959>. We would find
it useful to have a single generic compiler flag that would select between
the target’s default ABI and other ABIs.

The flag would look something like `-fc++-abi=` and override the default
C++ ABI selected by the target. It's up to the user to make sure that the
ABI and target combination makes sense.

We think this would be useful for applications that want to migrate away
from Itanium or experiment with other ABIs that their platform supports.
With this flag, the only thing we would ideally need to change in our build
would be adding `-fc++-abi=fuchsia` as a compile flag, and this would
switch on any features we want to ship with the new Fuchsia C++ ABI.

Implementation-wise, there already exists an enum in TargetCXXABI
<https://github.com/llvm/llvm-project/blob/8bee52bdb54a51ccfe1eb6c6ed5077132c2950a1/clang/include/clang/Basic/TargetCXXABI.h#L26>
that contains different ABIs, so we can expose them through this flag. More
values can be added in the future to represent new experimental ABIs, such
as Itanium V2.

Thoughts and opinions? Nothing here is set in stone and we welcome feedback.

Thanks,

Leonard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200805/3d0b96cc/attachment-0001.html>


More information about the cfe-dev mailing list