[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
Thu Oct 15 10:46:31 PDT 2020


phosek added a comment.

In D85802#2332766 <https://reviews.llvm.org/D85802#2332766>, @rnk wrote:

> In D85802#2331403 <https://reviews.llvm.org/D85802#2331403>, @leonardchan wrote:
>
>> Perhaps we can add some mechanism in Clang that determines which ABIs are supported for specific platforms? That is, when targetting Linux, Clang will diagnose an error if using `-fc++-abi=microsoft`. This could cover the case where a specific platform can support multiple ABIs, but those ABIs won't be supported by other platforms.
>
> Right, but the simplest code is the code that doesn't exist: if the option doesn't exist, there's no need to diagnose anything. The rest of the "C++ ABIs" aren't really their own C++ ABIs, they are just a reflection of the target triple.
>
> What is the actual use case? I read the RFC, but ever since I became a manager, my reading comprehension level dropped back to grade school, and I apologize for that. As I understood it, you need a flag that enables all the Itanium ABI extensions (relative vtables, and others) used in Fuchsia, at once. A single relative vtable ABI flag isn't sufficient (would it be?).

We want to use Fuchsia C++ ABI by default when targeting Fuchsia. Fuchsia C++ ABI is a derivate of Itanium C++ ABI with various performance optimizations (similar to other derivative C++ ABIs like WebAssembly), and we plan on further evolving it, for example always using relative vtables. The problem is that we occasionally need to integrate code built with Clang with code produced by other compilers that don't support Fuchsia C++ ABI like GCC, so we would like to have an option to switch back to Itanium C++ ABI as the "legacy compatible" C++ ABI.


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