[libc-commits] [libc] 94c1248 - Revert "[libc][cmake] Respect the configured optimization level for the Linux thread and TLS objects" (#236604)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 29 03:33:01 PDT 2026


Author: Alexey Samsonov
Date: 2026-10-29T11:32:56+01:00
New Revision: 94c12484c59df6007e79d47960be247e82d56436

URL: https://github.com/llvm/llvm-project/commit/94c12484c59df6007e79d47960be247e82d56436
DIFF: https://github.com/llvm/llvm-project/commit/94c12484c59df6007e79d47960be247e82d56436.diff

LOG: Revert "[libc][cmake] Respect the configured optimization level for the Linux thread and TLS objects" (#236604)

Reverts llvm/llvm-project#234382

See discussion in the PR thread - removing `-O3` from TLS initialization
and thread exiting code leads to crashes (from callee functions that are
build with stack protection enabled, or from accessing the local
variables after the stack is unmapped).

Co-authored-by: Prabhu Rajasekaran <prabhukrllvm at gmail.com>

Added: 
    

Modified: 
    libc/src/__support/threads/linux/CMakeLists.txt
    libc/src/__support/threads/linux/aarch64/CMakeLists.txt
    libc/src/__support/threads/linux/riscv/CMakeLists.txt
    libc/src/__support/threads/linux/x86_64/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/threads/linux/CMakeLists.txt b/libc/src/__support/threads/linux/CMakeLists.txt
index 2e539d4895835b..a8bcbae5b08dd7 100644
--- a/libc/src/__support/threads/linux/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/CMakeLists.txt
@@ -90,6 +90,8 @@ add_object_library(
     libc.src.__support.OSUtil.linux.syscall_wrappers.write
     libc.src.__support.threads.thread_common
     libc.src.__support.threads.thread_attributes
+  COMPILE_OPTIONS
+    ${libc_opt_high_flag}
 )
 
 add_header_library(

diff  --git a/libc/src/__support/threads/linux/aarch64/CMakeLists.txt b/libc/src/__support/threads/linux/aarch64/CMakeLists.txt
index a2320f8d015c38..e6e92d814cc0a8 100644
--- a/libc/src/__support/threads/linux/aarch64/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/aarch64/CMakeLists.txt
@@ -13,6 +13,7 @@ add_object_library(
     libc.src.__support.threads.linux.tcb
     libc.src.string.memory_utils.inline_memcpy
   COMPILE_OPTIONS
+    ${libc_opt_high_flag}
     -fno-stack-protector
     -fno-omit-frame-pointer
     -ffreestanding

diff  --git a/libc/src/__support/threads/linux/riscv/CMakeLists.txt b/libc/src/__support/threads/linux/riscv/CMakeLists.txt
index a2320f8d015c38..e6e92d814cc0a8 100644
--- a/libc/src/__support/threads/linux/riscv/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/riscv/CMakeLists.txt
@@ -13,6 +13,7 @@ add_object_library(
     libc.src.__support.threads.linux.tcb
     libc.src.string.memory_utils.inline_memcpy
   COMPILE_OPTIONS
+    ${libc_opt_high_flag}
     -fno-stack-protector
     -fno-omit-frame-pointer
     -ffreestanding

diff  --git a/libc/src/__support/threads/linux/x86_64/CMakeLists.txt b/libc/src/__support/threads/linux/x86_64/CMakeLists.txt
index cfd58503320086..0b49ca2c7e6e33 100644
--- a/libc/src/__support/threads/linux/x86_64/CMakeLists.txt
+++ b/libc/src/__support/threads/linux/x86_64/CMakeLists.txt
@@ -14,6 +14,7 @@ add_object_library(
     libc.src.__support.threads.linux.tcb
     libc.src.string.memory_utils.inline_memcpy
   COMPILE_OPTIONS
+    ${libc_opt_high_flag}
     -fno-stack-protector
     -fno-omit-frame-pointer
     -ffreestanding


        


More information about the libc-commits mailing list