summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-08-24 19:10:35 -0700
committerKhem Raj <raj.khem@gmail.com>2018-09-09 07:59:31 -0700
commit12b98a5e70fc680e16dfe9e76e844d0d8276fa67 (patch)
treee3ed645c3b600287ea9e2fd1f5444c697b2dad0e /recipes-devtools/clang/clang
parent9a0bd29eac2be5f88e3e198929181d3591dd7ec7 (diff)
downloadmeta-clang-12b98a5e70fc680e16dfe9e76e844d0d8276fa67.tar.gz
recipes: Upgrade to clang 7.0.0 Release (rc2)
- Update compiler-rt/llvm/clang/lld licence checksums Triggerred due to copyright year update to 2018 Add libunwind and libcxxabi license to checksum list too - Switch to https protocol for fetching from github - Fix _finite functions on musl - Package new .so files built with clang - package libLLVM-${MAJOR_VER}.so as well since llvm-7 generates it without MINOR_VERSION Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'recipes-devtools/clang/clang')
-rw-r--r--recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch14
-rw-r--r--recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch12
-rw-r--r--recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch22
-rw-r--r--recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch10
-rw-r--r--recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch12
-rw-r--r--recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch10
-rw-r--r--recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch65
-rw-r--r--recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch10
-rw-r--r--recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch14
-rw-r--r--recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch28
-rw-r--r--recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch12
-rw-r--r--recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch4
-rw-r--r--recipes-devtools/clang/clang/0009-clang-Driver-Avoid-invalidated-iterator-in-insertTar.patch56
13 files changed, 140 insertions, 129 deletions
diff --git a/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch b/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
index d19dd99..2b06da2 100644
--- a/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
+++ b/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
@@ -1,7 +1,7 @@
1From a71c6f6cad70c1cb094ffd53ca28135eb87df406 Mon Sep 17 00:00:00 2001 1From 06033c7fa2d575a9a68b377f5ce9324433c23806 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 21:52:36 -0700 3Date: Sat, 21 May 2016 21:52:36 -0700
4Subject: [PATCH 1/7] clang: driver: Use /lib for ldso on OE 4Subject: [PATCH 1/8] clang: driver: Use /lib for ldso on OE
5 5
6OE does not follow the default base_libdir 6OE does not follow the default base_libdir
7that clang has, therefore adjust it for OE 7that clang has, therefore adjust it for OE
@@ -15,10 +15,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 1 file changed, 4 insertions(+), 4 deletions(-) 15 1 file changed, 4 insertions(+), 4 deletions(-)
16 16
17diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp 17diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
18index 1301cdf114..d59512627d 100644 18index f8f3623918..e662b6b262 100644
19--- a/lib/Driver/ToolChains/Linux.cpp 19--- a/lib/Driver/ToolChains/Linux.cpp
20+++ b/lib/Driver/ToolChains/Linux.cpp 20+++ b/lib/Driver/ToolChains/Linux.cpp
21@@ -502,12 +502,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 21@@ -566,12 +566,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
22 Loader = "ld.so.1"; 22 Loader = "ld.so.1";
23 break; 23 break;
24 case llvm::Triple::ppc64: 24 case llvm::Triple::ppc64:
@@ -33,7 +33,7 @@ index 1301cdf114..d59512627d 100644
33 Loader = 33 Loader =
34 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; 34 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
35 break; 35 break;
36@@ -517,7 +517,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 36@@ -593,7 +593,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
37 Loader = "ld-linux.so.2"; 37 Loader = "ld-linux.so.2";
38 break; 38 break;
39 case llvm::Triple::sparcv9: 39 case llvm::Triple::sparcv9:
@@ -42,7 +42,7 @@ index 1301cdf114..d59512627d 100644
42 Loader = "ld-linux.so.2"; 42 Loader = "ld-linux.so.2";
43 break; 43 break;
44 case llvm::Triple::systemz: 44 case llvm::Triple::systemz:
45@@ -531,7 +531,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 45@@ -607,7 +607,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
46 case llvm::Triple::x86_64: { 46 case llvm::Triple::x86_64: {
47 bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32; 47 bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32;
48 48
@@ -52,5 +52,5 @@ index 1301cdf114..d59512627d 100644
52 break; 52 break;
53 } 53 }
54-- 54--
552.17.0 552.18.0
56 56
diff --git a/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
index 88702bc..297b56d 100644
--- a/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ b/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
@@ -1,4 +1,4 @@
1From 38ec6e5550b9f50a7393182b48c5c26cad4d541f Mon Sep 17 00:00:00 2001 1From a122717a9bc31e0ab44197e743aa466711c4bf79 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 Aug 2017 10:37:49 -0700 3Date: Sun, 27 Aug 2017 10:37:49 -0700
4Subject: [PATCH] libcxxabi: Find libunwind headers when 4Subject: [PATCH] libcxxabi: Find libunwind headers when
@@ -17,10 +17,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 11 insertions(+), 10 deletions(-) 17 1 file changed, 11 insertions(+), 10 deletions(-)
18 18
19diff --git a/CMakeLists.txt b/CMakeLists.txt 19diff --git a/CMakeLists.txt b/CMakeLists.txt
20index 1adbdb3..ba4e9d7 100644 20index d6648ed..12c02f2 100644
21--- a/CMakeLists.txt 21--- a/CMakeLists.txt
22+++ b/CMakeLists.txt 22+++ b/CMakeLists.txt
23@@ -409,15 +409,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") 23@@ -434,15 +434,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
24 # Setup Source Code 24 # Setup Source Code
25 #=============================================================================== 25 #===============================================================================
26 26
@@ -37,8 +37,8 @@ index 1adbdb3..ba4e9d7 100644
37 libunwind.h 37 libunwind.h
38 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} 38 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
39 ${LIBCXXABI_LIBUNWIND_PATH}/include 39 ${LIBCXXABI_LIBUNWIND_PATH}/include
40@@ -427,15 +422,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) 40@@ -454,15 +449,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
41 NO_DEFAULT_PATH 41 NO_CMAKE_FIND_ROOT_PATH
42 ) 42 )
43 43
44- if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND") 44- if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
@@ -64,5 +64,5 @@ index 1adbdb3..ba4e9d7 100644
64 # soname, etc... 64 # soname, etc...
65 add_subdirectory(src) 65 add_subdirectory(src)
66-- 66--
672.16.1 672.18.0
68 68
diff --git a/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index 4f6ed94..de8da74 100644
--- a/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -1,7 +1,7 @@
1From 96558c4f25d5132936014f6f2d6252cfdfdf478a Mon Sep 17 00:00:00 2001 1From fc9904be5d4ee1d1e92a1ff86b01218fbf91b12f 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 4Subject: [PATCH 1/3] llvm: TargetLibraryInfo: Undefine libc functions if they
5 are macros 5 are macros
6 6
7musl defines some functions as macros and not inline functions 7musl defines some functions as macros and not inline functions
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 21 insertions(+) 13 1 file changed, 21 insertions(+)
14 14
15diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def 15diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
16index a461ed813b9..f9fd9faeee0 100644 16index f94debba9c5..e92dbc98c55 100644
17--- a/include/llvm/Analysis/TargetLibraryInfo.def 17--- a/include/llvm/Analysis/TargetLibraryInfo.def
18+++ b/include/llvm/Analysis/TargetLibraryInfo.def 18+++ b/include/llvm/Analysis/TargetLibraryInfo.def
19@@ -665,6 +665,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") 19@@ -707,6 +707,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
20 TLI_DEFINE_ENUM_INTERNAL(fopen) 20 TLI_DEFINE_ENUM_INTERNAL(fopen)
21 TLI_DEFINE_STRING_INTERNAL("fopen") 21 TLI_DEFINE_STRING_INTERNAL("fopen")
22 /// FILE *fopen64(const char *filename, const char *opentype) 22 /// FILE *fopen64(const char *filename, const char *opentype)
@@ -26,7 +26,7 @@ index a461ed813b9..f9fd9faeee0 100644
26 TLI_DEFINE_ENUM_INTERNAL(fopen64) 26 TLI_DEFINE_ENUM_INTERNAL(fopen64)
27 TLI_DEFINE_STRING_INTERNAL("fopen64") 27 TLI_DEFINE_STRING_INTERNAL("fopen64")
28 /// int fprintf(FILE *stream, const char *format, ...); 28 /// int fprintf(FILE *stream, const char *format, ...);
29@@ -700,6 +703,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") 29@@ -751,6 +754,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
30 /// int fseeko(FILE *stream, off_t offset, int whence); 30 /// int fseeko(FILE *stream, off_t offset, int whence);
31 TLI_DEFINE_ENUM_INTERNAL(fseeko) 31 TLI_DEFINE_ENUM_INTERNAL(fseeko)
32 TLI_DEFINE_STRING_INTERNAL("fseeko") 32 TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +36,7 @@ index a461ed813b9..f9fd9faeee0 100644
36 /// int fseeko64(FILE *stream, off64_t offset, int whence) 36 /// int fseeko64(FILE *stream, off64_t offset, int whence)
37 TLI_DEFINE_ENUM_INTERNAL(fseeko64) 37 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
38 TLI_DEFINE_STRING_INTERNAL("fseeko64") 38 TLI_DEFINE_STRING_INTERNAL("fseeko64")
39@@ -710,6 +716,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") 39@@ -761,6 +767,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
40 TLI_DEFINE_ENUM_INTERNAL(fstat) 40 TLI_DEFINE_ENUM_INTERNAL(fstat)
41 TLI_DEFINE_STRING_INTERNAL("fstat") 41 TLI_DEFINE_STRING_INTERNAL("fstat")
42 /// int fstat64(int filedes, struct stat64 *buf) 42 /// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +46,7 @@ index a461ed813b9..f9fd9faeee0 100644
46 TLI_DEFINE_ENUM_INTERNAL(fstat64) 46 TLI_DEFINE_ENUM_INTERNAL(fstat64)
47 TLI_DEFINE_STRING_INTERNAL("fstat64") 47 TLI_DEFINE_STRING_INTERNAL("fstat64")
48 /// int fstatvfs(int fildes, struct statvfs *buf); 48 /// int fstatvfs(int fildes, struct statvfs *buf);
49@@ -725,6 +734,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") 49@@ -776,6 +785,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
50 TLI_DEFINE_ENUM_INTERNAL(ftello) 50 TLI_DEFINE_ENUM_INTERNAL(ftello)
51 TLI_DEFINE_STRING_INTERNAL("ftello") 51 TLI_DEFINE_STRING_INTERNAL("ftello")
52 /// off64_t ftello64(FILE *stream) 52 /// off64_t ftello64(FILE *stream)
@@ -56,7 +56,7 @@ index a461ed813b9..f9fd9faeee0 100644
56 TLI_DEFINE_ENUM_INTERNAL(ftello64) 56 TLI_DEFINE_ENUM_INTERNAL(ftello64)
57 TLI_DEFINE_STRING_INTERNAL("ftello64") 57 TLI_DEFINE_STRING_INTERNAL("ftello64")
58 /// int ftrylockfile(FILE *file); 58 /// int ftrylockfile(FILE *file);
59@@ -845,6 +857,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") 59@@ -902,6 +914,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
60 TLI_DEFINE_ENUM_INTERNAL(lstat) 60 TLI_DEFINE_ENUM_INTERNAL(lstat)
61 TLI_DEFINE_STRING_INTERNAL("lstat") 61 TLI_DEFINE_STRING_INTERNAL("lstat")
62 /// int lstat64(const char *path, struct stat64 *buf); 62 /// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +66,7 @@ index a461ed813b9..f9fd9faeee0 100644
66 TLI_DEFINE_ENUM_INTERNAL(lstat64) 66 TLI_DEFINE_ENUM_INTERNAL(lstat64)
67 TLI_DEFINE_STRING_INTERNAL("lstat64") 67 TLI_DEFINE_STRING_INTERNAL("lstat64")
68 /// void *malloc(size_t size); 68 /// void *malloc(size_t size);
69@@ -1064,6 +1079,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") 69@@ -1127,6 +1142,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
70 TLI_DEFINE_ENUM_INTERNAL(stat) 70 TLI_DEFINE_ENUM_INTERNAL(stat)
71 TLI_DEFINE_STRING_INTERNAL("stat") 71 TLI_DEFINE_STRING_INTERNAL("stat")
72 /// int stat64(const char *path, struct stat64 *buf); 72 /// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +76,7 @@ index a461ed813b9..f9fd9faeee0 100644
76 TLI_DEFINE_ENUM_INTERNAL(stat64) 76 TLI_DEFINE_ENUM_INTERNAL(stat64)
77 TLI_DEFINE_STRING_INTERNAL("stat64") 77 TLI_DEFINE_STRING_INTERNAL("stat64")
78 /// int statvfs(const char *path, struct statvfs *buf); 78 /// int statvfs(const char *path, struct statvfs *buf);
79@@ -1193,6 +1211,9 @@ TLI_DEFINE_STRING_INTERNAL("times") 79@@ -1256,6 +1274,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
80 TLI_DEFINE_ENUM_INTERNAL(tmpfile) 80 TLI_DEFINE_ENUM_INTERNAL(tmpfile)
81 TLI_DEFINE_STRING_INTERNAL("tmpfile") 81 TLI_DEFINE_STRING_INTERNAL("tmpfile")
82 /// FILE *tmpfile64(void) 82 /// FILE *tmpfile64(void)
@@ -87,5 +87,5 @@ index a461ed813b9..f9fd9faeee0 100644
87 TLI_DEFINE_STRING_INTERNAL("tmpfile64") 87 TLI_DEFINE_STRING_INTERNAL("tmpfile64")
88 /// int toascii(int c); 88 /// int toascii(int c);
89-- 89--
902.16.1 902.18.0
91 91
diff --git a/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
index e9b36c3..f73b1c0 100644
--- a/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ b/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
@@ -1,7 +1,7 @@
1From 0ace54d609aac7d5f1b67d9474e3782a17bec8bf Mon Sep 17 00:00:00 2001 1From fc628b03a5ac41a446fd2dfea0ecbe03331e54d8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 21:11:06 -0700 3Date: Thu, 19 May 2016 21:11:06 -0700
4Subject: [PATCH 2/7] clang: Driver/tools.cpp: Add -lssp_nonshared on musl 4Subject: [PATCH 2/8] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
5 5
6musl driver will need to add ssp_nonshared for stack_check_local 6musl driver will need to add ssp_nonshared for stack_check_local
7on the linker cmdline when using stack protector commands on 7on the linker cmdline when using stack protector commands on
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 6 insertions(+) 13 1 file changed, 6 insertions(+)
14 14
15diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp 15diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
16index 7845781f12..bbe7845765 100644 16index 3755673250..766c650b3c 100644
17--- a/lib/Driver/ToolChains/Gnu.cpp 17--- a/lib/Driver/ToolChains/Gnu.cpp
18+++ b/lib/Driver/ToolChains/Gnu.cpp 18+++ b/lib/Driver/ToolChains/Gnu.cpp
19@@ -518,6 +518,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 19@@ -503,6 +503,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
20 if (IsIAMCU) 20 if (IsIAMCU)
21 CmdArgs.push_back("-lgloss"); 21 CmdArgs.push_back("-lgloss");
22 22
@@ -30,5 +30,5 @@ index 7845781f12..bbe7845765 100644
30 CmdArgs.push_back("--end-group"); 30 CmdArgs.push_back("--end-group");
31 else 31 else
32-- 32--
332.17.0 332.18.0
34 34
diff --git a/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch b/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch
index 256e332..fa49e67 100644
--- a/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch
+++ b/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch
@@ -1,7 +1,7 @@
1From 2f8ea767afdaa440c6368040630e1b3ea6a0977a Mon Sep 17 00:00:00 2001 1From c65c0af4a5721e3c0dfcc56c15ef3310a54e0008 Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com> 2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700 3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH 2/2] llvm: allow env override of exe path 4Subject: [PATCH 2/3] llvm: allow env override of exe path
5 5
6When using a native llvm-config from inside a sysroot, we need llvm-config to 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 7return the libraries, include directories, etc. from inside the sysroot rather
@@ -15,12 +15,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 1 file changed, 7 insertions(+) 15 1 file changed, 7 insertions(+)
16 16
17diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp 17diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
18index 08b096afb05..d8d7742744e 100644 18index 892adc3b9dd..38f190ecbd1 100644
19--- a/tools/llvm-config/llvm-config.cpp 19--- a/tools/llvm-config/llvm-config.cpp
20+++ b/tools/llvm-config/llvm-config.cpp 20+++ b/tools/llvm-config/llvm-config.cpp
21@@ -225,6 +225,13 @@ Typical components:\n\ 21@@ -226,6 +226,13 @@ Typical components:\n\
22 22
23 /// \brief Compute the path to the main executable. 23 /// Compute the path to the main executable.
24 std::string GetExecutablePath(const char *Argv0) { 24 std::string GetExecutablePath(const char *Argv0) {
25+ // Hack for Yocto: we need to override the root path when we are using 25+ // Hack for Yocto: we need to override the root path when we are using
26+ // llvm-config from within a target sysroot. 26+ // llvm-config from within a target sysroot.
@@ -33,5 +33,5 @@ index 08b096afb05..d8d7742744e 100644
33 // allow taking the address of ::main however. 33 // allow taking the address of ::main however.
34 void *P = (void *)(intptr_t)GetExecutablePath; 34 void *P = (void *)(intptr_t)GetExecutablePath;
35-- 35--
362.16.1 362.18.0
37 37
diff --git a/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
index 87778d3..868fc3b 100644
--- a/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
+++ b/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
@@ -1,7 +1,7 @@
1From d02f7f858c22fc1dcbc1ea3a96a597bcc4aa4d77 Mon Sep 17 00:00:00 2001 1From 48fa180df65f7ee63a85dd69fd2c1382609c5e95 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 10 May 2016 02:00:11 -0700 3Date: Tue, 10 May 2016 02:00:11 -0700
4Subject: [PATCH 3/7] clang: musl/ppc does not support 128-bit long double 4Subject: [PATCH 3/8] clang: musl/ppc does not support 128-bit long double
5 5
6Signed-off-by: Khem Raj <raj.khem@gmail.com> 6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7--- 7---
@@ -9,10 +9,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
9 1 file changed, 2 insertions(+), 1 deletion(-) 9 1 file changed, 2 insertions(+), 1 deletion(-)
10 10
11diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h 11diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h
12index 04bef258e3..0ae210698a 100644 12index 439c73a0e3..8da698ee21 100644
13--- a/lib/Basic/Targets/PPC.h 13--- a/lib/Basic/Targets/PPC.h
14+++ b/lib/Basic/Targets/PPC.h 14+++ b/lib/Basic/Targets/PPC.h
15@@ -272,7 +272,8 @@ public: 15@@ -328,7 +328,8 @@ public:
16 break; 16 break;
17 } 17 }
18 18
@@ -23,5 +23,5 @@ index 04bef258e3..0ae210698a 100644
23 LongDoubleFormat = &llvm::APFloat::IEEEdouble(); 23 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
24 } 24 }
25-- 25--
262.17.0 262.18.0
27 27
diff --git a/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch b/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
new file mode 100644
index 0000000..9f665e3
--- /dev/null
+++ b/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
@@ -0,0 +1,65 @@
1From cb1b6f021d2ce82d7d0084758b7efaa3917640f5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 26 Aug 2018 22:43:19 -0700
4Subject: [PATCH 3/3] llvm: Disable calls to *_finite and other glibc-only
5 functions on Musl.
6
7glibc's finite lib calls are generated when possible.
8However, they are not supported on Musl/linux. This change also
9disables other functions not available on Musl.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 lib/Analysis/TargetLibraryInfo.cpp | 29 +++++++++++++++--------------
14 1 file changed, 15 insertions(+), 14 deletions(-)
15
16diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp
17index 102135fbf31..5bc4d2b47f5 100644
18--- a/lib/Analysis/TargetLibraryInfo.cpp
19+++ b/lib/Analysis/TargetLibraryInfo.cpp
20@@ -415,27 +415,28 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
21
22 // The following functions are available on Linux,
23 // but Android uses bionic instead of glibc.
24- if (!T.isOSLinux() || T.isAndroid()) {
25+ if (!T.isOSLinux() || T.isAndroid() || T.isMusl()) {
26 TLI.setUnavailable(LibFunc_dunder_strdup);
27 TLI.setUnavailable(LibFunc_dunder_strtok_r);
28 TLI.setUnavailable(LibFunc_dunder_isoc99_scanf);
29 TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf);
30 TLI.setUnavailable(LibFunc_under_IO_getc);
31 TLI.setUnavailable(LibFunc_under_IO_putc);
32- // But, Android has memalign.
33- if (!T.isAndroid())
34+ // But, Android/Musl has memalign.
35+ if (!T.isAndroid() || !T.isMusl() )
36 TLI.setUnavailable(LibFunc_memalign);
37- TLI.setUnavailable(LibFunc_fopen64);
38- TLI.setUnavailable(LibFunc_fseeko64);
39- TLI.setUnavailable(LibFunc_fstat64);
40- TLI.setUnavailable(LibFunc_fstatvfs64);
41- TLI.setUnavailable(LibFunc_ftello64);
42- TLI.setUnavailable(LibFunc_lstat64);
43- TLI.setUnavailable(LibFunc_open64);
44- TLI.setUnavailable(LibFunc_stat64);
45- TLI.setUnavailable(LibFunc_statvfs64);
46- TLI.setUnavailable(LibFunc_tmpfile64);
47-
48+ if (!T.isMusl()) {
49+ TLI.setUnavailable(LibFunc_fopen64);
50+ TLI.setUnavailable(LibFunc_fseeko64);
51+ TLI.setUnavailable(LibFunc_fstat64);
52+ TLI.setUnavailable(LibFunc_fstatvfs64);
53+ TLI.setUnavailable(LibFunc_ftello64);
54+ TLI.setUnavailable(LibFunc_lstat64);
55+ TLI.setUnavailable(LibFunc_open64);
56+ TLI.setUnavailable(LibFunc_stat64);
57+ TLI.setUnavailable(LibFunc_statvfs64);
58+ TLI.setUnavailable(LibFunc_tmpfile64);
59+ }
60 // Relaxed math functions are included in math-finite.h on Linux (GLIBC).
61 TLI.setUnavailable(LibFunc_acos_finite);
62 TLI.setUnavailable(LibFunc_acosf_finite);
63--
642.18.0
65
diff --git a/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch
index 1e5b71f..03c6bab 100644
--- a/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch
+++ b/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch
@@ -1,7 +1,7 @@
1From 8a29645c68da82d6d7d1e7a74fdfad474f5c5755 Mon Sep 17 00:00:00 2001 1From 4764d8f8b613631de2e3c9a3614427d07c599017 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 09:02:13 -0700 3Date: Thu, 16 Mar 2017 09:02:13 -0700
4Subject: [PATCH 4/7] clang: Prepend trailing '/' to sysroot 4Subject: [PATCH 4/8] clang: Prepend trailing '/' to sysroot
5 5
6This is needed to handle a case where clang 6This is needed to handle a case where clang
7isntall and target sysroot are perilously same 7isntall and target sysroot are perilously same
@@ -24,10 +24,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
24 1 file changed, 1 insertion(+), 1 deletion(-) 24 1 file changed, 1 insertion(+), 1 deletion(-)
25 25
26diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp 26diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
27index d59512627d..624953b17f 100644 27index e662b6b262..5bca972cc2 100644
28--- a/lib/Driver/ToolChains/Linux.cpp 28--- a/lib/Driver/ToolChains/Linux.cpp
29+++ b/lib/Driver/ToolChains/Linux.cpp 29+++ b/lib/Driver/ToolChains/Linux.cpp
30@@ -193,7 +193,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) 30@@ -211,7 +211,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
31 GCCInstallation.init(Triple, Args); 31 GCCInstallation.init(Triple, Args);
32 Multilibs = GCCInstallation.getMultilibs(); 32 Multilibs = GCCInstallation.getMultilibs();
33 llvm::Triple::ArchType Arch = Triple.getArch(); 33 llvm::Triple::ArchType Arch = Triple.getArch();
@@ -37,5 +37,5 @@ index d59512627d..624953b17f 100644
37 // Cross-compiling binutils and GCC installations (vanilla and openSUSE at 37 // Cross-compiling binutils and GCC installations (vanilla and openSUSE at
38 // least) put various tools in a triple-prefixed directory off of the parent 38 // least) put various tools in a triple-prefixed directory off of the parent
39-- 39--
402.17.0 402.18.0
41 41
diff --git a/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
index f491028..8425f8d 100644
--- a/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ b/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
@@ -1,7 +1,7 @@
1From 183123464de1762bf755af4f50d77353121188c1 Mon Sep 17 00:00:00 2001 1From e02d9f3e1c724a4161709952a3ef59f81432fc06 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 19:06:26 -0700 3Date: Thu, 16 Mar 2017 19:06:26 -0700
4Subject: [PATCH 5/7] clang: Look inside the target sysroot for compiler 4Subject: [PATCH 5/8] clang: Look inside the target sysroot for compiler
5 runtime 5 runtime
6 6
7In OE compiler-rt and libc++ are built and staged into target 7In OE compiler-rt and libc++ are built and staged into target
@@ -16,18 +16,18 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
16 1 file changed, 5 insertions(+), 1 deletion(-) 16 1 file changed, 5 insertions(+), 1 deletion(-)
17 17
18diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp 18diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
19index f96a1182e3..d286622f8d 100644 19index cf3db34688..dae3178380 100644
20--- a/lib/Driver/ToolChain.cpp 20--- a/lib/Driver/ToolChain.cpp
21+++ b/lib/Driver/ToolChain.cpp 21+++ b/lib/Driver/ToolChain.cpp
22@@ -12,6 +12,7 @@ 22@@ -13,6 +13,7 @@
23 #include "ToolChains/Arch/ARM.h"
24 #include "ToolChains/Clang.h" 23 #include "ToolChains/Clang.h"
25 #include "clang/Basic/ObjCRuntime.h" 24 #include "clang/Basic/ObjCRuntime.h"
25 #include "clang/Basic/Sanitizers.h"
26+#include "clang/Basic/Version.h" 26+#include "clang/Basic/Version.h"
27 #include "clang/Basic/VirtualFileSystem.h" 27 #include "clang/Basic/VirtualFileSystem.h"
28 #include "clang/Config/config.h" 28 #include "clang/Config/config.h"
29 #include "clang/Driver/Action.h" 29 #include "clang/Driver/Action.h"
30@@ -324,7 +325,10 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC, 30@@ -343,7 +344,10 @@ StringRef ToolChain::getOSLibName() const {
31 } 31 }
32 32
33 std::string ToolChain::getCompilerRTPath() const { 33 std::string ToolChain::getCompilerRTPath() const {
@@ -40,5 +40,5 @@ index f96a1182e3..d286622f8d 100644
40 llvm::sys::path::append(Path, "lib"); 40 llvm::sys::path::append(Path, "lib");
41 } else { 41 } else {
42-- 42--
432.17.0 432.18.0
44 44
diff --git a/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch
index cbc0d19..b611dd5 100644
--- a/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch
+++ b/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch
@@ -1,7 +1,7 @@
1From 9a91d0b82ba48a9e2f634197809a1323298ef285 Mon Sep 17 00:00:00 2001 1From e6232d22df73b80ced3784fd85166ebe24e6c31b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 21 May 2017 15:38:25 -0700 3Date: Sun, 21 May 2017 15:38:25 -0700
4Subject: [PATCH 6/7] clang: Define / releative gcc installation dir 4Subject: [PATCH 6/8] clang: Define / releative gcc installation dir
5 5
6This is required for OE gcc installation to work. 6This is required for OE gcc installation to work.
7Without this its not able to find the paths for libgcc 7Without this its not able to find the paths for libgcc
@@ -10,21 +10,23 @@ installation in OE
10 10
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12--- 12---
13 lib/Driver/ToolChains/Gnu.cpp | 1 + 13 lib/Driver/ToolChains/Gnu.cpp | 3 +++
14 1 file changed, 1 insertion(+) 14 1 file changed, 3 insertions(+)
15 15
16diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp 16diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
17index bbe7845765..692385ff27 100644 17index 766c650b3c..777526e063 100644
18--- a/lib/Driver/ToolChains/Gnu.cpp 18--- a/lib/Driver/ToolChains/Gnu.cpp
19+++ b/lib/Driver/ToolChains/Gnu.cpp 19+++ b/lib/Driver/ToolChains/Gnu.cpp
20@@ -2070,6 +2070,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( 20@@ -2190,6 +2190,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
21 {"gcc-cross/" + CandidateTriple.str(), "../..",
22 TargetTriple.getOS() != llvm::Triple::Solaris},
21 23
22 // Debian puts cross-compilers in gcc-cross. 24+ // OE cross-compilers path structures
23 {"gcc-cross/" + CandidateTriple.str(), "../..", true}, 25+ {"/" + CandidateTriple.str(), "..", true},
24+ {"/" + CandidateTriple.str(), "..", true}, 26+
25 27 // The Freescale PPC SDK has the gcc libraries in
26 // The Freescale PPC SDK has the gcc libraries in 28 // <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
27 // <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do 29 // this on Freescale triples, though, since some systems put a *lot* of
28-- 30--
292.17.0 312.18.0
30 32
diff --git a/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
index e54f250..b456a59 100644
--- a/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
+++ b/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
@@ -1,7 +1,7 @@
1From e847b02f05519e1f93d26c1c7985dca9a111f091 Mon Sep 17 00:00:00 2001 1From 5840f5a6756f8f67dbba1b47015e75c8c3264b2b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Aug 2017 15:16:15 -0700 3Date: Wed, 16 Aug 2017 15:16:15 -0700
4Subject: [PATCH 7/7] clang: Fix ldso for musl on x86 and x32 architectures 4Subject: [PATCH 7/8] clang: Fix ldso for musl on x86 and x32 architectures
5 5
6x32 linker is called ld-musl-x32.so.1 and x86 linker 6x32 linker is called ld-musl-x32.so.1 and x86 linker
7is called ld-musl-i386.so.1, Currently, linker for 7is called ld-musl-i386.so.1, Currently, linker for
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 8 insertions(+) 14 1 file changed, 8 insertions(+)
15 15
16diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp 16diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
17index 624953b17f..69624f8432 100644 17index 5bca972cc2..2ca285679c 100644
18--- a/lib/Driver/ToolChains/Linux.cpp 18--- a/lib/Driver/ToolChains/Linux.cpp
19+++ b/lib/Driver/ToolChains/Linux.cpp 19+++ b/lib/Driver/ToolChains/Linux.cpp
20@@ -427,6 +427,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 20@@ -492,6 +492,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
21 if (Triple.isMusl()) { 21 if (Triple.isMusl()) {
22 std::string ArchName; 22 std::string ArchName;
23 bool IsArm = false; 23 bool IsArm = false;
@@ -25,7 +25,7 @@ index 624953b17f..69624f8432 100644
25 25
26 switch (Arch) { 26 switch (Arch) {
27 case llvm::Triple::arm: 27 case llvm::Triple::arm:
28@@ -439,6 +440,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 28@@ -504,6 +505,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
29 ArchName = "armeb"; 29 ArchName = "armeb";
30 IsArm = true; 30 IsArm = true;
31 break; 31 break;
@@ -40,5 +40,5 @@ index 624953b17f..69624f8432 100644
40 ArchName = Triple.getArchName().str(); 40 ArchName = Triple.getArchName().str();
41 } 41 }
42-- 42--
432.17.0 432.18.0
44 44
diff --git a/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch b/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
index a61ab09..c55b309 100644
--- a/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
+++ b/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
@@ -1,4 +1,4 @@
1From 38ea94d7476866d1ba337414e6834c5432140de8 Mon Sep 17 00:00:00 2001 1From 846e59787ec12b6cd817640151d1f23d3b78d6b5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 May 2018 10:28:43 -0700 3Date: Tue, 15 May 2018 10:28:43 -0700
4Subject: [PATCH 8/8] clang: scan-view needs python 2.x 4Subject: [PATCH 8/8] clang: scan-view needs python 2.x
@@ -23,5 +23,5 @@ index 1b6e8ba90d..7c5867d1be 100755
23 """The clang static analyzer results viewer. 23 """The clang static analyzer results viewer.
24 """ 24 """
25-- 25--
262.17.0 262.18.0
27 27
diff --git a/recipes-devtools/clang/clang/0009-clang-Driver-Avoid-invalidated-iterator-in-insertTar.patch b/recipes-devtools/clang/clang/0009-clang-Driver-Avoid-invalidated-iterator-in-insertTar.patch
deleted file mode 100644
index 2f7b921..0000000
--- a/recipes-devtools/clang/clang/0009-clang-Driver-Avoid-invalidated-iterator-in-insertTar.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From 19c832f5017f796012812414705f8d57e77b28ce Mon Sep 17 00:00:00 2001
2From: Serge Pavlov <sepavloff@gmail.com>
3Date: Mon, 19 Mar 2018 16:13:43 +0000
4Subject: [PATCH 9/9] clang: [Driver] Avoid invalidated iterator in
5 insertTargetAndModeArgs
6
7Doing an .insert() can potentially invalidate iterators by reallocating the
8vector's storage. When all the stars align just right, this causes segfaults
9or glibc aborts.
10
11Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.
12
13Patch by Hector Martin!
14
15Differential Revision: https://reviews.llvm.org/D44607
16
17git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327863 91177308-0d34-0410-b5e6-96231b3b80d8
18---
19Upstream-Status: Backport
20
21 tools/driver/driver.cpp | 9 +++++----
22 1 file changed, 5 insertions(+), 4 deletions(-)
23
24diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
25index fa757da953..1b614accb2 100644
26--- a/tools/driver/driver.cpp
27+++ b/tools/driver/driver.cpp
28@@ -212,20 +212,21 @@ static void insertTargetAndModeArgs(const ParsedClangName &NameParts,
29 // Put target and mode arguments at the start of argument list so that
30 // arguments specified in command line could override them. Avoid putting
31 // them at index 0, as an option like '-cc1' must remain the first.
32- auto InsertionPoint = ArgVector.begin();
33- if (InsertionPoint != ArgVector.end())
34+ int InsertionPoint = 0;
35+ if (ArgVector.size() > 0)
36 ++InsertionPoint;
37
38 if (NameParts.DriverMode) {
39 // Add the mode flag to the arguments.
40- ArgVector.insert(InsertionPoint,
41+ ArgVector.insert(ArgVector.begin() + InsertionPoint,
42 GetStableCStr(SavedStrings, NameParts.DriverMode));
43 }
44
45 if (NameParts.TargetIsValid) {
46 const char *arr[] = {"-target", GetStableCStr(SavedStrings,
47 NameParts.TargetPrefix)};
48- ArgVector.insert(InsertionPoint, std::begin(arr), std::end(arr));
49+ ArgVector.insert(ArgVector.begin() + InsertionPoint,
50+ std::begin(arr), std::end(arr));
51 }
52 }
53
54--
552.17.0
56