diff --git a/clang/cmake/caches/CrossWinToARMLinux.cmake b/clang/cmake/caches/CrossWinToARMLinux.cmake --- a/clang/cmake/caches/CrossWinToARMLinux.cmake +++ b/clang/cmake/caches/CrossWinToARMLinux.cmake @@ -101,6 +101,7 @@ set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") set(COMPILER_RT_BUILD_CRT OFF CACHE BOOL "") +set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "") set(COMPILER_RT_INCLUDE_TESTS ON CACHE BOOL "") diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake --- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake +++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake @@ -78,5 +78,5 @@ set(ALL_SHADOWCALLSTACK_SUPPORTED_ARCH ${ARM64}) if (UNIX) -set(ALL_ORC_SUPPORTED_ARCH ${X86_64}) +set(ALL_ORC_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM32}) endif() diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -480,6 +480,7 @@ list(APPEND PROFILE_SUPPORTED_OS ${platform}sim) list(APPEND TSAN_SUPPORTED_OS ${platform}sim) list(APPEND FUZZER_SUPPORTED_OS ${platform}sim) + list(APPEND ORC_SUPPORTED_OS ${platform}sim) endif() foreach(arch ${DARWIN_${platform}sim_ARCHS}) list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) @@ -510,6 +511,7 @@ list(APPEND TSAN_SUPPORTED_OS ${platform}) endif() list(APPEND FUZZER_SUPPORTED_OS ${platform}) + list(APPEND ORC_SUPPORTED_OS ${platform}) endif() foreach(arch ${DARWIN_${platform}_ARCHS}) list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch}) diff --git a/compiler-rt/lib/orc/CMakeLists.txt b/compiler-rt/lib/orc/CMakeLists.txt --- a/compiler-rt/lib/orc/CMakeLists.txt +++ b/compiler-rt/lib/orc/CMakeLists.txt @@ -10,8 +10,7 @@ ) # Implementation files for all ORC architectures. -set(x86_64_SOURCES -# x86-64 specific assembly files will go here. +set(ALL_ORC_ASM_SOURCES macho_tlv.x86-64.S elfnix_tls.x86-64.S ) @@ -36,7 +35,7 @@ # consumption by tests. set(ORC_ALL_SOURCE_FILES ${ORC_SOURCES} - ${x86_64_SOURCES} + ${ALL_ORC_ASM_SOURCES} ${ORC_IMPL_HEADERS} ) @@ -61,17 +60,16 @@ endif() if (APPLE) - add_asm_sources(ORC_ASM_SOURCES macho_tlv.x86-64.S) + add_asm_sources(ORC_ASM_SOURCES macho_tlv.x86-64.S) add_compiler_rt_object_libraries(RTOrc OS ${ORC_SUPPORTED_OS} ARCHS ${ORC_SUPPORTED_ARCH} - SOURCES ${ORC_SOURCES} ${x86_64_SOURCES} + SOURCES ${ORC_SOURCES} ${ORC_ASM_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} @@ -82,13 +80,16 @@ LINK_LIBS ${ORC_LINK_LIBS} PARENT_TARGET orc) else() # not Apple + add_asm_sources(ORC_ASM_SOURCES elfnix_tls.x86-64.S) + 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} + SOURCES ${ORC_SOURCES} ${ORC_ASM_SOURCES} ADDITIONAL_HEADERS ${ORC_IMPL_HEADERS} CFLAGS ${ORC_CFLAGS} DEPS ${ORC_DEPS}) diff --git a/compiler-rt/lib/orc/elfnix_tls.x86-64.S b/compiler-rt/lib/orc/elfnix_tls.x86-64.S --- a/compiler-rt/lib/orc/elfnix_tls.x86-64.S +++ b/compiler-rt/lib/orc/elfnix_tls.x86-64.S @@ -11,6 +11,9 @@ // //===----------------------------------------------------------------------===// +// The content of this file is x86_64-only +#if defined(__x86_64__) + #define REGISTER_SAVE_SPACE_SIZE 512 .text @@ -57,3 +60,5 @@ addq $REGISTER_SAVE_SPACE_SIZE, %rsp popq %rbp ret + +#endif // defined(__x86_64__) diff --git a/compiler-rt/lib/orc/macho_tlv.x86-64.S b/compiler-rt/lib/orc/macho_tlv.x86-64.S --- a/compiler-rt/lib/orc/macho_tlv.x86-64.S +++ b/compiler-rt/lib/orc/macho_tlv.x86-64.S @@ -10,6 +10,9 @@ // //===----------------------------------------------------------------------===// +// The content of this file is x86_64-only +#if defined(__x86_64__) + #define REGISTER_SAVE_SPACE_SIZE 512 .text @@ -66,3 +69,5 @@ addq $REGISTER_SAVE_SPACE_SIZE, %rsp popq %rbp ret + +#endif // defined(__x86_64__) diff --git a/compiler-rt/lib/orc/simple_packed_serialization.h b/compiler-rt/lib/orc/simple_packed_serialization.h --- a/compiler-rt/lib/orc/simple_packed_serialization.h +++ b/compiler-rt/lib/orc/simple_packed_serialization.h @@ -396,10 +396,12 @@ uint64_t Size; if (!SPSArgList::deserialize(IB, Size)) return false; + if (Size > std::numeric_limits::max()) + return false; Data = IB.data(); if (!IB.skip(Size)) return false; - S = {Data, Size}; + S = {Data, static_cast(Size)}; return true; } };