-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ORC-RT] Re-apply "Initial ORC Runtime directories and build..." with…
… fixes. This reapplies 1e1d75b, which was reverted in ce1a4d5 due to build failures. The unconditional dependencies on clang and llvm-jitlink in compiler-rt/test/orc/CMakeLists.txt have been removed -- they don't appear to be necessary, and I suspect they're the cause of the build failures seen earlier.
- Loading branch information
Showing
12 changed files
with
198 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Build for all components of the ORC runtime support library. | ||
|
||
# ORC runtime library implementation files. | ||
set(ORC_SOURCES | ||
placeholder.cpp | ||
) | ||
|
||
# Implementation files for all ORC architectures. | ||
set(x86_64_SOURCES | ||
# x86-64 specific assembly files will go here. | ||
) | ||
|
||
set(ORC_IMPL_HEADERS | ||
# Implementation headers will go here. | ||
) | ||
|
||
# Create list of all source files for | ||
# consumption by tests. | ||
set(ORC_ALL_SOURCE_FILES | ||
${ORC_SOURCES} | ||
${x86_64_SOURCES} | ||
${ORC_IMPL_HEADERS} | ||
) | ||
|
||
list(REMOVE_DUPLICATES ORC_ALL_SOURCE_FILES) | ||
|
||
# Now put it all together... | ||
include_directories(..) | ||
include_directories(../../include) | ||
|
||
set(ORC_CFLAGS ${COMPILER_RT_COMMON_CFLAGS}) | ||
|
||
# Allow the ORC runtime to reference LLVM headers. | ||
foreach (DIR ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) | ||
list(APPEND ORC_CFLAGS -I${DIR}) | ||
endforeach() | ||
|
||
add_compiler_rt_component(orc) | ||
|
||
# ORC uses C++ standard library headers. | ||
if (TARGET cxx-headers OR HAVE_LIBCXX) | ||
set(ORC_DEPS cxx-headers) | ||
endif() | ||
|
||
if (APPLE) | ||
add_compiler_rt_object_libraries(RTOrc | ||
OS ${ORC_SUPPORTED_OS} | ||
ARCHS ${ORC_SUPPORTED_ARCH} | ||
SOURCES ${ORC_SOURCES} ${x86_64_SOURCES} | ||
ADDITIONAL_HEADERS ${ORC_IMPL_HEADERS} | ||
CFLAGS ${ORC_CFLAGS} | ||
DEPS ${ORC_DEPS}) | ||
|
||
# We only support running on osx for now. | ||
add_compiler_rt_runtime(clang_rt.orc | ||
STATIC | ||
OS ${ORC_SUPPORTED_OS} | ||
ARCHS ${ORC_SUPPORTED_ARCH} | ||
OBJECT_LIBS RTOrc | ||
CFLAGS ${ORC_CFLAGS} | ||
LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS} | ||
LINK_LIBS ${ORC_LINK_LIBS} | ||
PARENT_TARGET orc) | ||
else() # not Apple | ||
foreach(arch ${ORC_SUPPORTED_ARCH}) | ||
if(NOT CAN_TARGET_${arch}) | ||
continue() | ||
endif() | ||
add_compiler_rt_object_libraries(RTOrc | ||
ARCHS ${arch} | ||
SOURCES ${ORC_SOURCES} ${${arch}_SOURCES} | ||
ADDITIONAL_HEADERS ${ORC_IMPL_HEADERS} | ||
CFLAGS $ORC_CFLAGS} | ||
DEPS ${ORC_DEPS}) | ||
|
||
# Common ORC archive for instrumented binaries. | ||
add_compiler_rt_runtime(clang_rt.orc | ||
STATIC | ||
ARCHS ${arch} | ||
CFLAGS ${ORC_CFLAGS} | ||
OBJECT_LIBS ${ORC_COMMON_RUNTIME_OBJECT_LIBS} RTOrc | ||
PARENT_TARGET orc) | ||
endforeach() | ||
endif() # not Apple |
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 @@ | ||
void placeholder(void) {} |
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,25 @@ | ||
set(ORC_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
set(ORC_TESTSUITES) | ||
set(ORC_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) | ||
|
||
set(ORC_TEST_ARCH ${ORC_SUPPORTED_ARCH}) | ||
if (COMPILER_RT_BUILD_ORC AND COMPILER_RT_HAS_ORC) | ||
foreach(arch ${ORC_TEST_ARCH}) | ||
set(ORC_TEST_TARGET_ARCH ${arch}) | ||
string(TOLOWER "-${arch}-${OS_NAME}" ORC_TEST_CONFIG_SUFFIX) | ||
get_test_cc_for_arch(${arch} ORC_TEST_TARGET_CC ORC_TEST_TARGET_CFLAGS) | ||
string(TOUPPER ${arch} ARCH_UPPER_CASE) | ||
set(CONFIG_NAME ${ARCH_UPPER_CASE}${OS_NAME}Config) | ||
|
||
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 ORC_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}) | ||
endforeach() | ||
endif() | ||
|
||
add_lit_testsuite(check-orc "Running the ORC runtime tests" | ||
${ORC_TESTSUITES} | ||
DEPENDS ${ORC_TEST_DEPS}) | ||
set_target_properties(check-orc PROPERTIES FOLDER "Compiler-RT Misc") |
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,2 @@ | ||
if config.root.host_os != 'Darwin': | ||
config.unsupported = True |
2 changes: 2 additions & 0 deletions
2
compiler-rt/test/orc/TestCases/Darwin/x86-64/lit.local.cfg.py
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,2 @@ | ||
if config.root.host_arch != 'x86_64': | ||
config.unsupported = True |
13 changes: 13 additions & 0 deletions
13
compiler-rt/test/orc/TestCases/Darwin/x86-64/placeholder_test.S
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,13 @@ | ||
// RUN: %clang -c -o %t %s | ||
// RUN: %llvm_jitlink %t | ||
|
||
.section __TEXT,__text,regular,pure_instructions | ||
.build_version macos, 11, 0 sdk_version 11, 3 | ||
|
||
.globl _main | ||
.p2align 4, 0x90 | ||
_main: | ||
xorl %eax, %eax | ||
retq | ||
|
||
.subsections_via_symbols |
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,33 @@ | ||
# -*- Python -*- | ||
|
||
import os | ||
|
||
# Setup config name. | ||
config.name = 'ORC' + config.name_suffix | ||
|
||
# Setup source root. | ||
config.test_source_root = os.path.dirname(__file__) | ||
|
||
def build_invocation(compile_flags): | ||
return ' ' + ' '.join([config.clang] + compile_flags) + ' ' | ||
|
||
# Assume that llvm-jitlink is in the config.llvm_tools_dir. | ||
llvm_jitlink = os.path.join(config.llvm_tools_dir, 'llvm-jitlink') | ||
|
||
config.substitutions.append( | ||
('%clang ', build_invocation([config.target_cflags]))) | ||
config.substitutions.append( | ||
('%clangxx ', | ||
build_invocation(config.cxx_mode_flags + [config.target_cflags]))) | ||
config.substitutions.append( | ||
('%llvm_jitlink', llvm_jitlink)) | ||
config.substitutions.append( | ||
('%orc_rt', | ||
('-L%s -lclang_rt.orc%s') | ||
% (config.compiler_rt_libdir, config.target_suffix))) | ||
|
||
# Default test suffixes. | ||
config.suffixes = ['.c', '.cpp', '.S'] | ||
|
||
if config.host_os not in ['Darwin']: | ||
config.unsupported = True |
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,14 @@ | ||
@LIT_SITE_CFG_IN_HEADER@ | ||
|
||
# Tool-specific config options. | ||
config.name_suffix = "@ORC_TEST_CONFIG_SUFFIX@" | ||
config.orc_lit_source_dir = "@ORC_LIT_SOURCE_DIR@" | ||
config.target_cflags = "@ORC_TEST_TARGET_CFLAGS@" | ||
config.target_arch = "@ORC_TEST_TARGET_ARCH@" | ||
config.built_with_llvm = ("@COMPILER_RT_STANDALONE_BUILD@" != "TRUE") | ||
|
||
# Load common config for all compiler-rt lit tests | ||
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") | ||
|
||
# Load tool-specific config that would do the real work. | ||
lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg.py") |