Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 5ef3156

Browse files
committed
Merge with tag release-19.1.1 from repository LLVM-embedded-toolchain-for-Arm
1 parent d32a0f6 commit 5ef3156

36 files changed

+749
-101
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,26 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
## [19.0.0]
10+
11+
### Added
12+
- AArch32 v8-A and v8-R can now be targeted (#484) (#486).
13+
- Experimental support for building llvm-libc overlay package (#452).
14+
- Additional library variants for Armv7 (#464) (#491) (#494).
15+
- Additional multilib mappings for v7ve and Thumb target triples (#479) (#481).
16+
- Omax and OmaxLTO config files (#454).
17+
918
### Changed
1019
- Use unstable libc++ ABI (#294).
20+
- Merge v7-M and v7E-M library variants (#482).
21+
- AArch64 A-profile library made distinct (#468).
22+
23+
## [18.0.0]
24+
25+
### Added
26+
27+
- Documentation for the newlib overlay package (#399).
28+
- Support for C++ exceptions and RTTI added in the standard libraries (#339).
1129

1230
## [17.0.0]
1331

CMakeLists.txt

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ set(LLVM_DISTRIBUTION_COMPONENTS
180180
llvm-readelf
181181
llvm-readobj
182182
llvm-size
183+
llvm-strings
183184
llvm-strip
184185
llvm-symbolizer
185186
LTO
@@ -279,11 +280,14 @@ endif()
279280
# ed551e0778a35f00ab60f1c80d83ea8274d8d400.
280281
set(
281282
llvm_project_patches
282-
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0001-libc-tests-with-picolibc-xfail-one-remaining-test.patch
283+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0001-libc-tests-with-picolibc-xfail-two-remaining-tests.patch
283284
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0002-libc-tests-with-picolibc-disable-large-tests.patch
284285
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0003-Disable-failing-compiler-rt-test.patch
285-
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0004-libc-tests-with-picolibc-XFAIL-uses-of-atomics.patch
286-
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0005-libc-tests-with-picolibc-mark-two-more-large-tests.patch
286+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0004-libc-tests-with-picolibc-mark-sort-test-as-long-one.patch
287+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0005-libc-tests-with-picolibc-XFAIL-uses-of-atomics.patch
288+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0006-libc-tests-with-picolibc-mark-two-more-large-tests.patch
289+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0007-Remove-ctime.timespec.compile.pass.cpp-xfail.patch
290+
${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm-project/0008-libc-AArch64-Add-an-AArch64-setjmp-longjmp-101177.patch
287291
)
288292
FetchContent_Declare(llvmproject
289293
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
@@ -393,6 +397,19 @@ if(LLVM_TOOLCHAIN_C_LIBRARY STREQUAL llvmlibc)
393397
# find one for every libc type. We have no current setup to run the LLVM
394398
# libc test suite.
395399
add_custom_target(check-llvmlibc)
400+
401+
# LLVM libc lacks a configuration for AArch64, but the AArch32 one works
402+
# fine. However, setting the configuration for both architectures to the
403+
# arm config directory means the baremetal config.json is never loaded,
404+
# as it resides in the directory above. To ensure both are used, copy
405+
# them to the same location and point libc to that.
406+
set(LIBC_CFG_DIR ${CMAKE_BINARY_DIR}/llvmlibc-config)
407+
file(COPY
408+
${llvmproject_SOURCE_DIR}/libc/config/baremetal/config.json
409+
${llvmproject_SOURCE_DIR}/libc/config/baremetal/arm/.
410+
DESTINATION
411+
${LIBC_CFG_DIR}
412+
)
396413
endif()
397414

398415
add_subdirectory(
@@ -913,8 +930,9 @@ function(
913930
${common_cmake_args}
914931
-DLIBC_TARGET_TRIPLE=${target_triple}
915932
-DLIBC_HDRGEN_EXE=${LIBC_HDRGEN}
916-
-DLIBC_CONFIG_PATH=${llvmproject_SOURCE_DIR}/libc/config/baremetal/arm # llvmlibc has no AArch64 bare-metal configuration, but the AArch32 one is fine
933+
-DLIBC_CONFIG_PATH=${LIBC_CFG_DIR}
917934
-DLIBC_CONF_TIME_64BIT=ON
935+
-DLIBC_NAMESPACE=__llvm_libc_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}_${LLVM_VERSION_PATCH} # The default namespace generated for release candidates is invalid
918936
-DLLVM_CMAKE_DIR=${LLVM_BINARY_DIR}/lib/cmake/llvm
919937
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
920938
-DLLVM_ENABLE_RUNTIMES=libc
@@ -1076,7 +1094,7 @@ Hard-float library with target triple \"${target_triple}\" must end \"-eabihf\""
10761094

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

1079-
set(compiler_rt_test_flags "${runtimes_flags} -fno-exceptions -fno-rtti -nostartfiles -lcrt0-semihost -lsemihost -T picolibcpp.ld")
1097+
set(compiler_rt_test_flags "${runtimes_flags} -fno-exceptions -fno-rtti -lcrt0-semihost -lsemihost -T picolibcpp.ld")
10801098
if(variant STREQUAL "armv6m_soft_nofp")
10811099
set(compiler_rt_test_flags "${compiler_rt_test_flags} -fomit-frame-pointer")
10821100
endif()
@@ -1203,7 +1221,6 @@ function(
12031221
-DLIBCXXABI_TEST_PARAMS=executor=${test_executor}
12041222
-DLIBCXX_ABI_UNSTABLE=ON
12051223
-DLIBCXX_CXX_ABI=libcxxabi
1206-
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON
12071224
-DLIBCXX_ENABLE_FILESYSTEM=OFF
12081225
-DLIBCXX_ENABLE_SHARED=OFF
12091226
-DLIBCXX_ENABLE_STATIC=ON
@@ -1443,6 +1460,26 @@ function(add_library_variant target_arch)
14431460
set(multilib_yaml_content "${multilib_yaml_content}" PARENT_SCOPE)
14441461
endfunction()
14451462

1463+
function(add_nonexistent_library_variant)
1464+
set(
1465+
one_value_args
1466+
MULTILIB_FLAGS
1467+
ERROR_MESSAGE
1468+
)
1469+
cmake_parse_arguments(ERR "" "${one_value_args}" "" ${ARGN})
1470+
1471+
string(APPEND multilib_yaml_content "- Error: \"${ERR_ERROR_MESSAGE}\"\n")
1472+
1473+
string(APPEND multilib_yaml_content " Flags:\n")
1474+
string(REPLACE " " ";" multilib_flags_list ${ERR_MULTILIB_FLAGS})
1475+
foreach(flag ${multilib_flags_list})
1476+
string(APPEND multilib_yaml_content " - ${flag}\n")
1477+
endforeach()
1478+
string(APPEND multilib_yaml_content " Group: stdlibs\n")
1479+
1480+
set(multilib_yaml_content "${multilib_yaml_content}" PARENT_SCOPE)
1481+
endfunction()
1482+
14461483
function(add_library_variants_for_cpu target_arch)
14471484
set(
14481485
one_value_args
@@ -1863,7 +1900,7 @@ add_library_variants_for_cpu(
18631900
add_library_variants_for_cpu(
18641901
armv8.1m.main
18651902
SUFFIX soft_nofp_nomve_pacret_bti
1866-
COMPILE_FLAGS "-mfloat-abi=soft -march=armv8.1m.main+nomve -mfpu=none -mbranch-protection=standard"
1903+
COMPILE_FLAGS "-mfloat-abi=soft -march=armv8.1m.main+nomve+pacbti -mfpu=none -mbranch-protection=standard"
18671904
MULTILIB_FLAGS "--target=thumbv8.1m.main-unknown-none-eabi -mfpu=none -mbranch-protection=standard"
18681905
PICOLIBC_BUILD_TYPE "release"
18691906
QEMU_MACHINE "mps3-an547"
@@ -1879,7 +1916,7 @@ add_library_variants_for_cpu(
18791916
add_library_variants_for_cpu(
18801917
armv8.1m.main
18811918
SUFFIX hard_fp_nomve_pacret_bti
1882-
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+nomve -mfpu=fp-armv8-fullfp16-sp-d16 -mbranch-protection=standard"
1919+
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+nomve+pacbti -mfpu=fp-armv8-fullfp16-sp-d16 -mbranch-protection=standard"
18831920
MULTILIB_FLAGS "--target=thumbv8.1m.main-unknown-none-eabihf -march=thumbv8.1m.main+fp16 -mfpu=fp-armv8-fullfp16-sp-d16 -mbranch-protection=standard"
18841921
PICOLIBC_BUILD_TYPE "release"
18851922
QEMU_MACHINE "mps3-an547"
@@ -1895,7 +1932,7 @@ add_library_variants_for_cpu(
18951932
add_library_variants_for_cpu(
18961933
armv8.1m.main
18971934
SUFFIX hard_fpdp_nomve_pacret_bti
1898-
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+nomve -mfpu=fp-armv8-fullfp16-d16 -mbranch-protection=standard"
1935+
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+nomve+pacbti -mfpu=fp-armv8-fullfp16-d16 -mbranch-protection=standard"
18991936
MULTILIB_FLAGS "--target=thumbv8.1m.main-unknown-none-eabihf -march=thumbv8.1m.main+fp16 -mfpu=fp-armv8-fullfp16-d16 -mbranch-protection=standard"
19001937
PICOLIBC_BUILD_TYPE "release"
19011938
QEMU_MACHINE "mps3-an547"
@@ -1911,7 +1948,7 @@ add_library_variants_for_cpu(
19111948
add_library_variants_for_cpu(
19121949
armv8.1m.main
19131950
SUFFIX hard_nofp_mve_pacret_bti
1914-
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+mve -mfpu=none -mbranch-protection=standard"
1951+
COMPILE_FLAGS "-mfloat-abi=hard -march=armv8.1m.main+mve+pacbti -mfpu=none -mbranch-protection=standard"
19151952
MULTILIB_FLAGS "--target=thumbv8.1m.main-unknown-none-eabihf -march=thumbv8.1m.main+mve -mfpu=none -mbranch-protection=standard"
19161953
PICOLIBC_BUILD_TYPE "release"
19171954
QEMU_MACHINE "mps3-an547"
@@ -1933,7 +1970,7 @@ configure_file(
19331970
)
19341971

19351972
set(multilib_yaml_depends
1936-
"${CMAKE_CURRENT_SOURCE_DIR}/multilib-fpus.py"
1973+
"${CMAKE_CURRENT_SOURCE_DIR}/multilib-generate.py"
19371974
"${CMAKE_CURRENT_BINARY_DIR}/multilib-without-fpus.yaml"
19381975
)
19391976
if(LIBS_DEPEND_ON_TOOLS)
@@ -1945,7 +1982,7 @@ add_custom_command(
19451982
COMMAND ${CMAKE_COMMAND} -E copy
19461983
${CMAKE_CURRENT_BINARY_DIR}/multilib-without-fpus.yaml
19471984
${CMAKE_CURRENT_BINARY_DIR}/llvm/${TARGET_LIBRARIES_DIR}${library_subdir}/multilib.yaml
1948-
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/multilib-fpus.py"
1985+
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/multilib-generate.py"
19491986
"--clang=${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}"
19501987
"--llvm-source=${llvmproject_SOURCE_DIR}"
19511988
>> "${CMAKE_CURRENT_BINARY_DIR}/llvm/${TARGET_LIBRARIES_DIR}${library_subdir}/multilib.yaml"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ embedded and realtime operating systems.
2626
- Armv4T (experimental)
2727
- Armv5TE (experimental)
2828
- Armv6 (experimental, using the Armv5TE library variant)
29-
- AArch64 armv8.0 (experimental)
29+
- Armv7-A
30+
- Armv7-R
31+
- AArch32 Armv8-A
32+
- AArch32 Armv8-R
33+
- AArch64 Armv8-A
3034

3135
## C++ support
3236

@@ -87,8 +91,6 @@ To use the toolchain, on the command line you need to provide the following opti
8791
* The FPU to use.
8892
* Disabling/enabling C++ exceptions and RTTI.
8993
* The C runtime library: either `crt0` or `crt0-semihost`.
90-
`crt0` will be linked automatically, but this can be suppressed
91-
with the `-nostartfiles` option so that `crt0-semihost` can be used.
9294
* The semihosting library, if using `crt0-semihost`.
9395
* A [linker script](
9496
https://sourceware.org/binutils/docs/ld/Scripts.html) specified with `-T`.
@@ -104,7 +106,6 @@ $ clang \
104106
-mfpu=none \
105107
-fno-exceptions \
106108
-fno-rtti \
107-
-nostartfiles \
108109
-lcrt0-semihost \
109110
-lsemihost \
110111
-T picolibc.ld \
@@ -133,7 +134,6 @@ $ clang \
133134
-mfpu=none \
134135
-fno-exceptions \
135136
-fno-rtti \
136-
-nostartfiles \
137137
-lcrt0-semihost \
138138
-lsemihost \
139139
-T picolibc.ld \

cmake/generate_version_txt.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# archive was created. This is configured in the .gitattributes file.
77
# In the former case, this script will run a Git command to find out the
88
# current revision. In the latter case the revision will be used as is.
9-
set(LLVMEmbeddedToolchainForArm_COMMIT "$Format:%H$")
9+
set(LLVMEmbeddedToolchainForArm_COMMIT "3619d0b558cbf6255794f580365038b756df12d1")
1010

1111
if(NOT ${LLVMEmbeddedToolchainForArm_COMMIT} MATCHES "^[a-f0-9]+$")
1212
execute_process(

cmake/multilib.yaml.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,3 @@ Mappings:
172172
- Match: -march=thumbv8\.[1-9]m\.main(\+[^\+]+)*\+lob(\+[^\+]+)*
173173
Flags:
174174
- -march=thumbv8.1m.main+lob
175-
176-
# -mbranch-protection options
177-
- Match: -mbranch-protection=(standard|pac-ret(\+leaf)?\+bti|bti\+pac-ret(\+leaf)?)
178-
Flags:
179-
- -mbranch-protection=pac-ret+bti

docs/llvmlibc.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ following command line options, in addition to `--target`, `-march` or
4747
the symbol `__stack` in addition to whatever other memory layout you
4848
want.
4949

50+
* `-Wl,__llvm_libc_heap_limit=0x`_nnnnnn_ if you are using the heap.
51+
The heap start defined by the value of the symbol `_end` which will
52+
be defined by the linker if no linker script is used. Alternatively
53+
use a linker script that defines the symbols `_end` and
54+
`__llvm_libc_heap_limit` in addition to whatever other memory layout
55+
you want.
56+
5057
For example:
5158

5259
```
@@ -55,9 +62,6 @@ clang --config=llvmlibc.cfg --target=arm-none-eabi -march=armv7m -o hello hello.
5562

5663
## Limitations of LLVM libc in LLVM Embedded Toolchain for Arm
5764

58-
At present, this toolchain only builds LLVM libc for AArch32, not for
59-
AArch64.
60-
6165
At present, this toolchain does not build any C++ libraries to go with
6266
LLVM libc.
6367

docs/migrating.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ however uses different command line options to control selection of semihosting.
8888

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

9595
## Linker

0 commit comments

Comments
 (0)