forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++] Add initial support for picolibc
Picolibc is a C Standard Library that is commonly used in embedded environments. This patch adds initial support for this configuration along with pre-commit CI. As of this patch, the test suite only builds the tests and nothing is run. A follow-up patch will make the test suite actually run the tests. Differential Revision: https://reviews.llvm.org/D154246
- Loading branch information
Showing
63 changed files
with
441 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
set(CMAKE_ASM_COMPILER_TARGET "armv7m-none-eabi" CACHE STRING "") | ||
set(CMAKE_CXX_COMPILER_TARGET "armv7m-none-eabi" CACHE STRING "") | ||
set(CMAKE_CXX_FLAGS "-mfloat-abi=soft" CACHE STRING "") | ||
set(CMAKE_C_COMPILER_TARGET "armv7m-none-eabi" CACHE STRING "") | ||
set(CMAKE_C_FLAGS "-mfloat-abi=soft" CACHE STRING "") | ||
set(CMAKE_SYSTEM_NAME Generic CACHE STRING "") | ||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "") | ||
set(COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") | ||
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "") | ||
set(LIBCXXABI_BAREMETAL ON CACHE BOOL "") | ||
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "") | ||
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "") | ||
set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") | ||
set(LIBCXXABI_ENABLE_STATIC ON CACHE BOOL "") | ||
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "") | ||
set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "") | ||
set(LIBCXXABI_USE_LLVM_UNWINDER ON CACHE BOOL "") | ||
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE STRING "") | ||
set(LIBCXX_ENABLE_MONOTONIC_CLOCK OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "") | ||
set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "") | ||
set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "") | ||
set(LIBCXX_INCLUDE_BENCHMARKS OFF CACHE BOOL "") | ||
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") | ||
set(LIBUNWIND_ENABLE_SHARED OFF CACHE BOOL "") | ||
set(LIBUNWIND_ENABLE_STATIC ON CACHE BOOL "") | ||
set(LIBUNWIND_ENABLE_THREADS OFF CACHE BOOL "") | ||
set(LIBUNWIND_IS_BAREMETAL ON CACHE BOOL "") | ||
set(LIBUNWIND_REMEMBER_HEAP_ALLOC ON CACHE BOOL "") | ||
set(LIBUNWIND_USE_COMPILER_RT ON CACHE BOOL "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') | ||
|
||
libc_linker_script = '@CMAKE_INSTALL_PREFIX@/lib/picolibcpp.ld' | ||
|
||
config.substitutions.append(('%{flags}', '--sysroot=@CMAKE_INSTALL_PREFIX@')) | ||
|
||
config.substitutions.append(('%{compile_flags}', | ||
'-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support' | ||
|
||
# Disable warnings in cxx_atomic_impl.h: | ||
# "large atomic operation may incur significant performance penalty; the | ||
# access size (4 bytes) exceeds the max lock-free size (0 bytes)" | ||
' -Wno-atomic-alignment' | ||
|
||
# Various libc++ headers check for the definition of _NEWLIB_VERSION | ||
# which for picolibc is defined in picolibc.h. | ||
' -include picolibc.h' | ||
)) | ||
config.substitutions.append(('%{link_flags}', | ||
'-nostdlib -nostdlib++ -L %{lib} -lc++ -lc++abi' | ||
' -lc -lm -lclang_rt.builtins -lsemihost -lcrt0-semihost' + | ||
' -T {}'.format(libc_linker_script) + | ||
' -Wl,--defsym=__flash=0x0' | ||
' -Wl,--defsym=__flash_size=0x400000' | ||
' -Wl,--defsym=__ram=0x21000000' | ||
' -Wl,--defsym=__ram_size=0x1000000' | ||
' -Wl,--defsym=__stack_size=0x1000' | ||
)) | ||
config.substitutions.append(('%{exec}', | ||
'true' # TODO use qemu-system-arm | ||
)) | ||
config.available_features.add('libcxx-fake-executor') | ||
|
||
import os, site | ||
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils')) | ||
import libcxx.test.params, libcxx.test.config | ||
libcxx.test.config.configure( | ||
libcxx.test.params.DEFAULT_PARAMETERS, | ||
libcxx.test.features.DEFAULT_FEATURES, | ||
config, | ||
lit_config | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.