1- From b0046797acd5c5fd5e61c493d502dbc64bf9ef56 Mon Sep 17 00:00:00 2001
1+ From 47f113bfa3cfa5c6b8c37636cedb4cf4d12d65aa Mon Sep 17 00:00:00 2001
22From: Michael Platings <
[email protected] >
33Date: Fri, 29 Sep 2023 09:35:52 +0100
44Subject: [PATCH 2/4] Add check for building with picolibc
@@ -12,12 +12,12 @@ Differential Revision: https://reviews.llvm.org/D154246
1212---
1313 libcxx/cmake/caches/Armv7M-picolibc.cmake | 38 ++++++
1414 libcxx/docs/index.rst | 21 ++--
15- libcxx/test/configs/armv7m-libc++.cfg.in | 41 +++++++
15+ libcxx/test/configs/armv7m-libc++.cfg.in | 42 +++++++
1616 .../test/libcxx/clang_modules_include.gen.py | 3 +
17- libcxx/test/libcxx/selftest/dsl/dsl.sh.py | 3 +
17+ libcxx/test/libcxx/selftest/dsl/dsl.sh.py | 2 +
1818 .../selftest/pass.cpp/run-error.pass.cpp | 1 +
1919 .../libcxx/selftest/pass.mm/run-error.pass.mm | 1 +
20- .../test/libcxx/system_reserved_names.gen.py | 5 +-
20+ .../test/libcxx/system_reserved_names.gen.py | 11 +-
2121 .../atomics.types.generic/integral.pass.cpp | 2 +
2222 .../atomic_fetch_add.pass.cpp | 2 +
2323 .../atomic_fetch_add_explicit.pass.cpp | 2 +
@@ -51,12 +51,13 @@ Differential Revision: https://reviews.llvm.org/D154246
5151 .../op_-duration.pass.cpp | 3 +
5252 libcxx/utils/ci/BOT_OWNERS.txt | 2 +-
5353 libcxx/utils/ci/build-picolibc.sh | 109 ++++++++++++++++++
54- libcxx/utils/ci/buildkite-pipeline.yml | 14 ++ +
54+ libcxx/utils/ci/buildkite-pipeline.yml | 5 +
5555 libcxx/utils/ci/run-buildbot | 35 ++++++
56- libcxx/utils/libcxx/test/features.py | 27 ++++-
57- .../test/configs/armv7m-libc++abi.cfg.in | 39 +++++++
58- .../test/configs/armv7m-libunwind.cfg.in | 32 +++++
59- 46 files changed, 434 insertions(+), 13 deletions(-)
56+ libcxx/utils/libcxx/test/features.py | 29 ++++-
57+ .../test/configs/armv7m-libc++abi.cfg.in | 33 ++++++
58+ libcxxabi/test/test_demangle.pass.cpp | 3 +
59+ .../test/configs/armv7m-libunwind.cfg.in | 33 ++++++
60+ 47 files changed, 430 insertions(+), 14 deletions(-)
6061 create mode 100644 libcxx/cmake/caches/Armv7M-picolibc.cmake
6162 create mode 100644 libcxx/test/configs/armv7m-libc++.cfg.in
6263 create mode 100755 libcxx/utils/ci/build-picolibc.sh
@@ -141,10 +142,10 @@ index c4199dc69d7c..7bb5512beb1f 100644
141142 C Standard Library. It is also possible to turn off parts of the library for use on
142143diff --git a/libcxx/test/configs/armv7m-libc++.cfg.in b/libcxx/test/configs/armv7m-libc++.cfg.in
143144new file mode 100644
144- index 000000000000..424d473ac7ca
145+ index 000000000000..688c791b2028
145146--- /dev/null
146147+++ b/libcxx/test/configs/armv7m-libc++.cfg.in
147- @@ -0,0 +1,41 @@
148+ @@ -0,0 +1,42 @@
148149+ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
149150+
150151+ config.substitutions.append(('%{libc-linker-script}', '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld'))
@@ -176,6 +177,7 @@ index 000000000000..424d473ac7ca
176177+ config.substitutions.append(('%{exec}',
177178+ 'true' # TODO use qemu-system-arm
178179+ ))
180+ + config.available_features.add('libcxx-fake-executor')
179181+
180182+ import os, site
181183+ site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
@@ -201,48 +203,67 @@ index 04c8e03affee..26ef2077449b 100644
201203
202204 #include <{header}>
203205diff --git a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
204- index dfe290b21fbb..c543898c083b 100644
206+ index dfe290b21fbb..6c695a0d672e 100644
205207--- a/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
206208+++ b/libcxx/test/libcxx/selftest/dsl/dsl.sh.py
207- @@ -6,6 +6,9 @@
209+ @@ -6,6 +6,8 @@
208210 #
209211 # ===----------------------------------------------------------------------===##
210212
211- + # Picolibc test executor is `true` at present.
212- + # XFAIL: LIBCXX-PICOLIBC-FIXME
213+ + # XFAIL: libcxx-fake-executor
213214+
214215 # Note: We prepend arguments with 'x' to avoid thinking there are too few
215216 # arguments in case an argument is an empty string.
216217 # RUN: %{python} %s x%S x%T x%{substitutions}
217218diff --git a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
218- index eac7d8846e23..035761530078 100644
219+ index eac7d8846e23..1df98ef11191 100644
219220--- a/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
220221+++ b/libcxx/test/libcxx/selftest/pass.cpp/run-error.pass.cpp
221222@@ -6,6 +6,7 @@
222223 //
223224 //===----------------------------------------------------------------------===//
224225
225- + // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
226+ + // UNSUPPORTED: libcxx-fake-executor
226227 // XFAIL: *
227228
228229 // Make sure the test DOES NOT pass if it fails at runtime.
229230diff --git a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
230- index 22e17666eab0..d3889686b69d 100644
231+ index 22e17666eab0..02e8321c96b2 100644
231232--- a/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
232233+++ b/libcxx/test/libcxx/selftest/pass.mm/run-error.pass.mm
233234@@ -7,6 +7,7 @@
234235 //===----------------------------------------------------------------------===//
235236
236237 // REQUIRES: objective-c++
237- + // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
238+ + // UNSUPPORTED: libcxx-fake-executor
238239
239240 // XFAIL: *
240241
241242diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
242- index e2aa8fc47348..99ca86cfd830 100644
243+ index e2aa8fc47348..29c1ce0d4faf 100644
243244--- a/libcxx/test/libcxx/system_reserved_names.gen.py
244245+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
245- @@ -101,7 +101,10 @@ for header in public_headers:
246+ @@ -20,6 +20,9 @@ for header in public_headers:
247+ //--- {header}.compile.pass.cpp
248+ {lit_header_restrictions.get(header, '')}
249+
250+ + // for "_NEWLIB_VERSION" macro
251+ + #include <string.h>
252+ +
253+ #define SYSTEM_RESERVED_NAME This name should not be used in libc++
254+
255+ // libc++ does not use single-letter names as a matter of principle.
256+ @@ -63,7 +66,8 @@ for header in public_headers:
257+ #endif
258+
259+ // Test that libc++ doesn't use names that collide with FreeBSD system macros.
260+ - #ifndef __FreeBSD__
261+ + // newlib and picolibc also define these macros
262+ + #if !defined(__FreeBSD__) && !defined(_NEWLIB_VERSION)
263+ # define __null_sentinel SYSTEM_RESERVED_NAME
264+ # define __generic SYSTEM_RESERVED_NAME
265+ #endif
266+ @@ -101,7 +105,10 @@ for header in public_headers:
246267 # define __pre SYSTEM_RESERVED_NAME
247268 #endif
248269
@@ -425,7 +446,7 @@ index fda5e186c036..dcc97573d607 100644
425446
426447 #include <fenv.h>
427448diff --git a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
428- index 27a97627cee3..35be03e41f8f 100644
449+ index 55731c857ecf..af97ef2fddfb 100644
429450--- a/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
430451+++ b/libcxx/test/std/depr/depr.c.headers/stdio_h.compile.pass.cpp
431452@@ -6,6 +6,9 @@
@@ -800,30 +821,21 @@ index 000000000000..acdcabe96e96
800821+
801822+ "${venv_dir}/bin/meson" install -C "${picolibc_build_dir}"
802823diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
803- index c2537618c56b..bb734eb5ef18 100644
824+ index 7482938f65dc..018d6a4c9195 100644
804825--- a/libcxx/utils/ci/buildkite-pipeline.yml
805826+++ b/libcxx/utils/ci/buildkite-pipeline.yml
806- @@ -1056,6 +1056,20 @@ steps:
807- limit: 2
808- timeout_in_minutes: 120
809-
810- + - label: "Armv7-M picolibc"
811- + command: "libcxx/utils/ci/run-buildbot armv7m-picolibc"
812- + artifact_paths:
813- + - "**/test-results.xml"
814- + - "**/*.abilist"
815- + agents:
816- + queue: "libcxx-builders-linaro-arm"
817- + arch: "aarch64"
818- + retry:
819- + automatic:
820- + - exit_status: -1 # Agent was lost
821- + limit: 2
822- + timeout_in_minutes: 120
823- +
824- - group: "AIX"
825- steps:
826- - label: "AIX (32-bit)"
827+ @@ -505,6 +505,11 @@ steps:
828+ <<: *arm_agent_armv8l
829+ <<: *common
830+
831+ + - label: Armv7-M picolibc
832+ + command: libcxx/utils/ci/run-buildbot armv7m-picolibc
833+ + <<: *arm_agent_aarch64
834+ + <<: *common
835+ +
836+ - group: AIX
837+ steps:
838+ - label: AIX (32-bit)
827839diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
828840index fe99388a799b..8263d335b45a 100755
829841--- a/libcxx/utils/ci/run-buildbot
@@ -871,13 +883,25 @@ index fe99388a799b..8263d335b45a 100755
871883 clean
872884 # TODO: Currently, building with the experimental library breaks running
873885diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
874- index 29822f555213..d2f4859e367f 100644
886+ index 29822f555213..124d05769de0 100644
875887--- a/libcxx/utils/libcxx/test/features.py
876888+++ b/libcxx/utils/libcxx/test/features.py
877- @@ -110,6 +110,17 @@ DEFAULT_FEATURES = [
878- name="verify-support",
879- when=lambda cfg: hasCompileFlag(cfg, "-Xclang -verify-ignore-unexpected"),
880- ),
889+ @@ -197,7 +197,8 @@ DEFAULT_FEATURES = [
890+ #include <unistd.h>
891+ #include <sys/wait.h>
892+ int main(int, char**) {
893+ - return 0;
894+ + int fd[2];
895+ + return pipe(fd);
896+ }
897+ """,
898+ ),
899+ @@ -277,6 +278,19 @@ DEFAULT_FEATURES = [
900+ Feature(name="msvc", when=_isMSVC),
901+ Feature(name=lambda cfg: "msvc-{}".format(*_msvcVersion(cfg)), when=_isMSVC),
902+ Feature(name=lambda cfg: "msvc-{}.{}".format(*_msvcVersion(cfg)), when=_isMSVC),
903+ + # this feature has to be checked after the "gcc" feature, so that the
904+ + # "-D_LIBCPP_DISABLE_DEPRECATION_WARNINGS" flag is already in place
881905+ Feature(
882906+ name="has-64-bit-atomics",
883907+ when=lambda cfg: sourceBuilds(
@@ -889,20 +913,10 @@ index 29822f555213..d2f4859e367f 100644
889913+ """,
890914+ ),
891915+ ),
892- Feature(
893- name="non-lockfree-atomics",
894- when=lambda cfg: sourceBuilds(
895- @@ -197,7 +208,8 @@ DEFAULT_FEATURES = [
896- #include <unistd.h>
897- #include <sys/wait.h>
898- int main(int, char**) {
899- - return 0;
900- + int fd[2];
901- + return pipe(fd);
902- }
903- """,
904- ),
905- @@ -401,6 +413,19 @@ DEFAULT_FEATURES += [
916+ ]
917+
918+ # Deduce and add the test features that that are implied by the #defines in
919+ @@ -401,6 +415,19 @@ DEFAULT_FEATURES += [
906920 name="LIBCXX-FREEBSD-FIXME",
907921 when=lambda cfg: "__FreeBSD__" in compilerMacros(cfg),
908922 ),
@@ -924,10 +938,10 @@ index 29822f555213..d2f4859e367f 100644
924938 # Add features representing the build host platform name.
925939diff --git a/libcxxabi/test/configs/armv7m-libc++abi.cfg.in b/libcxxabi/test/configs/armv7m-libc++abi.cfg.in
926940new file mode 100644
927- index 000000000000..d022e84fb19e
941+ index 000000000000..876f43e44bbb
928942--- /dev/null
929943+++ b/libcxxabi/test/configs/armv7m-libc++abi.cfg.in
930- @@ -0,0 +1,39 @@
944+ @@ -0,0 +1,33 @@
931945+ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
932946+
933947+ config.substitutions.append(('%{libc-linker-script}', '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld'))
@@ -950,13 +964,7 @@ index 000000000000..d022e84fb19e
950964+ config.substitutions.append(('%{exec}',
951965+ 'true' # TODO use qemu-system-arm
952966+ ))
953- +
954- + # LIBCXX-PICOLIBC-FIXME is the feature name used to XFAIL the
955- + # initial picolibc failures until they can be properly diagnosed
956- + # and fixed. This allows easier detection of new test failures
957- + # and regressions. Note: New failures should not be suppressed
958- + # using this feature.
959- + config.available_features.add('LIBCXX-PICOLIBC-FIXME')
967+ + config.available_features.add('libcxx-fake-executor')
960968+
961969+ import os, site
962970+ site.addsitedir(os.path.join('@LIBCXXABI_LIBCXX_PATH@', 'utils'))
@@ -967,12 +975,26 @@ index 000000000000..d022e84fb19e
967975+ config,
968976+ lit_config
969977+ )
978+ diff --git a/libcxxabi/test/test_demangle.pass.cpp b/libcxxabi/test/test_demangle.pass.cpp
979+ index 77741a952850..0bc7d0db3db2 100644
980+ --- a/libcxxabi/test/test_demangle.pass.cpp
981+ +++ b/libcxxabi/test/test_demangle.pass.cpp
982+ @@ -9,6 +9,9 @@
983+ // The demangler does not pass all these tests with the system dylibs on macOS.
984+ // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
985+
986+ + // This test is too big for most embedded devices.
987+ + // XFAIL: LIBCXX-PICOLIBC-FIXME
988+ +
989+ // https://llvm.org/PR51407 was not fixed in some previously-released
990+ // demanglers, which causes them to run into the infinite loop.
991+ // UNSUPPORTED: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}}
970992diff --git a/libunwind/test/configs/armv7m-libunwind.cfg.in b/libunwind/test/configs/armv7m-libunwind.cfg.in
971993new file mode 100644
972- index 000000000000..5f15ccd3613c
994+ index 000000000000..6ddb6138c402
973995--- /dev/null
974996+++ b/libunwind/test/configs/armv7m-libunwind.cfg.in
975- @@ -0,0 +1,32 @@
997+ @@ -0,0 +1,33 @@
976998+ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
977999+
9781000+ config.substitutions.append(('%{libc-linker-script}', '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld'))
@@ -995,6 +1017,7 @@ index 000000000000..5f15ccd3613c
9951017+ config.substitutions.append(('%{exec}',
9961018+ 'true' # TODO use qemu-system-arm
9971019+ ))
1020+ + config.available_features.add('libcxx-fake-executor')
9981021+
9991022+ import os, site
10001023+ site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
0 commit comments