Skip to content

Commit

Permalink
[libc] set -Wno-frame-address for thread.cpp (llvm#77140)
Browse files Browse the repository at this point in the history
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: llvm#77007
  • Loading branch information
nickdesaulniers committed Jan 8, 2024
1 parent ff47989 commit 12101ca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc/src/__support/threads/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 12101ca

Please sign in to comment.