diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-03-15 05:31:09 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2016-03-15 05:31:09 +0000 |
commit | b6ed7cd424609291b39622ca15a8e5b3fef46599 (patch) | |
tree | 9521ed7560466fc92a9f6a8297603c5fb80f5bbb | |
parent | efd9112095b216b5fd20523147650b0f4147e62f (diff) | |
download | meta-clang-b6ed7cd424609291b39622ca15a8e5b3fef46599.tar.gz |
clang: Fix build on musl
Move -L flags to LDFLAGS, avoid compiler warnings
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 129 insertions, 1 deletions
diff --git a/recipes-devtools/clang/clang/0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch b/recipes-devtools/clang/clang/0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch new file mode 100644 index 0000000..76ee9a2 --- /dev/null +++ b/recipes-devtools/clang/clang/0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch | |||
@@ -0,0 +1,96 @@ | |||
1 | From 01501b1e05e60ab5446fa12a15071049f07e3ae0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 15 Mar 2016 05:25:36 +0000 | ||
4 | Subject: [PATCH 1/2] remove fopen64/fseeko64/ftello64/tmpfile64 on musl | ||
5 | |||
6 | They are not available | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | include/llvm/Analysis/TargetLibraryInfo.def | 12 ------------ | ||
11 | lib/Transforms/IPO/InferFunctionAttrs.cpp | 25 ------------------------- | ||
12 | 2 files changed, 37 deletions(-) | ||
13 | |||
14 | diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def | ||
15 | index 7798e3c..65158b8 100644 | ||
16 | --- a/include/llvm/Analysis/TargetLibraryInfo.def | ||
17 | +++ b/include/llvm/Analysis/TargetLibraryInfo.def | ||
18 | @@ -525,9 +525,6 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") | ||
19 | /// FILE *fopen(const char *filename, const char *mode); | ||
20 | TLI_DEFINE_ENUM_INTERNAL(fopen) | ||
21 | TLI_DEFINE_STRING_INTERNAL("fopen") | ||
22 | -/// FILE *fopen64(const char *filename, const char *opentype) | ||
23 | -TLI_DEFINE_ENUM_INTERNAL(fopen64) | ||
24 | -TLI_DEFINE_STRING_INTERNAL("fopen64") | ||
25 | /// int fprintf(FILE *stream, const char *format, ...); | ||
26 | TLI_DEFINE_ENUM_INTERNAL(fprintf) | ||
27 | TLI_DEFINE_STRING_INTERNAL("fprintf") | ||
28 | @@ -561,9 +558,6 @@ TLI_DEFINE_STRING_INTERNAL("fseek") | ||
29 | /// int fseeko(FILE *stream, off_t offset, int whence); | ||
30 | TLI_DEFINE_ENUM_INTERNAL(fseeko) | ||
31 | TLI_DEFINE_STRING_INTERNAL("fseeko") | ||
32 | -/// int fseeko64(FILE *stream, off64_t offset, int whence) | ||
33 | -TLI_DEFINE_ENUM_INTERNAL(fseeko64) | ||
34 | -TLI_DEFINE_STRING_INTERNAL("fseeko64") | ||
35 | /// int fsetpos(FILE *stream, const fpos_t *pos); | ||
36 | TLI_DEFINE_ENUM_INTERNAL(fsetpos) | ||
37 | TLI_DEFINE_STRING_INTERNAL("fsetpos") | ||
38 | @@ -585,9 +579,6 @@ TLI_DEFINE_STRING_INTERNAL("ftell") | ||
39 | /// off_t ftello(FILE *stream); | ||
40 | TLI_DEFINE_ENUM_INTERNAL(ftello) | ||
41 | TLI_DEFINE_STRING_INTERNAL("ftello") | ||
42 | -/// off64_t ftello64(FILE *stream) | ||
43 | -TLI_DEFINE_ENUM_INTERNAL(ftello64) | ||
44 | -TLI_DEFINE_STRING_INTERNAL("ftello64") | ||
45 | /// int ftrylockfile(FILE *file); | ||
46 | TLI_DEFINE_ENUM_INTERNAL(ftrylockfile) | ||
47 | TLI_DEFINE_STRING_INTERNAL("ftrylockfile") | ||
48 | @@ -1050,9 +1041,6 @@ TLI_DEFINE_STRING_INTERNAL("times") | ||
49 | /// FILE *tmpfile(void); | ||
50 | TLI_DEFINE_ENUM_INTERNAL(tmpfile) | ||
51 | TLI_DEFINE_STRING_INTERNAL("tmpfile") | ||
52 | -/// FILE *tmpfile64(void) | ||
53 | -TLI_DEFINE_ENUM_INTERNAL(tmpfile64) | ||
54 | -TLI_DEFINE_STRING_INTERNAL("tmpfile64") | ||
55 | /// int toascii(int c); | ||
56 | TLI_DEFINE_ENUM_INTERNAL(toascii) | ||
57 | TLI_DEFINE_STRING_INTERNAL("toascii") | ||
58 | diff --git a/lib/Transforms/IPO/InferFunctionAttrs.cpp b/lib/Transforms/IPO/InferFunctionAttrs.cpp | ||
59 | index 4295a75..f6d19eb 100644 | ||
60 | --- a/lib/Transforms/IPO/InferFunctionAttrs.cpp | ||
61 | +++ b/lib/Transforms/IPO/InferFunctionAttrs.cpp | ||
62 | @@ -844,31 +844,6 @@ static bool inferPrototypeAttributes(Function &F, | ||
63 | Changed |= setOnlyReadsMemory(F, 1); | ||
64 | Changed |= setOnlyReadsMemory(F, 2); | ||
65 | return Changed; | ||
66 | - case LibFunc::fopen64: | ||
67 | - if (FTy->getNumParams() != 2 || !FTy->getReturnType()->isPointerTy() || | ||
68 | - !FTy->getParamType(0)->isPointerTy() || | ||
69 | - !FTy->getParamType(1)->isPointerTy()) | ||
70 | - return false; | ||
71 | - Changed |= setDoesNotThrow(F); | ||
72 | - Changed |= setDoesNotAlias(F, 0); | ||
73 | - Changed |= setDoesNotCapture(F, 1); | ||
74 | - Changed |= setDoesNotCapture(F, 2); | ||
75 | - Changed |= setOnlyReadsMemory(F, 1); | ||
76 | - Changed |= setOnlyReadsMemory(F, 2); | ||
77 | - return Changed; | ||
78 | - case LibFunc::fseeko64: | ||
79 | - case LibFunc::ftello64: | ||
80 | - if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) | ||
81 | - return false; | ||
82 | - Changed |= setDoesNotThrow(F); | ||
83 | - Changed |= setDoesNotCapture(F, 1); | ||
84 | - return Changed; | ||
85 | - case LibFunc::tmpfile64: | ||
86 | - if (!FTy->getReturnType()->isPointerTy()) | ||
87 | - return false; | ||
88 | - Changed |= setDoesNotThrow(F); | ||
89 | - Changed |= setDoesNotAlias(F, 0); | ||
90 | - return Changed; | ||
91 | case LibFunc::fstat64: | ||
92 | case LibFunc::fstatvfs64: | ||
93 | if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) | ||
94 | -- | ||
95 | 1.9.1 | ||
96 | |||
diff --git a/recipes-devtools/clang/clang/0002-Do-not-assume-linux-glibc.patch b/recipes-devtools/clang/clang/0002-Do-not-assume-linux-glibc.patch new file mode 100644 index 0000000..d194898 --- /dev/null +++ b/recipes-devtools/clang/clang/0002-Do-not-assume-linux-glibc.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 9f7b677d3a6582b232e16cb5518935633b2e65fb Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 15 Mar 2016 05:26:47 +0000 | ||
4 | Subject: [PATCH 2/2] Do not assume linux == glibc | ||
5 | |||
6 | musl's implementation of std functions is different | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | lib/Support/DynamicLibrary.cpp | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp | ||
14 | index 9a7aeb5..e3b7fe2 100644 | ||
15 | --- a/lib/Support/DynamicLibrary.cpp | ||
16 | +++ b/lib/Support/DynamicLibrary.cpp | ||
17 | @@ -143,7 +143,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { | ||
18 | // On linux we have a weird situation. The stderr/out/in symbols are both | ||
19 | // macros and global variables because of standards requirements. So, we | ||
20 | // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. | ||
21 | -#if defined(__linux__) and !defined(__ANDROID__) | ||
22 | +#if defined(__linux__) and defined(__GLIBC__) | ||
23 | { | ||
24 | EXPLICIT_SYMBOL(stderr); | ||
25 | EXPLICIT_SYMBOL(stdout); | ||
26 | -- | ||
27 | 1.9.1 | ||
28 | |||
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index bbc6f7b..698c7b4 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb | |||
@@ -16,8 +16,11 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa; \ | |||
16 | SRC_URI = "${LLVM_GIT}/llvm.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=llvm \ | 16 | SRC_URI = "${LLVM_GIT}/llvm.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};name=llvm \ |
17 | ${LLVM_GIT}/clang.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ | 17 | ${LLVM_GIT}/clang.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH};destsuffix=git/tools/clang;name=clang \ |
18 | file://0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch \ | 18 | file://0001-Remove-CMAKE_CROSSCOMPILING-so-it-can-cross-compile.patch \ |
19 | file://0002-Do-not-assume-linux-glibc.patch \ | ||
19 | " | 20 | " |
20 | 21 | ||
22 | SRC_URI_append_libc-musl_class-target = " file://0001-remove-fopen64-fseeko64-ftello64-tmpfile64-on-musl.patch " | ||
23 | |||
21 | SRCREV_FORMAT = "llvm_clang" | 24 | SRCREV_FORMAT = "llvm_clang" |
22 | 25 | ||
23 | INHIBIT_DEFAULT_DEPS = "1" | 26 | INHIBIT_DEFAULT_DEPS = "1" |
@@ -45,7 +48,8 @@ def get_clang_target_arch(bb, d): | |||
45 | #TUNE_CCARGS_remove = "-mthumb-interwork" | 48 | #TUNE_CCARGS_remove = "-mthumb-interwork" |
46 | #TUNE_CCARGS_remove = "-march=armv7-a" | 49 | #TUNE_CCARGS_remove = "-march=armv7-a" |
47 | #TUNE_CCARGS_remove = "-marm" | 50 | #TUNE_CCARGS_remove = "-marm" |
48 | TUNE_CCARGS_append_class-target = " -D__extern_always_inline=inline -L${PKG_CONFIG_SYSROOT_DIR}${libdir}/libxml2 -I${PKG_CONFIG_SYSROOT_DIR}${includedir}/libxml2 " | 51 | TUNE_CCARGS_append_class-target = " -D__extern_always_inline=inline -I${PKG_CONFIG_SYSROOT_DIR}${includedir}/libxml2 " |
52 | LDFLAGS_append_class-target = " -L${PKG_CONFIG_SYSROOT_DIR}${libdir}/libxml2 " | ||
49 | 53 | ||
50 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI:BOOL=True \ | 54 | EXTRA_OECMAKE="-DLLVM_ENABLE_RTTI:BOOL=True \ |
51 | -DLLVM_ENABLE_FFI:BOOL=False \ | 55 | -DLLVM_ENABLE_FFI:BOOL=False \ |