[libc-commits] [PATCH] D127381: [libc] Add compile options to pthread_create target.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 9 00:06:05 PDT 2022


sivachandra created this revision.
sivachandra added reviewers: lntue, michaelrj.
Herald added subscribers: libc-commits, ecnelises, tschuett, mgorny.
Herald added projects: libc-project, All.
sivachandra requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127381

Files:
  libc/src/pthread/CMakeLists.txt


Index: libc/src/pthread/CMakeLists.txt
===================================================================
--- libc/src/pthread/CMakeLists.txt
+++ libc/src/pthread/CMakeLists.txt
@@ -253,6 +253,9 @@
     libc.include.errno
     libc.include.pthread
     libc.src.__support.threads.thread
+  COMPILE_OPTIONS
+    -O3
+    -fno-omit-frame-pointer
 )
 
 add_entrypoint_object(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127381.435434.patch
Type: text/x-patch
Size: 374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20220609/d3cae674/attachment.bin>


More information about the libc-commits mailing list