diff options
Diffstat (limited to 'sys-devel/clang/files/5.0.2')
3 files changed, 249 insertions, 0 deletions
diff --git a/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch b/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch new file mode 100644 index 000000000000..7d53cbdef3f3 --- /dev/null +++ b/sys-devel/clang/files/5.0.2/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch @@ -0,0 +1,136 @@ +From 19e3dc0ce4949cc7f869b4552c6a7f28cd59c3b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Thu, 17 Nov 2016 14:19:18 +0100 +Subject: [PATCH] [Driver] Use arch type to find compiler-rt libraries (on + Linux) + +Use llvm::Triple::getArchTypeName() when looking for compiler-rt +libraries, rather than the exact arch string from the triple. This is +more correct as it matches the values used when building compiler-rt +(builtin-config-ix.cmake) which are the subset of the values allowed +in triples. + +For example, this fixes an issue when the compiler set for +i686-pc-linux-gnu triple would not find an i386 compiler-rt library, +while this is the exact arch that is detected by compiler-rt. The same +applies to any other i?86 variant allowed by LLVM. + +This also makes the special case for MSVC unnecessary, since now i386 +will be used reliably for all 32-bit x86 variants. +--- + lib/Driver/ToolChain.cpp | 5 +---- + .../usr/i686-unknown-linux/lib/.keep | 0 + .../usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o | 0 + test/Driver/linux-ld.c | 21 +++++++++++++++++++++ + test/Driver/nostdlib.c | 2 +- + test/Driver/print-libgcc-file-name-clangrt.c | 10 ++++++++-- + test/Driver/windows-cross.c | 2 +- + 7 files changed, 32 insertions(+), 8 deletions(-) + create mode 100644 test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep + create mode 100644 test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o + +diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp +index 6adc0386ee..7e4222f087 100644 +--- a/lib/Driver/ToolChain.cpp ++++ b/lib/Driver/ToolChain.cpp +@@ -283,15 +283,12 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC, + const llvm::Triple &Triple = TC.getTriple(); + bool IsWindows = Triple.isOSWindows(); + +- if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86) +- return "i386"; +- + if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb) + return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows) + ? "armhf" + : "arm"; + +- return TC.getArchName(); ++ return llvm::Triple::getArchTypeName(TC.getArch()); + } + + std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, +diff --git a/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep b/test/Driver/Inputs/basic_linux_tree/usr/i686-unknown-linux/lib/.keep +new file mode 100644 +index 0000000000..e69de29bb2 +diff --git a/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o b/test/Driver/Inputs/basic_linux_tree/usr/lib/gcc/i686-unknown-linux/4.6.0/crtbegin.o +new file mode 100644 +index 0000000000..e69de29bb2 +diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c +index e5aa870866..92b199b9d4 100644 +--- a/test/Driver/linux-ld.c ++++ b/test/Driver/linux-ld.c +@@ -71,6 +71,27 @@ + // CHECK-LD-RT: libclang_rt.builtins-x86_64.a" + // + // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ ++// RUN: --target=i686-unknown-linux \ ++// RUN: --gcc-toolchain="" \ ++// RUN: --sysroot=%S/Inputs/basic_linux_tree \ ++// RUN: --rtlib=compiler-rt \ ++// RUN: | FileCheck --check-prefix=CHECK-LD-RT-I686 %s ++// CHECK-LD-RT-I686-NOT: warning: ++// CHECK-LD-RT-I686: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" ++// CHECK-LD-RT-I686: "--eh-frame-hdr" ++// CHECK-LD-RT-I686: "-m" "elf_i386" ++// CHECK-LD-RT-I686: "-dynamic-linker" ++// CHECK-LD-RT-I686: "{{.*}}/usr/lib/gcc/i686-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o" ++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0" ++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../../../i686-unknown-linux/lib" ++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib/gcc/i686-unknown-linux/4.6.0/../../.." ++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/lib" ++// CHECK-LD-RT-I686: "-L[[SYSROOT]]/usr/lib" ++// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" ++// CHECK-LD-RT-I686: "-lc" ++// CHECK-LD-RT-I686: libclang_rt.builtins-i386.a" ++// ++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ + // RUN: --target=arm-linux-androideabi \ + // RUN: --gcc-toolchain="" \ + // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +diff --git a/test/Driver/nostdlib.c b/test/Driver/nostdlib.c +index a9ef665c57..c9793d968c 100644 +--- a/test/Driver/nostdlib.c ++++ b/test/Driver/nostdlib.c +@@ -27,5 +27,5 @@ + // + // CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt' + // CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +-// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i686.a" ++// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i386.a" + // CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt' +diff --git a/test/Driver/print-libgcc-file-name-clangrt.c b/test/Driver/print-libgcc-file-name-clangrt.c +index 9f8120c31d..28c758881d 100644 +--- a/test/Driver/print-libgcc-file-name-clangrt.c ++++ b/test/Driver/print-libgcc-file-name-clangrt.c +@@ -6,6 +6,12 @@ + // CHECK-CLANGRT-X8664: libclang_rt.builtins-x86_64.a + + // RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ ++// RUN: --target=i386-pc-linux \ ++// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s ++// CHECK-CLANGRT-I386: libclang_rt.builtins-i386.a ++ ++// Check whether alternate arch values map to the correct library. ++// ++// RUN: %clang -rtlib=compiler-rt -print-libgcc-file-name 2>&1 \ + // RUN: --target=i686-pc-linux \ +-// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I686 %s +-// CHECK-CLANGRT-I686: libclang_rt.builtins-i686.a ++// RUN: | FileCheck --check-prefix=CHECK-CLANGRT-I386 %s +diff --git a/test/Driver/windows-cross.c b/test/Driver/windows-cross.c +index 5a2fe52b09..78b4981c9d 100644 +--- a/test/Driver/windows-cross.c ++++ b/test/Driver/windows-cross.c +@@ -59,7 +59,7 @@ + // RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-ADDRESS-EXE-X86 + + // CHECK-SANITIZE-ADDRESS-EXE-X86: "-fsanitize=address" +-// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i686.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i686.lib" "--undefined" "___asan_seh_interceptor" ++// CHECK-SANITIZE-ADDRESS-EXE-X86: "{{.*}}clang_rt.asan_dynamic-i386.lib" "{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib" "--undefined" "___asan_seh_interceptor" + + // RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \ + // RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN +-- +2.11.0 + diff --git a/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch b/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch new file mode 100644 index 000000000000..1751a4f479f0 --- /dev/null +++ b/sys-devel/clang/files/5.0.2/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch @@ -0,0 +1,76 @@ +From 4650c277d616e5d297baf28682eb792e2e0144b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 1 Apr 2018 23:20:56 +0200 +Subject: [PATCH] [test] Fix clang-test for FreeBSD and NetBSD + +Lit tries to inject the shared library paths, but no action is taken +when platform.system() is not recognized, results in an environment +variable with an empty name, which is illegal. + +The patch fixes this mechanism for FreeBSD and NetBSD, and gives an +warning on other platforms, so that the latecomers don't have to spend +time on debugging lit. + +Thanks Zhihao Yuan for the patch! + +Differential Revision: https://reviews.llvm.org/D39162 + +git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316411 91177308-0d34-0410-b5e6-96231b3b80d8 + +(rebased for release_50 branch) +--- + test/Unit/lit.cfg | 41 ++++++++++++++++++++--------------------- + 1 file changed, 20 insertions(+), 21 deletions(-) + +diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg +index 90eb2ac604..2cabf4bba1 100644 +--- a/test/Unit/lit.cfg ++++ b/test/Unit/lit.cfg +@@ -87,24 +87,23 @@ if config.test_exec_root is None: + lit_config.load_config(config, site_cfg) + raise SystemExit + +-shlibpath_var = '' +-if platform.system() == 'Linux': +- shlibpath_var = 'LD_LIBRARY_PATH' +-elif platform.system() == 'Darwin': +- shlibpath_var = 'DYLD_LIBRARY_PATH' +-elif platform.system() == 'Windows': +- shlibpath_var = 'PATH' +- +-# in stand-alone builds, shlibdir is clang's build tree +-# while llvm_libs_dir is installed LLVM (and possibly older clang) +-llvm_shlib_dir = getattr(config, 'shlibdir', None) +-if not llvm_shlib_dir: +- lit_config.fatal('No shlibdir set!') +-# Point the dynamic loader at dynamic libraries in 'lib'. +-llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) +-if not llvm_libs_dir: +- lit_config.fatal('No LLVM libs dir set!') +-shlibpath = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir, +- config.environment.get(shlibpath_var,''))) +- +-config.environment[shlibpath_var] = shlibpath ++def find_shlibpath_var(): ++ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']: ++ yield 'LD_LIBRARY_PATH' ++ elif platform.system() == 'Darwin': ++ yield 'DYLD_LIBRARY_PATH' ++ elif platform.system() == 'Windows': ++ yield 'PATH' ++ ++for shlibpath_var in find_shlibpath_var(): ++ # in stand-alone builds, shlibdir is clang's build tree ++ # while llvm_libs_dir is installed LLVM (and possibly older clang) ++ shlibpath = os.path.pathsep.join( ++ (config.shlibdir, ++ config.llvm_libs_dir, ++ config.environment.get(shlibpath_var, ''))) ++ config.environment[shlibpath_var] = shlibpath ++ break ++else: ++ lit_config.warning("unable to inject shared library path on '{}'" ++ .format(platform.system())) +-- +2.17.0.rc2 + diff --git a/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch b/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch new file mode 100644 index 000000000000..cbdb0b807aaf --- /dev/null +++ b/sys-devel/clang/files/5.0.2/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch @@ -0,0 +1,37 @@ +From 5c5bb3948697f2ca184a03dedd5666eb2de547ba Mon Sep 17 00:00:00 2001 +From: Dimitry Andric <dimitry@andric.com> +Date: Sat, 20 Jan 2018 14:34:33 +0000 +Subject: [PATCH] Assume the shared library path variable is LD_LIBRARY_PATH on + systems except Darwin and Windows. This prevents inserting an environment + variable with an empty name (which is illegal and leads to a Python + exception) on any of the BSDs. + +git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@323040 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + test/Unit/lit.cfg | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg +index fc63afdb..b40e1cae 100644 +--- a/test/Unit/lit.cfg ++++ b/test/Unit/lit.cfg +@@ -19,13 +19,12 @@ config.test_exec_root = config.test_source_root + # ;-separated list of subdirectories). + config.test_format = lit.formats.GoogleTest('.', 'Tests') + +-shlibpath_var = '' +-if platform.system() == 'Linux': +- shlibpath_var = 'LD_LIBRARY_PATH' +-elif platform.system() == 'Darwin': ++if platform.system() == 'Darwin': + shlibpath_var = 'DYLD_LIBRARY_PATH' + elif platform.system() == 'Windows': + shlibpath_var = 'PATH' ++else: ++ shlibpath_var = 'LD_LIBRARY_PATH' + + # Point the dynamic loader at dynamic libraries in 'lib'. + shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir, +-- +2.17.0.rc2 + |