[libc-commits] [libc] 214be9d - [libc] Add compile options to pthread_create target.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Thu Jun 9 10:26:49 PDT 2022
Author: Siva Chandra Reddy
Date: 2022-06-09T17:26:19Z
New Revision: 214be9d1cd1601a5b4f8c1b598c3264affdbcc0a
URL: https://github.com/llvm/llvm-project/commit/214be9d1cd1601a5b4f8c1b598c3264affdbcc0a
DIFF: https://github.com/llvm/llvm-project/commit/214be9d1cd1601a5b4f8c1b598c3264affdbcc0a.diff
LOG: [libc] Add compile options to pthread_create target.
The compile options now match that of thrd_create. Two compile options
are of importance:
1. -O3 - This is required so that stack is not used between the clone
syscall and the start function in the child thread.
2. -fno-omit-frame-pointer - This is required so that we can sniff out
the thread start args from the child thread's stack memory.
Without these two options, pthread_create will exhibit flaky behavior.
Reviewed By: lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D127381
Added:
Modified:
libc/src/pthread/CMakeLists.txt
Removed:
################################################################################
diff --git a/libc/src/pthread/CMakeLists.txt b/libc/src/pthread/CMakeLists.txt
index 828fee219a5c1..d44eef057d320 100644
--- a/libc/src/pthread/CMakeLists.txt
+++ b/libc/src/pthread/CMakeLists.txt
@@ -253,6 +253,9 @@ add_entrypoint_object(
libc.include.errno
libc.include.pthread
libc.src.__support.threads.thread
+ COMPILE_OPTIONS
+ -O3
+ -fno-omit-frame-pointer
)
add_entrypoint_object(
More information about the libc-commits
mailing list