summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/llvm')
-rw-r--r--meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch114
-rw-r--r--meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch (renamed from meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch)31
-rw-r--r--meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch38
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb10
4 files changed, 59 insertions, 134 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
deleted file mode 100644
index 1369bcf78c..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0002-llvm-allow-env-override-of-exe-path.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1From 0570fe02c07244a8724c1e6c0437f893c8aa8e93 Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH 2/2] llvm: allow env override of exe path
5
6When using a native llvm-config from inside a sysroot, we need llvm-config to
7return the libraries, include directories, etc. from inside the sysroot rather
8than from the native sysroot. Thus provide an env override for calling
9llvm-config from a target sysroot.
10
11To let it work in multilib environment, we need to provide a knob to supply
12multilib dirname as well
13
14Upstream-Status: Inappropriate [OE-Specific]
15
16Signed-off-by: Martin Kelly <mkelly@xevo.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 tools/llvm-config/llvm-config.cpp | 35 ++++++++++++++++++++++---------
20 1 file changed, 25 insertions(+), 10 deletions(-)
21
22diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
23index bec89fef98c..91b4d6e4c43 100644
24--- a/tools/llvm-config/llvm-config.cpp
25+++ b/tools/llvm-config/llvm-config.cpp
26@@ -226,6 +226,13 @@ Typical components:\n\
27
28 /// Compute the path to the main executable.
29 std::string GetExecutablePath(const char *Argv0) {
30+ // Hack for Yocto: we need to override the root path when we are using
31+ // llvm-config from within a target sysroot.
32+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
33+ if (Sysroot != nullptr) {
34+ return Sysroot;
35+ }
36+
37 // This just needs to be some symbol in the binary; C++ doesn't
38 // allow taking the address of ::main however.
39 void *P = (void *)(intptr_t)GetExecutablePath;
40@@ -284,7 +291,7 @@ int main(int argc, char **argv) {
41 // bin dir).
42 sys::fs::make_absolute(CurrentPath);
43 CurrentExecPrefix =
44- sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
45+ sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str();
46
47 // Check to see if we are inside a development tree by comparing to possible
48 // locations (prefix style or CMake style).
49@@ -293,7 +300,7 @@ int main(int argc, char **argv) {
50 DevelopmentTreeLayout = CMakeStyle;
51 ActiveObjRoot = LLVM_OBJ_ROOT;
52 } else if (sys::fs::equivalent(CurrentExecPrefix,
53- Twine(LLVM_OBJ_ROOT) + "/bin")) {
54+ Twine(LLVM_OBJ_ROOT) + "/bin/llvm8.0.0")) {
55 IsInDevelopmentTree = true;
56 DevelopmentTreeLayout = CMakeBuildModeStyle;
57 ActiveObjRoot = LLVM_OBJ_ROOT;
58@@ -307,37 +314,45 @@ int main(int argc, char **argv) {
59 std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
60 ActiveCMakeDir;
61 std::string ActiveIncludeOption;
62+ // Hack for Yocto: we need to override the multilib path when we are using
63+ // llvm-config from within a target sysroot.
64+ std::string Multilibdir = std::getenv("YOCTO_ALTERNATE_MULTILIB_NAME");
65+ if (Multilibdir.empty()) {
66+ Multilibdir = "/lib/llvm8.0.0" LLVM_LIBDIR_SUFFIX;
67+ }
68+
69 if (IsInDevelopmentTree) {
70- ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
71+ ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include/llvm8.0.0";
72 ActivePrefix = CurrentExecPrefix;
73
74 // CMake organizes the products differently than a normal prefix style
75 // layout.
76+
77 switch (DevelopmentTreeLayout) {
78 case CMakeStyle:
79- ActiveBinDir = ActiveObjRoot + "/bin";
80- ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
81+ ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0.0";
82+ ActiveLibDir = ActiveObjRoot + "/lib/llvm8.0.0" + LLVM_LIBDIR_SUFFIX;
83 ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
84 break;
85 case CMakeBuildModeStyle:
86 ActivePrefix = ActiveObjRoot;
87- ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
88+ ActiveBinDir = ActiveObjRoot + "/bin/llvm8.0.0/" + build_mode;
89 ActiveLibDir =
90- ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
91+ ActiveObjRoot + "/lib/llvm8.0.0" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
92 ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
93 break;
94 }
95
96 // We need to include files from both the source and object trees.
97 ActiveIncludeOption =
98- ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
99+ ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include/llvm8.0.0");
100 } else {
101 ActivePrefix = CurrentExecPrefix;
102- ActiveIncludeDir = ActivePrefix + "/include";
103+ ActiveIncludeDir = ActivePrefix + "/include/llvm8.0.0";
104 SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
105 sys::fs::make_absolute(ActivePrefix, path);
106 ActiveBinDir = path.str();
107- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
108+ ActiveLibDir = ActivePrefix + Multilibdir;
109 ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
110 ActiveIncludeOption = "-I" + ActiveIncludeDir;
111 }
112--
1132.20.1
114
diff --git a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index 6dbbced7eb..789c308863 100644
--- a/meta/recipes-devtools/llvm/llvm/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/meta/recipes-devtools/llvm/llvm/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -1,7 +1,8 @@
1From 905cac8934fb17e20416a4df712a566e757471a3 Mon Sep 17 00:00:00 2001 1From 4c08879d2dfbe7face4e679ac8499dc7bff2dd20 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 21 May 2016 00:33:20 +0000 3Date: Sat, 21 May 2016 00:33:20 +0000
4Subject: [PATCH 1/2] llvm: TargetLibraryInfo: Undefine libc functions if they are macros 4Subject: [PATCH 06/19] llvm: TargetLibraryInfo: Undefine libc functions if
5 they are macros
5 6
6musl defines some functions as macros and not inline functions 7musl defines some functions as macros and not inline functions
7if this is the case then make sure to undefine them 8if this is the case then make sure to undefine them
@@ -9,14 +10,14 @@ if this is the case then make sure to undefine them
9Upstream-Status: Pending 10Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
11--- 12---
12 include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++ 13 .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++
13 1 file changed, 21 insertions(+) 14 1 file changed, 21 insertions(+)
14 15
15diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def 16diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
16index 518a85ee1a0..6b4ead4efc6 100644 17index afed404f04c..876888656f2 100644
17--- a/include/llvm/Analysis/TargetLibraryInfo.def 18--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
18+++ b/include/llvm/Analysis/TargetLibraryInfo.def 19+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
19@@ -731,6 +731,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") 20@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
20 TLI_DEFINE_ENUM_INTERNAL(fopen) 21 TLI_DEFINE_ENUM_INTERNAL(fopen)
21 TLI_DEFINE_STRING_INTERNAL("fopen") 22 TLI_DEFINE_STRING_INTERNAL("fopen")
22 /// FILE *fopen64(const char *filename, const char *opentype) 23 /// FILE *fopen64(const char *filename, const char *opentype)
@@ -26,7 +27,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
26 TLI_DEFINE_ENUM_INTERNAL(fopen64) 27 TLI_DEFINE_ENUM_INTERNAL(fopen64)
27 TLI_DEFINE_STRING_INTERNAL("fopen64") 28 TLI_DEFINE_STRING_INTERNAL("fopen64")
28 /// int fork(); 29 /// int fork();
29@@ -778,6 +781,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") 30@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
30 /// int fseeko(FILE *stream, off_t offset, int whence); 31 /// int fseeko(FILE *stream, off_t offset, int whence);
31 TLI_DEFINE_ENUM_INTERNAL(fseeko) 32 TLI_DEFINE_ENUM_INTERNAL(fseeko)
32 TLI_DEFINE_STRING_INTERNAL("fseeko") 33 TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +37,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
36 /// int fseeko64(FILE *stream, off64_t offset, int whence) 37 /// int fseeko64(FILE *stream, off64_t offset, int whence)
37 TLI_DEFINE_ENUM_INTERNAL(fseeko64) 38 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
38 TLI_DEFINE_STRING_INTERNAL("fseeko64") 39 TLI_DEFINE_STRING_INTERNAL("fseeko64")
39@@ -788,6 +794,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") 40@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
40 TLI_DEFINE_ENUM_INTERNAL(fstat) 41 TLI_DEFINE_ENUM_INTERNAL(fstat)
41 TLI_DEFINE_STRING_INTERNAL("fstat") 42 TLI_DEFINE_STRING_INTERNAL("fstat")
42 /// int fstat64(int filedes, struct stat64 *buf) 43 /// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +47,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
46 TLI_DEFINE_ENUM_INTERNAL(fstat64) 47 TLI_DEFINE_ENUM_INTERNAL(fstat64)
47 TLI_DEFINE_STRING_INTERNAL("fstat64") 48 TLI_DEFINE_STRING_INTERNAL("fstat64")
48 /// int fstatvfs(int fildes, struct statvfs *buf); 49 /// int fstatvfs(int fildes, struct statvfs *buf);
49@@ -803,6 +812,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") 50@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
50 TLI_DEFINE_ENUM_INTERNAL(ftello) 51 TLI_DEFINE_ENUM_INTERNAL(ftello)
51 TLI_DEFINE_STRING_INTERNAL("ftello") 52 TLI_DEFINE_STRING_INTERNAL("ftello")
52 /// off64_t ftello64(FILE *stream) 53 /// off64_t ftello64(FILE *stream)
@@ -56,7 +57,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
56 TLI_DEFINE_ENUM_INTERNAL(ftello64) 57 TLI_DEFINE_ENUM_INTERNAL(ftello64)
57 TLI_DEFINE_STRING_INTERNAL("ftello64") 58 TLI_DEFINE_STRING_INTERNAL("ftello64")
58 /// int ftrylockfile(FILE *file); 59 /// int ftrylockfile(FILE *file);
59@@ -929,6 +941,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") 60@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
60 TLI_DEFINE_ENUM_INTERNAL(lstat) 61 TLI_DEFINE_ENUM_INTERNAL(lstat)
61 TLI_DEFINE_STRING_INTERNAL("lstat") 62 TLI_DEFINE_STRING_INTERNAL("lstat")
62 /// int lstat64(const char *path, struct stat64 *buf); 63 /// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +67,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
66 TLI_DEFINE_ENUM_INTERNAL(lstat64) 67 TLI_DEFINE_ENUM_INTERNAL(lstat64)
67 TLI_DEFINE_STRING_INTERNAL("lstat64") 68 TLI_DEFINE_STRING_INTERNAL("lstat64")
68 /// void *malloc(size_t size); 69 /// void *malloc(size_t size);
69@@ -1154,6 +1169,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") 70@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
70 TLI_DEFINE_ENUM_INTERNAL(stat) 71 TLI_DEFINE_ENUM_INTERNAL(stat)
71 TLI_DEFINE_STRING_INTERNAL("stat") 72 TLI_DEFINE_STRING_INTERNAL("stat")
72 /// int stat64(const char *path, struct stat64 *buf); 73 /// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +77,7 @@ index 518a85ee1a0..6b4ead4efc6 100644
76 TLI_DEFINE_ENUM_INTERNAL(stat64) 77 TLI_DEFINE_ENUM_INTERNAL(stat64)
77 TLI_DEFINE_STRING_INTERNAL("stat64") 78 TLI_DEFINE_STRING_INTERNAL("stat64")
78 /// int statvfs(const char *path, struct statvfs *buf); 79 /// int statvfs(const char *path, struct statvfs *buf);
79@@ -1283,6 +1301,9 @@ TLI_DEFINE_STRING_INTERNAL("times") 80@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
80 TLI_DEFINE_ENUM_INTERNAL(tmpfile) 81 TLI_DEFINE_ENUM_INTERNAL(tmpfile)
81 TLI_DEFINE_STRING_INTERNAL("tmpfile") 82 TLI_DEFINE_STRING_INTERNAL("tmpfile")
82 /// FILE *tmpfile64(void) 83 /// FILE *tmpfile64(void)
@@ -87,5 +88,5 @@ index 518a85ee1a0..6b4ead4efc6 100644
87 TLI_DEFINE_STRING_INTERNAL("tmpfile64") 88 TLI_DEFINE_STRING_INTERNAL("tmpfile64")
88 /// int toascii(int c); 89 /// int toascii(int c);
89-- 90--
902.20.1 912.22.0
91 92
diff --git a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
new file mode 100644
index 0000000000..f47080c9fd
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
@@ -0,0 +1,38 @@
1From b66d6f39a374b8df41e7235351e5dee2e81f440c Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH 07/19] llvm: allow env override of exe path
5
6When using a native llvm-config from inside a sysroot, we need llvm-config to
7return the libraries, include directories, etc. from inside the sysroot rather
8than from the native sysroot. Thus provide an env override for calling
9llvm-config from a target sysroot.
10
11Upstream-Status: Pending
12Signed-off-by: Martin Kelly <mkelly@xevo.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++
16 1 file changed, 7 insertions(+)
17
18diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
19index 7ef7c46a262..a4f7ed82c7b 100644
20--- a/llvm/tools/llvm-config/llvm-config.cpp
21+++ b/llvm/tools/llvm-config/llvm-config.cpp
22@@ -225,6 +225,13 @@ Typical components:\n\
23
24 /// Compute the path to the main executable.
25 std::string GetExecutablePath(const char *Argv0) {
26+ // Hack for Yocto: we need to override the root path when we are using
27+ // llvm-config from within a target sysroot.
28+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
29+ if (Sysroot != nullptr) {
30+ return Sysroot;
31+ }
32+
33 // This just needs to be some symbol in the binary; C++ doesn't
34 // allow taking the address of ::main however.
35 void *P = (void *)(intptr_t)GetExecutablePath;
36--
372.22.0
38
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index 0067635c2b..35ad3ced37 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -8,7 +8,7 @@ SECTION = "devel"
8 8
9LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648" 9LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
10 10
11DEPENDS = "libffi libxml2 zlib ninja-native llvm-native" 11DEPENDS = "libffi libxml2 zlib libedit ninja-native llvm-native"
12 12
13RDEPENDS_${PN}_append_class-target = " ncurses-terminfo" 13RDEPENDS_${PN}_append_class-target = " ncurses-terminfo"
14 14
@@ -19,17 +19,17 @@ PROVIDES += "llvm${PV}"
19LLVM_RELEASE = "${PV}" 19LLVM_RELEASE = "${PV}"
20LLVM_DIR = "llvm${LLVM_RELEASE}" 20LLVM_DIR = "llvm${LLVM_RELEASE}"
21 21
22SRCREV = "d2298e74235598f15594fe2c99bbac870a507c59" 22SRCREV = "19a71f6bdf2dddb10764939e7f0ec2b98dba76c9"
23 23
24BRANCH = "release/${MAJOR_VERSION}.x" 24BRANCH = "release/${MAJOR_VERSION}.x"
25MAJOR_VERSION = "8" 25MAJOR_VERSION = "8"
26MINOR_VERSION = "0" 26MINOR_VERSION = "0"
27PATCH_VERSION = "0" 27PATCH_VERSION = "1"
28SOLIBVER = "1" 28SOLIBVER = "1"
29PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" 29PV = "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
30SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH} \ 30SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH} \
31 file://0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ 31 file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch;striplevel=2 \
32 file://0002-llvm-allow-env-override-of-exe-path.patch \ 32 file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
33 " 33 "
34 34
35S = "${WORKDIR}/git/llvm" 35S = "${WORKDIR}/git/llvm"