diff options
author | Martin Kelly <mkelly@xevo.com> | 2017-03-16 10:49:10 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2017-03-21 11:46:51 -0700 |
commit | 9660e15264bd68ce4d62b64de2ea08e6b0debf37 (patch) | |
tree | 630a18c3400243517b54b557b071b2161ffdd550 /recipes-devtools/clang/clang_git.bb | |
parent | 589360bcdaa337a125d08ad4ca66e2a19aef0aca (diff) | |
download | meta-clang-9660e15264bd68ce4d62b64de2ea08e6b0debf37.tar.gz |
clang: fix the llvm-common wrapper
The llvm-common wrapper refers to the LLVM_WANT_RELEASE variable, which is not
actually exported, so it fails. In addition, meta-clang does not support
multiple side-by-side LLVM versions anyway, so the logic isn't really needed.
After fixing these issues, I discovered that llvm-config doesn't cross-compile
properly without more extensive wrapping. Specifically, the native llvm-config
supplies --libdir, and other arguments relative to its current
executable path, so it points into the native sysroot rather than the target
sysroot. In addition, it supplies the native rather than the target compile
CFLAGS, LDFLAGS, etc.
Fix these issues by doing the following:
- Alter the llvm-config to intercept certain flags, such as --cflags, while
passing on other flags to the native llvm-config.
- Patch llvm-config to be able to specify an alternate root location on which to
base --libdir, etc. in order to optionally point into the target sysroot when
needed.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Diffstat (limited to 'recipes-devtools/clang/clang_git.bb')
-rw-r--r-- | recipes-devtools/clang/clang_git.bb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index 67b9597..28baa05 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -22,6 +22,7 @@ SRC_URI += "\ | |||
22 | file://0001-llvm-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-com.patch \ | 22 | file://0001-llvm-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-com.patch \ |
23 | file://0002-llvm-Do-not-assume-linux-glibc.patch \ | 23 | file://0002-llvm-Do-not-assume-linux-glibc.patch \ |
24 | file://0003-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ | 24 | file://0003-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ |
25 | file://0004-llvm-allow-env-override-of-exe-path.patch \ | ||
25 | " | 26 | " |
26 | 27 | ||
27 | # Clang patches | 28 | # Clang patches |
@@ -96,12 +97,6 @@ DEPENDS_remove_class-nativesdk = "nativesdk-binutils nativesdk-compiler-rt nativ | |||
96 | DEPENDS_append_class-nativesdk = " clang-native virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk" | 97 | DEPENDS_append_class-nativesdk = " clang-native virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk" |
97 | DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} ${@bb.utils.contains('TOOLCHAIN', 'gcc', 'virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++', '', d)}" | 98 | DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} ${@bb.utils.contains('TOOLCHAIN', 'gcc', 'virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++', '', d)}" |
98 | 99 | ||
99 | do_configure_prepend() { | ||
100 | # Fix paths in llvm-config | ||
101 | sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp | ||
102 | sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp | ||
103 | } | ||
104 | |||
105 | do_compile_prepend_class-native () { | 100 | do_compile_prepend_class-native () { |
106 | oe_runmake LLVM-tablegen-host | 101 | oe_runmake LLVM-tablegen-host |
107 | oe_runmake CLANG-tablegen-host | 102 | oe_runmake CLANG-tablegen-host |