Skip to content

Conversation

@petrhosek
Copy link
Member

These flags are not needed for building libc.

These flags are not needed for building libc.
@llvmbot llvmbot added the libc label Nov 20, 2025
@petrhosek petrhosek enabled auto-merge (squash) November 20, 2025 20:37
@llvmbot
Copy link
Member

llvmbot commented Nov 20, 2025

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

Changes

These flags are not needed for building libc.


Full diff: https://github.com/llvm/llvm-project/pull/168942.diff

3 Files Affected:

  • (modified) libc/cmake/caches/armv6m-none-eabi.cmake (+1-1)
  • (modified) libc/cmake/caches/armv7em-none-eabi.cmake (+1-1)
  • (modified) libc/cmake/caches/armv7m-none-eabi.cmake (+1-1)
diff --git a/libc/cmake/caches/armv6m-none-eabi.cmake b/libc/cmake/caches/armv6m-none-eabi.cmake
index 1f463ae5c0ead..d1d614655e557 100644
--- a/libc/cmake/caches/armv6m-none-eabi.cmake
+++ b/libc/cmake/caches/armv6m-none-eabi.cmake
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
 set(RUNTIMES_TARGET_TRIPLE "armv6m-none-eabi" CACHE STRING "")
 
 foreach(lang C;CXX;ASM)
-    set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
+    set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
 endforeach()
 
 include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)
diff --git a/libc/cmake/caches/armv7em-none-eabi.cmake b/libc/cmake/caches/armv7em-none-eabi.cmake
index afbe9c87dffe1..2b6df8fdf40ab 100644
--- a/libc/cmake/caches/armv7em-none-eabi.cmake
+++ b/libc/cmake/caches/armv7em-none-eabi.cmake
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
 set(RUNTIMES_TARGET_TRIPLE "armv7em-none-eabi" CACHE STRING "")
 
 foreach(lang C;CXX;ASM)
-    set(CMAKE_${lang}_FLAGS "-march=armv7em -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
+    set(CMAKE_${lang}_FLAGS "-march=armv7em -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
 endforeach()
 
 include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)
diff --git a/libc/cmake/caches/armv7m-none-eabi.cmake b/libc/cmake/caches/armv7m-none-eabi.cmake
index 796adb2f31148..fe76828fa529f 100644
--- a/libc/cmake/caches/armv7m-none-eabi.cmake
+++ b/libc/cmake/caches/armv7m-none-eabi.cmake
@@ -2,7 +2,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
 set(RUNTIMES_TARGET_TRIPLE "armv7m-none-eabi" CACHE STRING "")
 
 foreach(lang C;CXX;ASM)
-    set(CMAKE_${lang}_FLAGS "-march=armv7m -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
+    set(CMAKE_${lang}_FLAGS "-march=armv7m -mcpu=cortex-m4 -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
 endforeach()
 
 include(${CMAKE_CURRENT_LIST_DIR}/baremetal_common.cmake)

@petrhosek petrhosek merged commit 91e777f into llvm:main Nov 20, 2025
26 of 27 checks passed
@github-actions
Copy link

🐧 Linux x64 Test Results

The build succeeded and no tests ran. This is expected in some build configurations.


foreach(lang C;CXX;ASM)
set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dfputs(string, stream)=puts(string)\" -D_LIBCPP_PRINT=1" CACHE STRING "")
set(CMAKE_${lang}_FLAGS "-march=armv6m -mcpu=cortex-m0plus -mfloat-abi=soft -Wno-atomic-alignment" CACHE STRING "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bikeshedding a bit, but why do we need -Wno-atomic-alignment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because we use atomics for some internal API and there's no support unaligned accesses on Cortex-M0, but it's not a problem in practice because we don't do any unaligned accesses. We expect this will eventually get resolved by switching to TLS but we haven't had time to implement it yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like clang shouldn't emit this warning for targets that don't support unaligned atomic accesses?

Not sure about the implementation (ie whether warnings can be target specific, how we would plumb information about the target, etc).

aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants