Skip to content

Commit

Permalink
Revert commits for changes that did not make it into LLVM-19
Browse files Browse the repository at this point in the history
The following changes to LLVM ET were made in response to changes in LLVM
which happened after the LLVM 19 branch, and therefore do not need to be on
our branch either:

Statically link libc++abi into libc++ (ARM-software#483)
e80e252

Update a downstream patch for altered context (NFC)
d95a4fa

Fix a patch conflict in libc++ tests.
7616f8c

Do not default to linking crt0 when using crt0-semihosting (ARM-software#460)
39523a0

Remove patch since llvm sort.pass.cpp is already marked as a long test (ARM-software#458)
3b32a82

Update patch file for libc++ tests with picolibc, to mark sort test as long one (ARM-software#457)
9a53fc9
  • Loading branch information
dcandler committed Sep 10, 2024
1 parent 5d42433 commit f82951a
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 55 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,12 @@ endif()
# ed551e0778a35f00ab60f1c80d83ea8274d8d400.
set(
llvm_project_patches
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0001-libc-tests-with-picolibc-xfail-one-remaining-test.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0001-libc-tests-with-picolibc-xfail-two-remaining-tests.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0002-libc-tests-with-picolibc-disable-large-tests.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0003-Disable-failing-compiler-rt-test.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0004-libc-tests-with-picolibc-XFAIL-uses-of-atomics.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0005-libc-tests-with-picolibc-mark-two-more-large-tests.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0004-libc-tests-with-picolibc-mark-sort-test-as-long-one.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0005-libc-tests-with-picolibc-XFAIL-uses-of-atomics.patch
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0006-libc-tests-with-picolibc-mark-two-more-large-tests.patch
)
FetchContent_Declare(llvmproject
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
Expand Down Expand Up @@ -1074,7 +1075,7 @@ Hard-float library with target triple \"${target_triple}\" must end \"-eabihf\""

get_runtimes_flags("${directory}" "${flags}")

set(compiler_rt_test_flags "${runtimes_flags} -fno-exceptions -fno-rtti -nostartfiles -lcrt0-semihost -lsemihost -T picolibcpp.ld")
set(compiler_rt_test_flags "${runtimes_flags} -fno-exceptions -fno-rtti -lcrt0-semihost -lsemihost -T picolibcpp.ld")
if(variant STREQUAL "armv6m_soft_nofp")
set(compiler_rt_test_flags "${compiler_rt_test_flags} -fomit-frame-pointer")
endif()
Expand Down Expand Up @@ -1201,7 +1202,6 @@ function(
-DLIBCXXABI_TEST_PARAMS=executor=${test_executor}
-DLIBCXX_ABI_UNSTABLE=ON
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON
-DLIBCXX_ENABLE_FILESYSTEM=OFF
-DLIBCXX_ENABLE_SHARED=OFF
-DLIBCXX_ENABLE_STATIC=ON
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ To use the toolchain, on the command line you need to provide the following opti
* The FPU to use.
* Disabling/enabling C++ exceptions and RTTI.
* The C runtime library: either `crt0` or `crt0-semihost`.
`crt0` will be linked automatically, but this can be suppressed
with the `-nostartfiles` option so that `crt0-semihost` can be used.
* The semihosting library, if using `crt0-semihost`.
* A [linker script](
https://sourceware.org/binutils/docs/ld/Scripts.html) specified with `-T`.
Expand All @@ -104,7 +102,6 @@ $ clang \
-mfpu=none \
-fno-exceptions \
-fno-rtti \
-nostartfiles \
-lcrt0-semihost \
-lsemihost \
-T picolibc.ld \
Expand Down Expand Up @@ -133,7 +130,6 @@ $ clang \
-mfpu=none \
-fno-exceptions \
-fno-rtti \
-nostartfiles \
-lcrt0-semihost \
-lsemihost \
-T picolibc.ld \
Expand Down
4 changes: 2 additions & 2 deletions docs/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ however uses different command line options to control selection of semihosting.

|Use case|GNU options|LLVM options|
|--------|-----------|------------|
|No semihosting|`--specs=nosys.specs`|
|Semihosting|`--specs=rdimon.specs`|`-nostartfiles -lcrt0-semihost -lsemihost`|
|No semihosting|`--specs=nosys.specs`|`-lcrt0`|
|Semihosting|`--specs=rdimon.specs`|`-lcrt0-semihost -lsemihost`|
|Newlib-nano|`--specs=nano.specs`|Not available: `picolibc` is an equivalent of `newlib-nano`.

## Linker
Expand Down
2 changes: 1 addition & 1 deletion packagetest/hello.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -T %S/Inputs/microbit.ld %s -o %t.out
// RUN: %clang --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -T %S/Inputs/microbit.ld %s -o %t.out
// RUN: qemu-system-arm -M microbit -semihosting -nographic -device loader,file=%t.out 2>&1 | FileCheck %s

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion packagetest/hello.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -T %S/Inputs/microbit.ld %s -o %t.out
// RUN: %clangxx --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -T %S/Inputs/microbit.ld %s -o %t.out
// RUN: qemu-system-arm -M microbit -semihosting -nographic -device loader,file=%t.out 2>&1 | FileCheck %s

// Include as many C++17 headers as possible.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From cb6cfe0e5fc29d3867f523900f0d46a4ef5dff1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt@arm.com>
Date: Mon, 16 Oct 2023 11:35:48 +0200
Subject: [libc++] tests with picolibc: xfail two remaining tests

---
.../cmp/cmp.alg/strong_order_long_double.verify.cpp | 5 +++++
.../language.support/support.start.term/quick_exit.pass.cpp | 3 +++
2 files changed, 8 insertions(+)

diff --git a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
index c9c2ba200214..4898a9a06e09 100644
--- a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
+++ b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
@@ -12,6 +12,11 @@
// This test does apply to aarch64 where Arm's AAPCS64 is followed. There they are different sizes.
// XFAIL: target={{arm64|arm64e|armv(7|8)(l|m)?|powerpc|powerpc64}}-{{.+}}

+// In internal LLVM arm BMT tests the target is fixed to "arm-none-eabi", so the
+// "unsupported" cluase above does not work. TODO: find more generic way to
+// detect equal sizes of double and long double
+// XFAIL: LIBCXX-PICOLIBC-FIXME
+
// MSVC configurations have long double equal to regular double on all
// architectures.
// XFAIL: target={{.+}}-pc-windows-msvc
diff --git a/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp
index 5a70ea5bd570..92dfbe8eb1ab 100644
--- a/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp
+++ b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp
@@ -16,6 +16,9 @@

// test quick_exit and at_quick_exit

+// TODO: Find out why the at_quick_exit symbol is not found.
+// XFAIL: LIBCXX-PICOLIBC-FIXME
+
#include <cstdlib>

void f() {}
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From ac480df06d78bd7457d2a6333be8578cda88c240 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt@arm.com>
Date: Thu, 9 Nov 2023 14:14:30 +0100
Subject: [libc++] tests with picolibc: mark sort test as long one

---
.../std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
index e2581fbf2fa6..99a9e1775513 100644
--- a/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp
@@ -6,8 +6,7 @@
//
//===----------------------------------------------------------------------===//

-// This test appears to hang with picolibc & qemu.
-// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
+// REQUIRES: long_test

// <algorithm>

--
2.34.1

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ index 000000000000..5ecc58f3e385
+if "has-no-atomics" in config.available_features:
+ config.unsupported = True
diff --git a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
index 99d4226662a0..243aa21c87b4 100644
index 47440015f2c5..4350de3dfa65 100644
--- a/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
+++ b/libcxx/test/libcxx/thread/thread.stoptoken/intrusive_shared_ptr.pass.cpp
@@ -7,6 +7,8 @@
Expand All @@ -49,8 +49,8 @@ index 99d4226662a0..243aa21c87b4 100644
+// XFAIL: has-no-atomics
+
// UNSUPPORTED: c++03, c++11, c++14, c++17
// ADDITIONAL_COMPILE_FLAGS: -Wno-private-header

#include <__stop_token/intrusive_shared_ptr.h>
diff --git a/libcxx/test/std/atomics/lit.local.cfg b/libcxx/test/std/atomics/lit.local.cfg
new file mode 100644
index 000000000000..5ecc58f3e385
Expand Down
3 changes: 2 additions & 1 deletion samples/Makefile.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ endif
MICROBIT_TARGET=--target=armv6m-none-eabi -march=armv6m -mfpu=none -mfloat-abi=soft
AARCH64_TARGET=--target=aarch64-none-elf

CRT_SEMIHOST=-nostartfiles -lcrt0-semihost -lsemihost
CRT=-lcrt0
CRT_SEMIHOST=-lcrt0-semihost -lsemihost

CPP_FLAGS=-fno-exceptions -fno-rtti
2 changes: 1 addition & 1 deletion samples/src/baremetal-semihosting-aarch64/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ if exist hello.img del /q hello.img
@exit /B 1

:build_fn
%BIN_PATH%\clang.exe --target=aarch64-none-elf -nostartfiles -lcrt0-semihost -lsemihost -g -T ..\..\ldscripts\raspi3b.ld -o hello.elf hello.c
%BIN_PATH%\clang.exe --target=aarch64-none-elf -lcrt0-semihost -lsemihost -g -T ..\..\ldscripts\raspi3b.ld -o hello.elf hello.c
%BIN_PATH%\llvm-objcopy.exe -O binary hello.elf hello.img
@exit /B
2 changes: 1 addition & 1 deletion samples/src/baremetal-semihosting/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ if exist hello.hex del /q hello.hex
@exit /B 1

:build_fn
%BIN_PATH%\clang.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.c
%BIN_PATH%\clang.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.c
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
2 changes: 1 addition & 1 deletion samples/src/baremetal-uart/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include ../../Makefile.conf
build: hello.elf

hello.elf: *.c
$(BIN_PATH)/clang $(MICROBIT_TARGET) -g -T ../../ldscripts/microbit.ld -o hello.elf $^
$(BIN_PATH)/clang $(MICROBIT_TARGET) $(CRT) -g -T ../../ldscripts/microbit.ld -o hello.elf $^

%.hex: %.elf
$(BIN_PATH)/llvm-objcopy -O ihex $< $@
Expand Down
2 changes: 1 addition & 1 deletion samples/src/baremetal-uart/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ if exist hello.hex del /q hello.hex
@exit /B 1

:build_fn
%BIN_PATH%\clang.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.c
%BIN_PATH%\clang.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0 -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.c
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
4 changes: 2 additions & 2 deletions samples/src/cpp-baremetal-semihosting-cfi/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ if exist hello.hex del /q hello.hex

:build_fn
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -fno-exceptions -fno-rtti -flto -fsanitize=cfi -fvisibility=hidden -fno-sanitize-ignorelist -g -c hello.cpp
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -flto -T ..\..\ldscripts\microbit.ld -g -o hello.elf hello.o
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -flto -T ..\..\ldscripts\microbit.ld -g -o hello.elf hello.o
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B

:build_no_cfi_fn
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -fno-exceptions -fno-rtti -flto -g -c hello.cpp
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -flto -T ..\..\ldscripts\microbit.ld -g -o hello.elf hello.o
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -flto -T ..\..\ldscripts\microbit.ld -g -o hello.elf hello.o
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
2 changes: 1 addition & 1 deletion samples/src/cpp-baremetal-semihosting-prof/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ if exist proflib.o del /q proflib.o

:build_fn
%BIN_PATH%\clang.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -g -c proflib.c
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -g -T ..\..\ldscripts\microbit.ld -fprofile-instr-generate -fcoverage-mapping -o hello.elf hello.cpp proflib.o
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -g -T ..\..\ldscripts\microbit.ld -fprofile-instr-generate -fcoverage-mapping -o hello.elf hello.cpp proflib.o
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
4 changes: 2 additions & 2 deletions samples/src/cpp-baremetal-semihosting-ubsan/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ if exist hello.hex del /q hello.hex
@exit /B 1

:build_fn
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti --std=c++17 -fsanitize=undefined -fsanitize-minimal-runtime -g -T ../../ldscripts/microbit.ld -o hello.elf *.cpp
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti --std=c++17 -fsanitize=undefined -fsanitize-minimal-runtime -g -T ../../ldscripts/microbit.ld -o hello.elf *.cpp
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B

:build_trap_fn
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti --std=c++17 -fsanitize=undefined -fsanitize-trap=all -g -T ../../ldscripts/microbit.ld -o hello.elf *.cpp
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti --std=c++17 -fsanitize=undefined -fsanitize-trap=all -g -T ../../ldscripts/microbit.ld -o hello.elf *.cpp
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
2 changes: 1 addition & 1 deletion samples/src/cpp-baremetal-semihosting/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ if exist hello.hex del /q hello.hex
@exit /B 1

:build_fn
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.cpp
%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.cpp
%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex
@exit /B
2 changes: 1 addition & 1 deletion test-support/llvm-libc++-picolibc.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ config.substitutions.append(('%{link_flags}',
' -nostdlib++ -L %{lib-dir}'
' -lc++ -lc++abi'
' -nostdlib -L %{libc-lib}'
' -lc -lm -lclang_rt.builtins -lsemihost -nostartfiles -lcrt0-semihost'
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost'
' -T %{libc-linker-script}'
))
config.substitutions.append(('%{exec}',
Expand Down
2 changes: 1 addition & 1 deletion test-support/llvm-libc++abi-picolibc.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ config.substitutions.append(('%{link_flags}',
' -nostdlib++ -L %{lib}'
' -lc++ -lc++abi'
' -nostdlib -L %{libc-lib}'
' -lc -lm -lclang_rt.builtins -lsemihost -nostartfiles -lcrt0-semihost'
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost'
' -T %{libc-linker-script}'
))
config.substitutions.append(('%{exec}',
Expand Down
2 changes: 1 addition & 1 deletion test-support/llvm-libunwind-picolibc.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ config.substitutions.append(('%{link_flags}',
' -nostdlib++ -L %{lib}'
' -lc++ -lc++abi -lunwind'
' -nostdlib -L %{libc-lib}'
' -lc -lm -lclang_rt.builtins -lsemihost -nostartfiles -lcrt0-semihost'
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost'
' -T %{libc-linker-script}'
))
config.substitutions.append(('%{exec}',
Expand Down

0 comments on commit f82951a

Please sign in to comment.