From 35258485141631fd2eff4d668cb5e033b4920ea7 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 3 Apr 2016 18:11:11 +0000 Subject: compiler-rt: Fix target build Switch to using cmake disable sanitizers since it does not yet cross compile Signed-off-by: Khem Raj --- ...oss-compilation.-Don-t-use-native-compile.patch | 67 ++++++++++++++++++++++ ...nt-include-stdlib.h-and-limits.h-together.patch | 65 +++++++++++++++++++++ recipes-devtools/clang/compiler-rt_git.bb | 23 +++++--- 3 files changed, 146 insertions(+), 9 deletions(-) create mode 100644 recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch create mode 100644 recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch diff --git a/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch b/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch new file mode 100644 index 0000000..67b0e73 --- /dev/null +++ b/recipes-devtools/clang/compiler-rt/0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch @@ -0,0 +1,67 @@ +From 6ca47f1d7d4f9fd34baeba86af67108ac0eaeffe Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 3 Apr 2016 07:40:06 +0000 +Subject: [PATCH] Simplify cross-compilation. Don't use native-compiled + llvm-config. + + Note: AddLLVM.cmake does not expose the LLVM source directory. + So if you want to run the test suite, you need to either: + + 1) set LLVM_MAIN_SRC_DIR explicitly (to find lit.py) + 2) change AddLLVM.cmake to point to an installed 'lit'. + 3) add_subdirectory(compiler-rt/test) from clang instead of compiler-rt. + +https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.patch + +Signed-off-by: Greg Fitzgerald +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 32 ++++++-------------------------- + 1 file changed, 6 insertions(+), 26 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c60c246..6f989bf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -85,32 +85,12 @@ else() + set(COMPILER_RT_TEST_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "Compiler to use for testing") + set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing") + +- if (NOT LLVM_CONFIG_PATH) +- find_program(LLVM_CONFIG_PATH "llvm-config" +- DOC "Path to llvm-config binary") +- if (NOT LLVM_CONFIG_PATH) +- message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH") +- endif() +- endif() +- execute_process( +- COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root" +- RESULT_VARIABLE HAD_ERROR +- OUTPUT_VARIABLE CONFIG_OUTPUT) +- if (HAD_ERROR) +- message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}") +- endif() +- string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT}) +- list(GET CONFIG_OUTPUT 0 LLVM_BINARY_DIR) +- list(GET CONFIG_OUTPUT 1 LLVM_TOOLS_BINARY_DIR) +- list(GET CONFIG_OUTPUT 2 LLVM_LIBRARY_DIR) +- list(GET CONFIG_OUTPUT 3 LLVM_MAIN_SRC_DIR) +- +- # Make use of LLVM CMake modules. +- file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE) +- set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/share/llvm/cmake") +- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") +- # Get some LLVM variables from LLVMConfig. +- include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake") ++ find_package(LLVM REQUIRED) ++ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") ++ ++ # Variables that AddLLVM.cmake depends on (included by AddCompilerRT) ++ set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin") ++ set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib") + + set(LLVM_LIBRARY_OUTPUT_INTDIR + ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) +-- +1.9.1 + diff --git a/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch b/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch new file mode 100644 index 0000000..166ddf8 --- /dev/null +++ b/recipes-devtools/clang/compiler-rt/0001-dont-include-stdlib.h-and-limits.h-together.patch @@ -0,0 +1,65 @@ +From 69e09408a6a8ddb08d3f148c0eeba68714c1891b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 3 Apr 2016 07:59:59 +0000 +Subject: [PATCH] dont include stdlib.h and limits.h together + +Signed-off-by: Khem Raj +--- + lib/profile/InstrProfiling.c | 2 +- + lib/profile/InstrProfilingValue.c | 2 +- + lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/profile/InstrProfiling.c b/lib/profile/InstrProfiling.c +index 711f2b6..9028be5 100644 +--- a/lib/profile/InstrProfiling.c ++++ b/lib/profile/InstrProfiling.c +@@ -9,9 +9,9 @@ + + #include "InstrProfiling.h" + #include "InstrProfilingInternal.h" ++#include + #include + #include +-#include + #include + #define INSTR_PROF_VALUE_PROF_DATA + #include "InstrProfData.inc" +diff --git a/lib/profile/InstrProfilingValue.c b/lib/profile/InstrProfilingValue.c +index 68e16cf..d04cc30 100644 +--- a/lib/profile/InstrProfilingValue.c ++++ b/lib/profile/InstrProfilingValue.c +@@ -9,9 +9,9 @@ + + #include "InstrProfiling.h" + #include "InstrProfilingInternal.h" +-#include + #include + #include ++#include + #include + #define INSTR_PROF_VALUE_PROF_DATA + #define INSTR_PROF_COMMON_API_IMPL +diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +index b642cba..5d7edcb 100644 +--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -32,7 +32,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -51,6 +50,7 @@ + #include + #include + #include ++//#include + + #if !SANITIZER_IOS + #include +-- +1.9.1 + diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb index 2b2ba45..f07f20d 100644 --- a/recipes-devtools/clang/compiler-rt_git.bb +++ b/recipes-devtools/clang/compiler-rt_git.bb @@ -10,30 +10,35 @@ INHIBIT_DEFAULT_DEPS = "1" DEPENDS += "clang-cross-${TARGET_ARCH}" require clang.inc + PV .= "+git${SRCPV}" LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362; \ " SRC_URI = "${LLVM_GIT}/compiler-rt.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=compiler-rt \ file://0001-support-a-new-embedded-linux-target.patch \ + file://0001-Simplify-cross-compilation.-Don-t-use-native-compile.patch \ + file://0001-dont-include-stdlib.h-and-limits.h-together.patch \ " SRCREV_FORMAT = "compiler-rt" S = "${WORKDIR}/git" -THUMB_TUNE_CCARGS = "" -TUNE_CCARGS += "-ffreestanding -nostdlib" +inherit cmake pkgconfig pythonnative -EXTRA_OEMAKE += "REQUIRES_RTTI=1 VERBOSE=1" +THUMB_TUNE_CCARGS = "" -do_configure () { - : -} +EXTRA_OECMAKE += "-DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ + -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ + -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${MULTIMACH_HOST_SYS} \ +" -do_compile () { - cd ${B} - oe_runmake VERBOSE=1 clang_linux +do_install_append () { + install -d ${D}${base_libdir} + mv ${D}${libdir}/linux/*.a ${D}${base_libdir} + rmdir ${D}${libdir}/linux + rmdir ${D}${libdir} } #PROVIDES_append_class-target = "\ -- cgit v1.2.3-54-g00ecf