summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang
diff options
context:
space:
mode:
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.patch10
-rw-r--r--recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch20
-rw-r--r--recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch10
-rw-r--r--recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch4
-rw-r--r--recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch18
-rw-r--r--recipes-devtools/clang/clang/0003-llvm-ARM-Use-correct-calling-convention-for-libm.patch152
-rw-r--r--recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch8
-rw-r--r--recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch20
-rw-r--r--recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch17
-rw-r--r--recipes-devtools/clang/clang/0007-clang-Enable-SSP-and-PIE-by-default.patch95
-rw-r--r--recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch (renamed from recipes-devtools/clang/clang/0008-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch)23
-rw-r--r--recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch28
13 files changed, 75 insertions, 344 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 06f3b9e..e1da8f8 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 40c82edf60ec3ee7f62b9029856f9eee8a81ae2e Mon Sep 17 00:00:00 2001 1From fa869f4c31bf70694014d24f7b50623aa6247f47 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/6] clang: driver: Use /lib for ldso on OE 4Subject: [PATCH 1/7] 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 50443a1252..4865ec99da 100644 18index 1301cdf114..d59512627d 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@@ -540,12 +540,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 21@@ -502,12 +502,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 50443a1252..4865ec99da 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@@ -555,7 +555,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 36@@ -517,7 +517,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 50443a1252..4865ec99da 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@@ -569,7 +569,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 45@@ -531,7 +531,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 50443a1252..4865ec99da 100644
52 break; 52 break;
53 } 53 }
54-- 54--
552.13.0 552.16.1
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 ed0e9ef..88702bc 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 ad79d6051f2c4299b7b286d5a60e2aa1b9a92898 Mon Sep 17 00:00:00 2001 1From 38ec6e5550b9f50a7393182b48c5c26cad4d541f 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 4db3328..29cba1a 100644 20index 1adbdb3..ba4e9d7 100644
21--- a/CMakeLists.txt 21--- a/CMakeLists.txt
22+++ b/CMakeLists.txt 22+++ b/CMakeLists.txt
23@@ -402,15 +402,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") 23@@ -409,15 +409,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
24 # Setup Source Code 24 # Setup Source Code
25 #=============================================================================== 25 #===============================================================================
26 26
@@ -37,7 +37,7 @@ index 4db3328..29cba1a 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@@ -420,15 +415,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) 40@@ -427,15 +422,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
41 NO_DEFAULT_PATH 41 NO_DEFAULT_PATH
42 ) 42 )
43 43
@@ -64,5 +64,5 @@ index 4db3328..29cba1a 100644
64 # soname, etc... 64 # soname, etc...
65 add_subdirectory(src) 65 add_subdirectory(src)
66-- 66--
672.14.1 672.16.1
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 cb047ea..4f6ed94 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,4 +1,4 @@
1From 28293e48cf1a52004c6a78de448718441f9e05f9 Mon Sep 17 00:00:00 2001 1From 96558c4f25d5132936014f6f2d6252cfdfdf478a 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/2] llvm: TargetLibraryInfo: Undefine libc functions if they
@@ -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 9cbe917c146..aff8419cf54 100644 16index a461ed813b9..f9fd9faeee0 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@@ -656,6 +656,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") 19@@ -665,6 +665,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 9cbe917c146..aff8419cf54 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@@ -691,6 +694,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") 29@@ -700,6 +703,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 9cbe917c146..aff8419cf54 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@@ -701,6 +707,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") 39@@ -710,6 +716,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 9cbe917c146..aff8419cf54 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@@ -716,6 +725,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") 49@@ -725,6 +734,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 9cbe917c146..aff8419cf54 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@@ -836,6 +848,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") 59@@ -845,6 +857,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 9cbe917c146..aff8419cf54 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@@ -1055,6 +1070,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") 69@@ -1064,6 +1079,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 9cbe917c146..aff8419cf54 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@@ -1184,6 +1202,9 @@ TLI_DEFINE_STRING_INTERNAL("times") 79@@ -1193,6 +1211,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 9cbe917c146..aff8419cf54 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.13.1 902.16.1
91 91
diff --git a/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch b/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch
index 8792a51..b3189d5 100644
--- a/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch
+++ b/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp-and-lssp_nonshared-o.patch
@@ -1,7 +1,7 @@
1From 94d3e80a88c58043bd22d7aafbfcb0579c8356e7 Mon Sep 17 00:00:00 2001 1From 1d96d952f5c293847a405d3566011e015aaa0e88 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/6] clang: Driver/tools.cpp: Add -lssp and -lssp_nonshared on 4Subject: [PATCH 2/7] clang: Driver/tools.cpp: Add -lssp and -lssp_nonshared on
5 musl 5 musl
6 6
7musl driver will need to add ssp libraries to linker cmdline 7musl driver will need to add ssp libraries to linker cmdline
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 7 insertions(+) 13 1 file changed, 7 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 f1015e62ee..1843150b45 100644 16index 7845781f12..802d2e4e4f 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@@ -609,6 +609,13 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 19@@ -518,6 +518,13 @@ 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
@@ -31,5 +31,5 @@ index f1015e62ee..1843150b45 100644
31 CmdArgs.push_back("--end-group"); 31 CmdArgs.push_back("--end-group");
32 else 32 else
33-- 33--
342.13.0 342.16.1
35 35
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 6864bcd..256e332 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,4 +1,4 @@
1From d776487bac17650704614248d19d1e6b35775001 Mon Sep 17 00:00:00 2001 1From 2f8ea767afdaa440c6368040630e1b3ea6a0977a 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/2] llvm: allow env override of exe path
@@ -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.13.1 362.16.1
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 3c52b40..c5fff97 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,18 +1,18 @@
1From b6c1b462d2b08726a4dbce717012e3c52f447906 Mon Sep 17 00:00:00 2001 1From e12b563d7e5ff427e889f18f035e9b433a578d5f 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/6] clang: musl/ppc does not support 128-bit long double 4Subject: [PATCH 3/7] 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---
8 lib/Basic/Targets.cpp | 3 ++- 8 lib/Basic/Targets/PPC.h | 3 ++-
9 1 file changed, 2 insertions(+), 1 deletion(-) 9 1 file changed, 2 insertions(+), 1 deletion(-)
10 10
11diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp 11diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h
12index 1b9fbed177..d0a2ca6997 100644 12index 04bef258e3..0ae210698a 100644
13--- a/lib/Basic/Targets.cpp 13--- a/lib/Basic/Targets/PPC.h
14+++ b/lib/Basic/Targets.cpp 14+++ b/lib/Basic/Targets/PPC.h
15@@ -1693,7 +1693,8 @@ public: 15@@ -272,7 +272,8 @@ public:
16 break; 16 break;
17 } 17 }
18 18
@@ -23,5 +23,5 @@ index 1b9fbed177..d0a2ca6997 100644
23 LongDoubleFormat = &llvm::APFloat::IEEEdouble(); 23 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
24 } 24 }
25-- 25--
262.13.0 262.16.1
27 27
diff --git a/recipes-devtools/clang/clang/0003-llvm-ARM-Use-correct-calling-convention-for-libm.patch b/recipes-devtools/clang/clang/0003-llvm-ARM-Use-correct-calling-convention-for-libm.patch
deleted file mode 100644
index 131e062..0000000
--- a/recipes-devtools/clang/clang/0003-llvm-ARM-Use-correct-calling-convention-for-libm.patch
+++ /dev/null
@@ -1,152 +0,0 @@
1From 61a5983d8ba6eea3f535a33ab80374a5fe6b515b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 19 Sep 2017 12:37:23 -0700
4Subject: [PATCH 3/3] llvm: [ARM] Use correct calling convention for libm
5
6-mfloat-abi doesn't control the calling convention for compiler-rt: it's built with the compiler, so it can only have one calling convention for a given target. -mfloat-abi does control the calling convention for any function provided by libm: libm is built by the user, so the user should have control over its calling convention. See https://bugs.llvm.org/show_bug.cgi?id=30543 for previous discussion on the subject.
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 lib/Target/ARM/ARMISelLowering.cpp | 71 ++++++++++++++++++++++++++++++++++++
11 test/CodeGen/Thumb2/intrinsics-cc.ll | 25 ++++++++++++-
12 2 files changed, 94 insertions(+), 2 deletions(-)
13
14diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
15index 27dda93387b..53ba8f4dd52 100644
16--- a/lib/Target/ARM/ARMISelLowering.cpp
17+++ b/lib/Target/ARM/ARMISelLowering.cpp
18@@ -225,6 +225,8 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
19
20 if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetIOS() &&
21 !Subtarget->isTargetWatchOS()) {
22+ // Most builtins have their calling convention determined by the
23+ // target (they don't vary with -float-abi).
24 const auto &E = Subtarget->getTargetTriple().getEnvironment();
25
26 bool IsHFTarget = E == Triple::EABIHF || E == Triple::GNUEABIHF ||
27@@ -238,6 +240,75 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
28 setLibcallCallingConv(static_cast<RTLIB::Libcall>(LCID),
29 IsHFTarget ? CallingConv::ARM_AAPCS_VFP
30 : CallingConv::ARM_AAPCS);
31+
32+ // Builtins provided by libm have their calling convention determined by
33+ // -float-abi.
34+ bool IsHFMode = TM.Options.FloatABIType == FloatABI::Hard;
35+ CallingConv::ID LibmConv = IsHFMode ? CallingConv::ARM_AAPCS_VFP
36+ : CallingConv::ARM_AAPCS;
37+ setLibcallCallingConv(RTLIB::REM_F32, LibmConv);
38+ setLibcallCallingConv(RTLIB::REM_F64, LibmConv);
39+ setLibcallCallingConv(RTLIB::REM_F128, LibmConv);
40+ setLibcallCallingConv(RTLIB::FMA_F32, LibmConv);
41+ setLibcallCallingConv(RTLIB::FMA_F64, LibmConv);
42+ setLibcallCallingConv(RTLIB::FMA_F128, LibmConv);
43+ setLibcallCallingConv(RTLIB::SQRT_F32, LibmConv);
44+ setLibcallCallingConv(RTLIB::SQRT_F64, LibmConv);
45+ setLibcallCallingConv(RTLIB::SQRT_F128, LibmConv);
46+ setLibcallCallingConv(RTLIB::LOG_F32, LibmConv);
47+ setLibcallCallingConv(RTLIB::LOG_F64, LibmConv);
48+ setLibcallCallingConv(RTLIB::LOG_F128, LibmConv);
49+ setLibcallCallingConv(RTLIB::LOG2_F32, LibmConv);
50+ setLibcallCallingConv(RTLIB::LOG2_F64, LibmConv);
51+ setLibcallCallingConv(RTLIB::LOG2_F128, LibmConv);
52+ setLibcallCallingConv(RTLIB::LOG10_F32, LibmConv);
53+ setLibcallCallingConv(RTLIB::LOG10_F64, LibmConv);
54+ setLibcallCallingConv(RTLIB::LOG10_F128, LibmConv);
55+ setLibcallCallingConv(RTLIB::EXP_F32, LibmConv);
56+ setLibcallCallingConv(RTLIB::EXP_F64, LibmConv);
57+ setLibcallCallingConv(RTLIB::EXP_F128, LibmConv);
58+ setLibcallCallingConv(RTLIB::EXP2_F32, LibmConv);
59+ setLibcallCallingConv(RTLIB::EXP2_F64, LibmConv);
60+ setLibcallCallingConv(RTLIB::EXP2_F128, LibmConv);
61+ setLibcallCallingConv(RTLIB::SIN_F32, LibmConv);
62+ setLibcallCallingConv(RTLIB::SIN_F64, LibmConv);
63+ setLibcallCallingConv(RTLIB::SIN_F128, LibmConv);
64+ setLibcallCallingConv(RTLIB::COS_F32, LibmConv);
65+ setLibcallCallingConv(RTLIB::COS_F64, LibmConv);
66+ setLibcallCallingConv(RTLIB::COS_F128, LibmConv);
67+ setLibcallCallingConv(RTLIB::SINCOS_F32, LibmConv);
68+ setLibcallCallingConv(RTLIB::SINCOS_F64, LibmConv);
69+ setLibcallCallingConv(RTLIB::SINCOS_F128, LibmConv);
70+ setLibcallCallingConv(RTLIB::POW_F32, LibmConv);
71+ setLibcallCallingConv(RTLIB::POW_F64, LibmConv);
72+ setLibcallCallingConv(RTLIB::POW_F128, LibmConv);
73+ setLibcallCallingConv(RTLIB::CEIL_F32, LibmConv);
74+ setLibcallCallingConv(RTLIB::CEIL_F64, LibmConv);
75+ setLibcallCallingConv(RTLIB::CEIL_F128, LibmConv);
76+ setLibcallCallingConv(RTLIB::TRUNC_F32, LibmConv);
77+ setLibcallCallingConv(RTLIB::TRUNC_F64, LibmConv);
78+ setLibcallCallingConv(RTLIB::TRUNC_F128, LibmConv);
79+ setLibcallCallingConv(RTLIB::RINT_F32, LibmConv);
80+ setLibcallCallingConv(RTLIB::RINT_F64, LibmConv);
81+ setLibcallCallingConv(RTLIB::RINT_F128, LibmConv);
82+ setLibcallCallingConv(RTLIB::NEARBYINT_F32, LibmConv);
83+ setLibcallCallingConv(RTLIB::NEARBYINT_F64, LibmConv);
84+ setLibcallCallingConv(RTLIB::NEARBYINT_F128, LibmConv);
85+ setLibcallCallingConv(RTLIB::ROUND_F32, LibmConv);
86+ setLibcallCallingConv(RTLIB::ROUND_F64, LibmConv);
87+ setLibcallCallingConv(RTLIB::ROUND_F128, LibmConv);
88+ setLibcallCallingConv(RTLIB::FLOOR_F32, LibmConv);
89+ setLibcallCallingConv(RTLIB::FLOOR_F64, LibmConv);
90+ setLibcallCallingConv(RTLIB::FLOOR_F128, LibmConv);
91+ setLibcallCallingConv(RTLIB::COPYSIGN_F32, LibmConv);
92+ setLibcallCallingConv(RTLIB::COPYSIGN_F64, LibmConv);
93+ setLibcallCallingConv(RTLIB::COPYSIGN_F128, LibmConv);
94+ setLibcallCallingConv(RTLIB::FMIN_F32, LibmConv);
95+ setLibcallCallingConv(RTLIB::FMIN_F64, LibmConv);
96+ setLibcallCallingConv(RTLIB::FMIN_F128, LibmConv);
97+ setLibcallCallingConv(RTLIB::FMAX_F32, LibmConv);
98+ setLibcallCallingConv(RTLIB::FMAX_F64, LibmConv);
99+ setLibcallCallingConv(RTLIB::FMAX_F128, LibmConv);
100 }
101
102 if (Subtarget->isTargetMachO()) {
103diff --git a/test/CodeGen/Thumb2/intrinsics-cc.ll b/test/CodeGen/Thumb2/intrinsics-cc.ll
104index ab5081e3ab9..3a3014fc919 100644
105--- a/test/CodeGen/Thumb2/intrinsics-cc.ll
106+++ b/test/CodeGen/Thumb2/intrinsics-cc.ll
107@@ -15,7 +15,7 @@
108
109 declare float @llvm.powi.f32(float, i32)
110
111-define float @f(float %f, i32 %i) {
112+define float @powi_f32(float %f, i32 %i) {
113 entry:
114 %0 = call float @llvm.powi.f32(float %f, i32 %i)
115 ret float %0
116@@ -28,7 +28,7 @@ entry:
117
118 declare double @llvm.powi.f64(double, i32)
119
120-define double @g(double %d, i32 %i) {
121+define double @powi_f64(double %d, i32 %i) {
122 entry:
123 %0 = call double @llvm.powi.f64(double %d, i32 %i)
124 ret double %0
125@@ -39,3 +39,24 @@ entry:
126 ; CHECK-TO-SOFT: vmov d0, r0, r1
127 ; CHECK-TO-HARD: vmov r0, r1, d0
128
129+declare float @llvm.floor.f32(float)
130+
131+define float @floor_f32(float %f) {
132+entry:
133+ %0 = call float @llvm.floor.f32(float %f)
134+ ret float %0
135+}
136+
137+; CHECK-MATCH: b floorf
138+; CHECK-MISMATCH: b floorf
139+
140+declare double @llvm.floor.f64(double)
141+
142+define double @floor_f64(double %d) {
143+entry:
144+ %0 = call double @llvm.floor.f64(double %d)
145+ ret double %0
146+}
147+
148+; CHECK-MATCH: b floor
149+; CHECK-MISMATCH: b floor
150--
1512.14.1
152
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 50ce4d0..b0bd060 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 3257464995af44e5baafa1d1dd80b79b6260754d Mon Sep 17 00:00:00 2001 1From 10d236bdc55bddde95d399931514b417f2c96284 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/6] clang: Prepend trailing '/' to sysroot 4Subject: [PATCH 4/7] 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,7 +24,7 @@ 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 4865ec99da..719525ad7d 100644 27index d59512627d..624953b17f 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@@ -193,7 +193,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
@@ -37,5 +37,5 @@ index 4865ec99da..719525ad7d 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.13.0 402.16.1
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 14db1e6..7ec01cd 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 b47912e2304c1e3d3bca7e973037b859739aea15 Mon Sep 17 00:00:00 2001 1From d4121c0c5ad01dab4f3c35d4fc59ec92bdca36b7 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/6] clang: Look inside the target sysroot for compiler 4Subject: [PATCH 5/7] 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,7 +16,7 @@ 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 4f82503276..507e051afc 100644 19index f96a1182e3..d286622f8d 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@@ -12,6 +12,7 @@
@@ -27,18 +27,18 @@ index 4f82503276..507e051afc 100644
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@@ -320,7 +321,10 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, 30@@ -324,7 +325,10 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
31 const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so") 31 }
32 : (IsITANMSVCWindows ? ".lib" : ".a");
33 32
33 std::string ToolChain::getCompilerRTPath() const {
34- SmallString<128> Path(getDriver().ResourceDir); 34- SmallString<128> Path(getDriver().ResourceDir);
35+ SmallString<128> Path(getDriver().SysRoot); 35+ SmallString<128> Path(getDriver().SysRoot);
36+ StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX); 36+ StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX);
37+ llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang", 37+ llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang",
38+ CLANG_VERSION_STRING); 38+ CLANG_VERSION_STRING);
39 StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS(); 39 if (Triple.isOSUnknown()) {
40 llvm::sys::path::append(Path, "lib", OSLibName); 40 llvm::sys::path::append(Path, "lib");
41 llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" + 41 } else {
42-- 42--
432.13.0 432.16.1
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 473f610..755e8bb 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 b56c57ef523bed20dc9e9beb271667a85cf56478 Mon Sep 17 00:00:00 2001 1From 2dfc688d82a570bdcb8b512f91122e388db0684a 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/6] clang: Define / releative gcc installation dir 4Subject: [PATCH 6/7] 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
@@ -13,11 +13,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 lib/Driver/ToolChains/Gnu.cpp | 1 + 13 lib/Driver/ToolChains/Gnu.cpp | 1 +
14 1 file changed, 1 insertion(+) 14 1 file changed, 1 insertion(+)
15 15
16Index: clang/lib/Driver/ToolChains/Gnu.cpp 16diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
17=================================================================== 17index 802d2e4e4f..3b5c1f860e 100644
18--- clang.orig/lib/Driver/ToolChains/Gnu.cpp 18--- a/lib/Driver/ToolChains/Gnu.cpp
19+++ clang/lib/Driver/ToolChains/Gnu.cpp 19+++ b/lib/Driver/ToolChains/Gnu.cpp
20@@ -2101,6 +2101,7 @@ void Generic_GCC::GCCInstallationDetecto 20@@ -2071,6 +2071,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
21 21
22 // Debian puts cross-compilers in gcc-cross. 22 // Debian puts cross-compilers in gcc-cross.
23 {"gcc-cross/" + CandidateTriple.str(), "../..", true}, 23 {"gcc-cross/" + CandidateTriple.str(), "../..", true},
@@ -25,3 +25,6 @@ Index: clang/lib/Driver/ToolChains/Gnu.cpp
25 25
26 // The Freescale PPC SDK has the gcc libraries in 26 // The Freescale PPC SDK has the gcc libraries in
27 // <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
28--
292.16.1
30
diff --git a/recipes-devtools/clang/clang/0007-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0007-clang-Enable-SSP-and-PIE-by-default.patch
deleted file mode 100644
index 481dd24..0000000
--- a/recipes-devtools/clang/clang/0007-clang-Enable-SSP-and-PIE-by-default.patch
+++ /dev/null
@@ -1,95 +0,0 @@
1From 013035de788d1e2e00a4238fb2fdd39591c5c009 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 29 Jul 2017 08:29:19 -0700
4Subject: [PATCH 7/7] clang: Enable SSP and PIE by default
5
6This is a minimal set of changes needed to make clang use SSP and PIE by
7default on Arch Linux. Tests that were easy to adjust have been changed
8accordingly; only test/Driver/linux-ld.c has been marked as "expected
9failure" due to the number of changes it would require (mostly replacing
10crtbegin.o with crtbeginS.o).
11
12Doing so is needed in order to align clang with the new default GCC
13behavior in Arch which generates PIE executables by default and also
14defaults to -fstack-protector-strong. It is not meant to be a long term
15solution, but a simple temporary fix.
16
17Hopefully these changes will be obsoleted by the introduction upstream
18of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
19
20From: Evangelos Foutras <evangelos@foutrelis.com>
21
22https://git.archlinux.org/svntogit/packages.git/tree/trunk/0002-Enable-SSP-and-PIE-by-default.patch?h=packages/llvm
23
24Signed-off-by: Khem Raj <raj.khem@gmail.com>
25---
26 lib/Driver/ToolChains/FreeBSD.cpp | 1 +
27 lib/Driver/ToolChains/Gnu.cpp | 1 +
28 lib/Driver/ToolChains/Linux.cpp | 14 +++++++++++++-
29 lib/Driver/ToolChains/Linux.h | 1 +
30 4 files changed, 16 insertions(+), 1 deletion(-)
31
32diff --git a/lib/Driver/ToolChains/FreeBSD.cpp b/lib/Driver/ToolChains/FreeBSD.cpp
33index c6626e922e..39d0d6fb0d 100644
34--- a/lib/Driver/ToolChains/FreeBSD.cpp
35+++ b/lib/Driver/ToolChains/FreeBSD.cpp
36@@ -128,6 +128,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
37 const llvm::Triple::ArchType Arch = ToolChain.getArch();
38 const bool IsPIE =
39 !Args.hasArg(options::OPT_shared) &&
40+ !Args.hasArg(options::OPT_nopie) &&
41 (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
42 ArgStringList CmdArgs;
43
44diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
45index 8eb7401b24..8d06196231 100644
46--- a/lib/Driver/ToolChains/Gnu.cpp
47+++ b/lib/Driver/ToolChains/Gnu.cpp
48@@ -417,6 +417,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
49 const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
50 const bool IsPIE =
51 !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
52+ !Args.hasArg(options::OPT_nopie) &&
53 (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
54 const bool HasCRTBeginEndFiles =
55 ToolChain.getTriple().hasEnvironment() ||
56diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
57index 6dd6d52633..773063249a 100644
58--- a/lib/Driver/ToolChains/Linux.cpp
59+++ b/lib/Driver/ToolChains/Linux.cpp
60@@ -810,7 +810,19 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
61 }
62 }
63
64-bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); }
65+bool Linux::isPIEDefault() const {
66+ const bool IsMips = tools::isMipsArch(getTriple().getArch());
67+ const bool IsAndroid = getTriple().isAndroid();
68+
69+ if (IsMips || IsAndroid)
70+ return getSanitizerArgs().requiresPIE();
71+
72+ return true;
73+}
74+
75+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
76+ return 2;
77+}
78
79 SanitizerMask Linux::getSupportedSanitizers() const {
80 const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
81diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
82index 9778c1832c..ddd46a1d58 100644
83--- a/lib/Driver/ToolChains/Linux.h
84+++ b/lib/Driver/ToolChains/Linux.h
85@@ -36,6 +36,7 @@ public:
86 void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
87 llvm::opt::ArgStringList &CC1Args) const override;
88 bool isPIEDefault() const override;
89+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
90 SanitizerMask getSupportedSanitizers() const override;
91 void addProfileRTLibs(const llvm::opt::ArgList &Args,
92 llvm::opt::ArgStringList &CmdArgs) const override;
93--
942.13.3
95
diff --git a/recipes-devtools/clang/clang/0008-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 51970e8..c730477 100644
--- a/recipes-devtools/clang/clang/0008-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 cdae04d9e1950f07e89ea5aa8eed7ed7ce6b7938 Mon Sep 17 00:00:00 2001 1From 7b0b7262849c2e0ff713cd1ce1b38b70ea04f4e5 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] clang: Fix ldso for musl on x86 and x32 architectures 4Subject: [PATCH 7/7] 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
@@ -10,14 +10,14 @@ arch is i586, which is not the right thing
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/Linux.cpp | 7 +++++++ 13 lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
14 1 file changed, 7 insertions(+) 14 1 file changed, 8 insertions(+)
15 15
16Index: clang/lib/Driver/ToolChains/Linux.cpp 16diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
17=================================================================== 17index 624953b17f..69624f8432 100644
18--- clang.orig/lib/Driver/ToolChains/Linux.cpp 18--- a/lib/Driver/ToolChains/Linux.cpp
19+++ clang/lib/Driver/ToolChains/Linux.cpp 19+++ b/lib/Driver/ToolChains/Linux.cpp
20@@ -422,6 +422,7 @@ std::string Linux::getDynamicLinker(cons 20@@ -427,6 +427,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: clang/lib/Driver/ToolChains/Linux.cpp
25 25
26 switch (Arch) { 26 switch (Arch) {
27 case llvm::Triple::arm: 27 case llvm::Triple::arm:
28@@ -434,6 +435,13 @@ std::string Linux::getDynamicLinker(cons 28@@ -439,6 +440,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;
@@ -39,3 +39,6 @@ Index: clang/lib/Driver/ToolChains/Linux.cpp
39 default: 39 default:
40 ArchName = Triple.getArchName().str(); 40 ArchName = Triple.getArchName().str();
41 } 41 }
42--
432.16.1
44
diff --git a/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch b/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch
deleted file mode 100644
index 74bfc69..0000000
--- a/recipes-devtools/clang/clang/0008-clang-Default-to-gnu-14-for-c-standard.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 521fdfcc2031d22b50125b3295b837229c77abd6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 12 Aug 2017 12:56:06 -0700
4Subject: [PATCH 8/8] clang: Default to gnu++14 for c++ standard
5
6GCC 7.x and newer default to same as well
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 lib/Frontend/CompilerInvocation.cpp | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
14index b2c14554a4..eed925fac4 100644
15--- a/lib/Frontend/CompilerInvocation.cpp
16+++ b/lib/Frontend/CompilerInvocation.cpp
17@@ -1667,7 +1667,7 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
18 if (T.isPS4())
19 LangStd = LangStandard::lang_gnucxx11;
20 else
21- LangStd = LangStandard::lang_gnucxx98;
22+ LangStd = LangStandard::lang_gnucxx14;
23 break;
24 case InputKind::RenderScript:
25 LangStd = LangStandard::lang_c99;
26--
272.14.1
28