Skip to content

Commit e859265

Browse files
[libcxx][CI] Use lld for everything in the ARM picolib builds (#158320)
Our host compiler is a clang install that will default to ld if not told otherwise. We were telling meson to use lld, but the way that we did it was outdated, which lead to picolib producing a linker script that lld could not use. The tests were in fact linking with ld instead. Using the `c_ld` setting fixes this problem. See: https://mesonbuild.com/Machine-files.html#binaries Then to use lld in tests we need `-fuse-ld=lld` in the config files. Some of these options were not needed for clang 19.1.7, but were for clang 21.1.1. We will soon update to 21.1.1 so I have included all of the required options in this PR.
1 parent 78bf682 commit e859265

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

libcxx/cmake/caches/Armv7M-picolibc.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(CMAKE_C_COMPILER_TARGET "armv7m-none-eabi" CACHE STRING "")
55
set(CMAKE_C_FLAGS "-mfloat-abi=soft" CACHE STRING "")
66
set(CMAKE_SYSTEM_NAME Generic CACHE STRING "")
77
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
8+
set(LLVM_USE_LINKER "lld" CACHE STRING "")
89
set(COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "")
910
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
1011
set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")

libcxx/test/configs/armv7m-picolibc-libc++.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ config.substitutions.append(('%{compile_flags}',
1313
' -Wno-atomic-alignment'
1414
))
1515
config.substitutions.append(('%{link_flags}',
16-
'-nostdlib -nostdlib++ -L %{lib-dir} -lc++ -lc++abi'
16+
'-fuse-ld=lld -nostdlib -nostdlib++ -L %{lib-dir} -lc++ -lc++abi'
1717
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' +
1818
' -T {}'.format(libc_linker_script) +
1919
' -Wl,--defsym=__flash=0x0'

libcxx/utils/ci/build-picolibc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ cat <<EOF > "${picolibc_build_dir}/meson-cross-build.txt"
8181
c = ['${CC:-cc}', '--target=${target}', '-mfloat-abi=soft', '-nostdlib']
8282
ar = 'llvm-ar'
8383
as = 'llvm-as'
84-
ld = 'lld'
84+
c_ld = 'lld'
8585
strip = 'llvm-strip'
8686
[host_machine]
8787
system = 'none'

libcxxabi/test/configs/armv7m-picolibc-libc++abi.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ config.substitutions.append(('%{compile_flags}',
88
'-nostdinc++ -I %{include} -I %{cxx-include} -I %{cxx-target-include} %{maybe-include-libunwind} -I %{libcxx}/test/support -I %{libcxx}/src -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS'
99
))
1010
config.substitutions.append(('%{link_flags}',
11-
'-nostdlib -nostdlib++ -L %{lib} -lc++ -lc++abi'
11+
'-fuse-ld=lld -nostdlib -nostdlib++ -L %{lib} -lc++ -lc++abi'
1212
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' +
1313
' -T {}'.format(libc_linker_script) +
1414
' -Wl,--defsym=__flash=0x0'

libunwind/test/configs/armv7m-picolibc-libunwind.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ config.substitutions.append(('%{compile_flags}',
88
'-nostdinc++ -I %{include}'
99
))
1010
config.substitutions.append(('%{link_flags}',
11-
'-nostdlib -nostdlib++ -L %{lib} -lunwind'
11+
'-fuse-ld=lld -nostdlib -nostdlib++ -L %{lib} -lunwind'
1212
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' +
1313
' -T {}'.format(libc_linker_script) +
1414
' -Wl,--defsym=__flash=0x0'

0 commit comments

Comments
 (0)