llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Roland McGrath (frobtech) <details> <summary>Changes</summary> This establishes a new canonical predefine for *-fuchsia targets: `__Fuchsia_Compiler_ABI__` is set to an integer for the version number of the Fuchsia Compiler ABI the compiler supports. The value will change as appropriate with changes to *-fuchsia target ABI expectations. It is not anticipated that the compiler will support selecting target ABI versions, only the latest as the canonical target-specific behavior. Fuchsia Compiler ABI versions are unrelated to the Fuchsia API levels supported by Fuchsia systems; newly-built programs may target older API levels with `-ffuchsia-api-level`, but everything relying on the Fuchsia Compiler ABI is built and deployed together as an isolated unit. --- Full diff: https://github.com/llvm/llvm-project/pull/211744.diff 2 Files Affected: - (modified) clang/lib/Basic/Targets/OSTargets.cpp (+19) - (modified) clang/test/Preprocessor/init-fuchsia.c (+1) ``````````diff diff --git a/clang/lib/Basic/Targets/OSTargets.cpp b/clang/lib/Basic/Targets/OSTargets.cpp index 915cd566ed6e4..04d9e13d3c9a6 100644 --- a/clang/lib/Basic/Targets/OSTargets.cpp +++ b/clang/lib/Basic/Targets/OSTargets.cpp @@ -306,6 +306,25 @@ void getFuchsiaDefines(MacroBuilder &Builder, const LangOptions &Opts, if (Opts.CPlusPlus) Builder.defineMacro("_GNU_SOURCE"); Builder.defineMacro("__Fuchsia_API_level__", Twine(Opts.FuchsiaAPILevel)); + + // __Fuchsia_Compiler_ABI__ gives the version of the Fuchsia Compiler ABI + // supported by the compiler. This is a single small integer that increases + // monotonically for any kinds of ABI change, across any of the supported + // machines, and including language-specific ABI aspects such as the Fuchsia + // variant of the Itanium C++ ABI. Changes affecting just one machine and/or + // just one language will cause this single number to advance regardless. + // + // * Version 0 is the original Fuchsia Compiler ABI. + // - Custom SafeStack ABI on every machine + // - ShadowCallStack ABI on aarch64, riscv64 + // - Itanium C++ ABI as modified: ctor/dtor return value; relative vtables + // + // * Version 1 is first iteration formalizing the version number scheme. + // - SafeStack ABI no longer supported on aarch64, riscv64 (x86 only) + // + // The predefine can be checked by code relying on the Fuchsia Compiler ABI + // to ensure that a compiler new enough for the required version is in use. + Builder.defineMacro("__Fuchsia_Compiler_ABI__", Twine(1)); } } // namespace targets diff --git a/clang/test/Preprocessor/init-fuchsia.c b/clang/test/Preprocessor/init-fuchsia.c index 057218711b8b2..04b5ef573cc07 100644 --- a/clang/test/Preprocessor/init-fuchsia.c +++ b/clang/test/Preprocessor/init-fuchsia.c @@ -9,3 +9,4 @@ // FUCHSIA-DAG: #define __Fuchsia__ 1 // FUCHSIA-DAG: #define __Fuchsia_API_level__ {{[0-9]+}} +// FUCHSIA-DAG: #define __Fuchsia_Compiler_ABI__ 1 `````````` </details> https://github.com/llvm/llvm-project/pull/211744 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
