[llvm-branch-commits] [libc] [llvm] Users/vhscampos/libc enable baremetal armv6m tests (PR #243857)

Victor Campos via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 18 05:51:50 PST 2026


https://github.com/vhscampos created https://github.com/llvm/llvm-project/pull/243857

None

>From 7574364ee84a607b578d57b7fb32dd48df5168b4 Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Tue, 17 Nov 2026 12:17:30 +0000
Subject: [PATCH 1/3] [libc] Prepare a new armv6m-none-eabi.cmake to run tests

Create a new CMake cache file in a dedicated Arm-specific folder for
testing configurations. This specific testing configuration is for
Armv6-M.

All the configurations are based on what Arm Toolchain for Embedded uses
for its downstream testing, and are known to work.
---
 .../caches/arm-testing/armv6m-none-eabi.cmake | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 libc/cmake/caches/arm-testing/armv6m-none-eabi.cmake

diff --git a/libc/cmake/caches/arm-testing/armv6m-none-eabi.cmake b/libc/cmake/caches/arm-testing/armv6m-none-eabi.cmake
new file mode 100644
index 00000000000000..a9360fa1cc72e9
--- /dev/null
+++ b/libc/cmake/caches/arm-testing/armv6m-none-eabi.cmake
@@ -0,0 +1,54 @@
+set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
+set(RUNTIMES_TARGET_TRIPLE "armv6m-none-eabi" CACHE STRING "")
+set(LLVM_LIBC_FULL_BUILD ON CACHE BOOL "")
+
+foreach(lang C;CXX;ASM)
+  set(CMAKE_${lang}_FLAGS "-march=armv6-m -mcpu=cortex-m3 -mfloat-abi=soft" CACHE STRING "")
+endforeach()
+
+# Offload the errno definition to libc
+set(LIBC_CONF_ERRNO_MODE LIBC_ERRNO_MODE_SHARED CACHE STRING "")
+# Enable floating-point conversions in printf. This became practical with the
+# introduction of float320.
+set(LIBC_CONF_PRINTF_DISABLE_FLOAT OFF CACHE BOOL "")
+set(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_FLOAT320 ON CACHE BOOL "")
+# Discard unused printf functionality
+set(LIBC_CONF_PRINTF_MODULAR ON CACHE BOOL "")
+
+# Configs for testing and applications are only done if compiler-rt is enabled,
+# as the latter is a dependency for full programs.
+if(compiler-rt IN_LIST LLVM_ENABLE_RUNTIMES)
+  set(LLVM_INCLUDE_TESTS ON CACHE BOOL "")
+  set(LIBC_TEST_BUILTINS_TARGET "clang_rt.builtins-armv6m" CACHE STRING "")
+
+  # Memory mappings
+  set(__boot_flash 0x00000000)
+  set(__boot_flash_size 0x1000)
+  set(__flash 0x21000000)
+  set(__flash_size 0x600000)
+  set(__ram 0x21600000)
+  set(__ram_size 0xA00000)
+  set(__stack_size 0x1000)
+  set(SYMBOLS
+    __boot_flash
+    __boot_flash_size
+    __flash
+    __flash_size
+    __ram
+    __ram_size
+    __stack_size
+  )
+
+  set(DEFSYM_ARGS "")
+  foreach(symbol IN LISTS SYMBOLS)
+    list(APPEND DEFSYM_ARGS "-Wl,--defsym=${symbol}=${${symbol}}")
+  endforeach()
+
+  set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../../../test/UnitTest/llvm-libc-baremetal.ld")
+
+  set(LIBC_TEST_LINK_OPTIONS_DEFAULT "-T;${LINKER_SCRIPT};${DEFSYM_ARGS}" CACHE STRING "")
+
+  set(LIBC_TEST_CMD "qemu-system-arm -M mps2-an385 -cpu cortex-m3 -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -monitor none -serial none -nographic -kernel @BINARY@" CACHE STRING "")
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/../baremetal_common.cmake)

>From d0d70eb65a484cf100bb821e8bb30a8320eb11df Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Tue, 17 Nov 2026 12:24:08 +0000
Subject: [PATCH 2/3] [lic] Enable baremetal Armv6-M no-FP premerge tests

---
 .github/workflows/libc-fullbuild-tests.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
index 4bd0ad401d407d..68a31edf6761c1 100644
--- a/.github/workflows/libc-fullbuild-tests.yml
+++ b/.github/workflows/libc-fullbuild-tests.yml
@@ -88,7 +88,7 @@ jobs:
             cpp_compiler: clang++-24
             linker: lld-24
             target: armv6m-none-eabi
-            testing: SKIP
+            build_builtins: ON
           - name: baremetal-armv7m
             os: ubuntu-26.04
             build_type: MinSizeRel

>From 6b66b991d82259e3eaecc33c3c05b40141ffe809 Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Wed, 18 Nov 2026 13:39:09 +0000
Subject: [PATCH 3/3] Move it into a new job so that the original remains
 untouched

---
 .github/workflows/libc-fullbuild-tests.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/.github/workflows/libc-fullbuild-tests.yml b/.github/workflows/libc-fullbuild-tests.yml
index 68a31edf6761c1..b91b8da9cf9a7c 100644
--- a/.github/workflows/libc-fullbuild-tests.yml
+++ b/.github/workflows/libc-fullbuild-tests.yml
@@ -88,6 +88,14 @@ jobs:
             cpp_compiler: clang++-24
             linker: lld-24
             target: armv6m-none-eabi
+            testing: SKIP
+          - name: baremetal-armv6m-testing
+            os: ubuntu-26.04
+            build_type: MinSizeRel
+            c_compiler: clang-24
+            cpp_compiler: clang++-24
+            linker: lld-24
+            target: arm-testing/armv6m-none-eabi
             build_builtins: ON
           - name: baremetal-armv7m
             os: ubuntu-26.04



More information about the llvm-branch-commits mailing list