[PATCH] D85802: [clang] Add -fc++-abi= flag for specifying which C++ ABI to use

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 13:06:34 PDT 2022


phosek added a comment.

In D85802#3862954 <https://reviews.llvm.org/D85802#3862954>, @rjmccall wrote:

> I suspect the Fuchsia project is not in fact volunteering to maintain a port of every imaginable C++ ABI to Fuchsia.  (Many of these "ABIs" are specifically stuff like "the Itanium ABI as modified for iOS ARM64" and are not really portable anyway.)  You may be interested in supporting multiple C++ ABI variants, but you've still got a list, and it's not even a very long list.  So we can support this driver option, but we can lock it down to Fuchsia (or any other OSes in the future that want to support multiple ABIs), and we can lock down the options it allows.
>
> I would like to know how you build multilib across C++ ABIs, though.  My (admittedly weak) understanding was that ELF multilib support was just based on arch strings.

We use the multilib support that exists in the bootstrapping build:

https://github.com/llvm/llvm-project/blob/d8af31ecede0c54ec667ab687784149e806c9e4c/clang/cmake/caches/Fuchsia-stage2.cmake#L196
https://github.com/llvm/llvm-project/blob/d8af31ecede0c54ec667ab687784149e806c9e4c/clang/lib/Driver/ToolChains/Fuchsia.cpp#L266

In D85802#3863015 <https://reviews.llvm.org/D85802#3863015>, @rjmccall wrote:

> Okay.  So Fuchsia multilib support uses a lot of more fine-grained options rather than being arch-driven?

Yes, see https://github.com/llvm/llvm-project/blob/d8af31ecede0c54ec667ab687784149e806c9e4c/clang/lib/Driver/ToolChains/Fuchsia.cpp#L218

The multilib support is used pretty extensively by the GNU driver to match GCC, see https://github.com/llvm/llvm-project/blob/d8af31ecede0c54ec667ab687784149e806c9e4c/clang/lib/Driver/ToolChains/Gnu.cpp#L2624.

Fuchsia as far as I'm aware is the only target that uses multilib support to switch the C++ ABI (through the `-fc++abi=` flag).

> Can you elaborate about "each target"?  Were you anticipating this being a broader feature outside of Fuchsia, or does Fuchsia actually encompass multiple OS targets?

I believe that "each target" in that context meant targets other than Fuchsia.

For Fuchsia, I expect that we'll only ever need the Fuchsia C++ ABI (the default) and Itanium C++ ABI (for compatibility with code built with GCC). If GCC ever gains the support for Fuchsia C++ ABI, then we wouldn't need to support Itanium C++ ABI at all.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85802



More information about the cfe-commits mailing list