[libc] Add compile options to pthread_create target.
authorSiva Chandra Reddy <sivachandra@google.com>
Thu, 9 Jun 2022 06:40:55 +0000 (06:40 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Thu, 9 Jun 2022 17:26:19 +0000 (17:26 +0000)
commit214be9d1cd1601a5b4f8c1b598c3264affdbcc0a
tree53a722428aa39c9ca5bc73cd0af24a247aaead48
parent0bff6a3e3913d389bdf8fad4767ae92779cdf1c3
[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
libc/src/pthread/CMakeLists.txt