Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "[compiler-rt] Move crt into builtins"
- Loading branch information
Showing
16 changed files
with
234 additions
and
129 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | ||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | ||
project(CompilerRTCRT C) | ||
set(COMPILER_RT_STANDALONE_BUILD TRUE) | ||
set(COMPILER_RT_CRT_STANDALONE_BUILD TRUE) | ||
|
||
set(COMPILER_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") | ||
|
||
set(LLVM_COMMON_CMAKE_UTILS "${COMPILER_RT_SOURCE_DIR}/../cmake") | ||
|
||
# Add path for custom modules | ||
list(INSERT CMAKE_MODULE_PATH 0 | ||
"${COMPILER_RT_SOURCE_DIR}/cmake" | ||
"${COMPILER_RT_SOURCE_DIR}/cmake/Modules" | ||
"${LLVM_COMMON_CMAKE_UTILS}" | ||
"${LLVM_COMMON_CMAKE_UTILS}/Modules" | ||
) | ||
|
||
include(base-config-ix) | ||
include(CompilerRTUtils) | ||
|
||
load_llvm_config() | ||
construct_compiler_rt_default_triple() | ||
|
||
include(SetPlatformToolchainTools) | ||
include(AddCompilerRT) | ||
endif() | ||
|
||
include(crt-config-ix) | ||
|
||
if(COMPILER_RT_HAS_CRT) | ||
add_compiler_rt_component(crt) | ||
|
||
include(CheckSectionExists) | ||
check_section_exists(".init_array" COMPILER_RT_HAS_INITFINI_ARRAY | ||
SOURCE "volatile int x;\n__attribute__((constructor)) void f(void) {x = 0;}\nint main(void) { return 0; }\n") | ||
|
||
append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 CRT_CFLAGS) | ||
append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) | ||
append_list_if(COMPILER_RT_CRT_USE_EH_FRAME_REGISTRY -DEH_USE_FRAME_REGISTRY CRT_CFLAGS) | ||
append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC CRT_CFLAGS) | ||
append_list_if(COMPILER_RT_HAS_WNO_PEDANTIC -Wno-pedantic CRT_CFLAGS) | ||
if (COMPILER_RT_HAS_FCF_PROTECTION_FLAG) | ||
append_list_if(COMPILER_RT_ENABLE_CET -fcf-protection=full CRT_CFLAGS) | ||
endif() | ||
|
||
foreach(arch ${CRT_SUPPORTED_ARCH}) | ||
add_compiler_rt_runtime(clang_rt.crtbegin | ||
OBJECT | ||
ARCHS ${arch} | ||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtbegin.c | ||
CFLAGS ${CRT_CFLAGS} | ||
PARENT_TARGET crt) | ||
add_compiler_rt_runtime(clang_rt.crtend | ||
OBJECT | ||
ARCHS ${arch} | ||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/crtend.c | ||
CFLAGS ${CRT_CFLAGS} | ||
PARENT_TARGET crt) | ||
endforeach() | ||
endif() |
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
include(crt-config-ix) | ||
|
||
if (COMPILER_RT_HAS_CRT) | ||
set(CRT_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
if(NOT COMPILER_RT_STANDALONE_BUILD) | ||
list(APPEND CRT_TEST_DEPS crt) | ||
endif() | ||
if(NOT COMPILER_RT_STANDALONE_BUILD AND NOT LLVM_RUNTIMES_BUILD) | ||
# Use LLVM utils and Clang from the same build tree. | ||
list(APPEND CRT_TEST_DEPS | ||
clang clang-resource-headers FileCheck not llvm-config) | ||
endif() | ||
|
||
set(CRT_TEST_ARCH ${CRT_SUPPORTED_ARCH}) | ||
foreach(arch ${CRT_TEST_ARCH}) | ||
set(CRT_TEST_TARGET_ARCH ${arch}) | ||
string(TOLOWER "-${arch}-${OS_NAME}" CRT_TEST_CONFIG_SUFFIX) | ||
get_test_cc_for_arch(${arch} CRT_TEST_TARGET_CC CRT_TEST_TARGET_CFLAGS) | ||
string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config) | ||
|
||
if (COMPILER_RT_ENABLE_CET) | ||
if (${arch} MATCHES "i386|x86_64") | ||
list(APPEND CRT_TEST_TARGET_CFLAGS -fcf-protection=full) | ||
string(REPLACE ";" " " CRT_TEST_TARGET_CFLAGS "${CRT_TEST_TARGET_CFLAGS}") | ||
else() | ||
message(FATAL_ERROR "The target arch ${arch} doesn't support CET") | ||
endif() | ||
endif() | ||
configure_lit_site_cfg( | ||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py) | ||
list(APPEND CRT_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) | ||
endforeach() | ||
|
||
add_lit_testsuite(check-crt "Running the CRT tests" | ||
${CRT_TESTSUITES} | ||
DEPENDS ${CRT_TEST_DEPS}) | ||
set_target_properties(check-crt PROPERTIES FOLDER "Compiler-RT Misc") | ||
endif() |
2 changes: 0 additions & 2 deletions
2
compiler-rt/test/builtins/Unit/ctor_dtor.c → compiler-rt/test/crt/ctor_dtor.c
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
6 changes: 2 additions & 4 deletions
6
...iler-rt/test/builtins/Unit/dso_handle.cpp → compiler-rt/test/crt/dso_handle.cpp
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.