[libc-commits] [libc] [llvm] [libc][OSUtil] refactor quick_exit to be an object library everywhere (PR #85955)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Mar 22 08:32:55 PDT 2024


================
@@ -22,14 +17,12 @@ namespace LIBC_NAMESPACE {
 #ifdef LIBC_TARGET_ARCH_IS_X86
 __attribute__((no_stack_protector))
 #endif
-LIBC_INLINE void
-quick_exit(int status) {
+__attribute__((noreturn))
+void quick_exit(int status) {
----------------
nickdesaulniers wrote:

[presubmit failure](https://buildkite.com/llvm-project/github-pull-requests/builds/49514#018e62f3-9c12-4483-9ee1-1f37a522324e)

> -- The C compiler identification is Clang 16.0.6
> llvm-project/github-pull-requests/libc/src/__support/OSUtil/linux/quick_exit.cpp:18:3: error: unknown attribute 'no_stack_protector' ignored [-Werror,-Wunknown-attributes]
[[gnu::no_stack_protector]]
  ^~~~~~~~~~~~~~~~~~~~~~~

So ironically, `no_stack_protector` was a function attribute in clang first, then GCC added support, then clang had to match the `gnu::` prefix later.  GCC does not recognize the `clang::` attribute prefix.  All the issues with compiler version compatibility are avoided by just using the GNU C extension syntax for attributes.

So I'm going to revert https://github.com/llvm/llvm-project/pull/85955/commits/9ceeba4d5d7db1d58eeea33c31e46e9c5aea60a1.

https://github.com/llvm/llvm-project/pull/85955


More information about the libc-commits mailing list