[libc-commits] [libc] [libc] set -Wno-frame-address for thread.cpp (PR #77140)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Fri Jan 5 15:48:27 PST 2024
https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/77140
>From f1b4cee05faf1bec041b57e4f67412b673e18623 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Fri, 5 Jan 2024 13:23:01 -0800
Subject: [PATCH] [libc] set -Wno-frame-address for thread.cpp
The aarch64 code is using __builtin_return_address with a non-zero parameter,
which generates the following warning:
llvm-project/libc/src/__support/threads/linux/thread.cpp:171:38: error:
calling '__builtin_frame_address' with a nonzero argument is unsafe
[-Werror,-Wframe-address]
171 | return reinterpret_cast<uintptr_t>(__builtin_frame_address(1));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
Disable this diagnostic just for this file so that we can enable -Werror.
Fixes: #77007
---
libc/src/__support/threads/linux/CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libc/src/__support/threads/linux/CMakeLists.txt b/libc/src/__support/threads/linux/CMakeLists.txt
index 642eead7277262..148a0ba061c577 100644
--- a/libc/src/__support/threads/linux/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/CMakeLists.txt
@@ -39,6 +39,8 @@ add_object_library(
-O3
-fno-omit-frame-pointer # This allows us to sniff out the thread args from
# the new thread's stack reliably.
+ -Wno-frame-address # Yes, calling __builtin_return_address with a
+ # value other than 0 is dangerous. We know.
)
add_object_library(
More information about the libc-commits
mailing list