[libc-commits] [libc] [libc][NFC] Workaround for environ_internal when building with gcc-12. (PR #196471)
via libc-commits
libc-commits at lists.llvm.org
Thu May 7 22:30:18 PDT 2026
https://github.com/lntue created https://github.com/llvm/llvm-project/pull/196471
None
>From 0b36ca0690bbd270894732c0e1bb9d9fc9cd46f7 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Fri, 8 May 2026 05:28:33 +0000
Subject: [PATCH] [libc][NFC] Workaround for environ_internal when building
with gcc-12.
---
libc/src/stdlib/CMakeLists.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index 1185f1a0fa461..7e587235447b0 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -67,12 +67,22 @@ add_entrypoint_object(
.environ_internal
)
+# GCC-12 crashed when building environ_internal during GIMPLE pass: waccess.
+set(environ_internal_gcc12_workaround "")
+if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13"))
+ set(environ_internal_gcc12_workaround "-Wno-stringop-overflow")
+endif()
+
add_object_library(
environ_internal
SRCS
environ_internal.cpp
HDRS
environ_internal.h
+ COMPILE_OPTIONS
+ ${environ_internal_gcc12_workaround}
DEPENDS
libc.config.app_h
libc.hdr.types.size_t
More information about the libc-commits
mailing list