Skip to content

Commit e601679

Browse files
authored
[libc++] Add a picolibc test configuration with exceptions enabled (#75462)
1 parent 87b45f1 commit e601679

File tree

4 files changed

+61
-35
lines changed

4 files changed

+61
-35
lines changed

libcxx/cmake/caches/Armv7M-picolibc.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
1313
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
1414
set(LIBCXXABI_BAREMETAL ON CACHE BOOL "")
1515
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
16-
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
16+
set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
1717
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
1818
set(LIBCXXABI_ENABLE_STATIC ON CACHE BOOL "")
19+
set(LIBCXXABI_ENABLE_STATIC_UNWINDER ON CACHE BOOL "")
1920
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
2021
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")
2122
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "")
22-
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
23+
set(LIBCXX_ENABLE_EXCEPTIONS ON CACHE BOOL "")
2324
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE STRING "")
2425
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "")
2526
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
26-
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
27+
set(LIBCXX_ENABLE_RTTI ON CACHE BOOL "")
2728
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
2829
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
2930
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ steps:
224224
arch: aarch64
225225
<<: *common
226226

227+
- label: Armv7-M picolibc -fno-exceptions
228+
command: libcxx/utils/ci/run-buildbot armv7m-picolibc-no-exceptions
229+
agents:
230+
queue: libcxx-builders-linaro-arm
231+
arch: aarch64
232+
<<: *common
233+
227234
- group: AIX
228235
steps:
229236
- label: AIX (32-bit)

libcxx/utils/ci/run-buildbot

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,43 @@ function check-cxx-benchmarks() {
203203
${NINJA} -vC "${BUILD_DIR}" check-cxx-benchmarks
204204
}
205205

206+
function test-armv7m-picolibc() {
207+
clean
208+
209+
# To make it easier to get this builder up and running, build picolibc
210+
# from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
211+
# This could be optimised by building picolibc into the Docker container.
212+
${MONOREPO_ROOT}/libcxx/utils/ci/build-picolibc.sh \
213+
--build-dir "${BUILD_DIR}" \
214+
--install-dir "${INSTALL_DIR}" \
215+
--target armv7m-none-eabi
216+
217+
echo "--- Generating CMake"
218+
flags="--sysroot=${INSTALL_DIR}"
219+
${CMAKE} \
220+
-S "${MONOREPO_ROOT}/compiler-rt" \
221+
-B "${BUILD_DIR}/compiler-rt" \
222+
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
223+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
224+
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
225+
-DCMAKE_C_FLAGS="${flags}" \
226+
-DCMAKE_CXX_FLAGS="${flags}" \
227+
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
228+
"${@}"
229+
generate-cmake \
230+
-DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
231+
-DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
232+
-DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
233+
-DCMAKE_C_FLAGS="${flags}" \
234+
-DCMAKE_CXX_FLAGS="${flags}" \
235+
"${@}"
236+
237+
${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
238+
mv "${BUILD_DIR}/install/lib/armv7m-none-eabi"/* "${BUILD_DIR}/install/lib"
239+
240+
check-runtimes
241+
}
242+
206243
# Print the version of a few tools to aid diagnostics in some cases
207244
${CMAKE} --version
208245
${NINJA} --version
@@ -616,39 +653,16 @@ armv7-no-exceptions)
616653
check-runtimes
617654
;;
618655
armv7m-picolibc)
619-
clean
620-
621-
# To make it easier to get this builder up and running, build picolibc
622-
# from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
623-
# This could be optimised by building picolibc into the Docker container.
624-
${MONOREPO_ROOT}/libcxx/utils/ci/build-picolibc.sh \
625-
--build-dir "${BUILD_DIR}" \
626-
--install-dir "${INSTALL_DIR}" \
627-
--target armv7m-none-eabi
628-
629-
echo "--- Generating CMake"
630-
flags="--sysroot=${INSTALL_DIR}"
631-
${CMAKE} \
632-
-S "${MONOREPO_ROOT}/compiler-rt" \
633-
-B "${BUILD_DIR}/compiler-rt" \
634-
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
635-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
636-
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
656+
test-armv7m-picolibc \
657+
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake"
658+
;;
659+
armv7m-picolibc-no-exceptions)
660+
test-armv7m-picolibc \
637661
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
638-
-DCMAKE_C_FLAGS="${flags}" \
639-
-DCMAKE_CXX_FLAGS="${flags}" \
640-
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
641-
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
642-
-DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
643-
-DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
644-
-DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
645-
-DCMAKE_C_FLAGS="${flags}" \
646-
-DCMAKE_CXX_FLAGS="${flags}"
647-
648-
${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
649-
mv "${BUILD_DIR}/install/lib/armv7m-none-eabi"/* "${BUILD_DIR}/install/lib"
650-
651-
check-runtimes
662+
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
663+
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF \
664+
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
665+
-DLIBCXX_ENABLE_RTTI=OFF
652666
;;
653667
clang-cl-dll)
654668
clean

libcxxabi/test/catch_multi_level_pointer.pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
// 1b00fc5d8133 made it in the dylib in macOS 10.11
1212
// XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10}}
1313

14+
// mps2-an385 machine used for testing of picolibc has just 4 MB of "flash"
15+
// memory and this test requires almost 5 MB
16+
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
17+
1418
#include <cassert>
1519
#include <cstdio>
1620
#include <cstdlib>

0 commit comments

Comments
 (0)