summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-03-06 20:08:21 +0100
committerMichał Górny <mgorny@gentoo.org>2017-03-06 23:18:15 +0100
commit4a73d12677b93bcdf102699a5f9a1b375df28fda (patch)
tree8660aa7e5a923dc3c9d2bcda8b816cd11c1b661c /sys-devel/clang/files
parentsys-devel/lld: Bump to 4.0.0rc3, fix tests (diff)
downloadgentoo-4a73d12677b93bcdf102699a5f9a1b375df28fda.tar.gz
gentoo-4a73d12677b93bcdf102699a5f9a1b375df28fda.tar.bz2
gentoo-4a73d12677b93bcdf102699a5f9a1b375df28fda.zip
sys-devel/clang: Bump to 4.0.0rc3, fix extra tool tests
Diffstat (limited to 'sys-devel/clang/files')
-rw-r--r--sys-devel/clang/files/4.0.0/0001-Frontend-Correct-values-of-ATOMIC_-_LOCK_FREE-to-mat.patch87
-rw-r--r--sys-devel/clang/files/4.0.0/extra/0001-test-Fix-test-dependencies-when-using-installed-tool.patch48
-rw-r--r--sys-devel/clang/files/4.0.0/extra/0002-test-Fix-clang-library-dir-in-LD_LIBRARY_PATH-For-st.patch83
3 files changed, 218 insertions, 0 deletions
diff --git a/sys-devel/clang/files/4.0.0/0001-Frontend-Correct-values-of-ATOMIC_-_LOCK_FREE-to-mat.patch b/sys-devel/clang/files/4.0.0/0001-Frontend-Correct-values-of-ATOMIC_-_LOCK_FREE-to-mat.patch
new file mode 100644
index 000000000000..f52d445eb05b
--- /dev/null
+++ b/sys-devel/clang/files/4.0.0/0001-Frontend-Correct-values-of-ATOMIC_-_LOCK_FREE-to-mat.patch
@@ -0,0 +1,87 @@
+From f1ea62e93cba334828c427146cc2ca7718a9ffb3 Mon Sep 17 00:00:00 2001
+From: Michal Gorny <mgorny@gentoo.org>
+Date: Mon, 9 Jan 2017 20:54:20 +0000
+Subject: [PATCH] [Frontend] Correct values of ATOMIC_*_LOCK_FREE to match
+ builtin
+
+Correct the logic used to set ATOMIC_*_LOCK_FREE preprocessor macros not
+to rely on the ABI alignment of types. Instead, just assume all those
+types are aligned correctly by default since clang uses safe alignment
+for _Atomic types even if the underlying types are aligned to a lower
+boundary by default.
+
+For example, the 'long long' and 'double' types on x86 are aligned to
+32-bit boundary by default. However, '_Atomic long long' and '_Atomic
+double' are aligned to 64-bit boundary, therefore satisfying
+the requirements of lock-free atomic operations.
+
+This fixes PR #19355 by correcting the value of
+__GCC_ATOMIC_LLONG_LOCK_FREE on x86, and therefore also fixing
+the assumption made in libc++ tests. This also fixes PR #30581 by
+applying a consistent logic between the functions used to implement
+both interfaces.
+
+Differential Revision: https://reviews.llvm.org/D28213
+
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291477 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/Frontend/InitPreprocessor.cpp | 10 ++++------
+ test/Sema/atomic-ops.c | 4 ----
+ 2 files changed, 4 insertions(+), 10 deletions(-)
+
+diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
+index 17603ada11..4502c92499 100644
+--- a/lib/Frontend/InitPreprocessor.cpp
++++ b/lib/Frontend/InitPreprocessor.cpp
+@@ -286,12 +286,12 @@ static void DefineFastIntType(unsigned TypeWidth, bool IsSigned,
+
+ /// Get the value the ATOMIC_*_LOCK_FREE macro should have for a type with
+ /// the specified properties.
+-static const char *getLockFreeValue(unsigned TypeWidth, unsigned TypeAlign,
+- unsigned InlineWidth) {
++static const char *getLockFreeValue(unsigned TypeWidth, unsigned InlineWidth) {
+ // Fully-aligned, power-of-2 sizes no larger than the inline
+ // width will be inlined as lock-free operations.
+- if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
+- TypeWidth <= InlineWidth)
++ // Note: we do not need to check alignment since _Atomic(T) is always
++ // appropriately-aligned in clang.
++ if ((TypeWidth & (TypeWidth - 1)) == 0 && TypeWidth <= InlineWidth)
+ return "2"; // "always lock free"
+ // We cannot be certain what operations the lib calls might be
+ // able to implement as lock-free on future processors.
+@@ -881,7 +881,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
+ #define DEFINE_LOCK_FREE_MACRO(TYPE, Type) \
+ Builder.defineMacro("__GCC_ATOMIC_" #TYPE "_LOCK_FREE", \
+ getLockFreeValue(TI.get##Type##Width(), \
+- TI.get##Type##Align(), \
+ InlineWidthBits));
+ DEFINE_LOCK_FREE_MACRO(BOOL, Bool);
+ DEFINE_LOCK_FREE_MACRO(CHAR, Char);
+@@ -894,7 +893,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
+ DEFINE_LOCK_FREE_MACRO(LLONG, LongLong);
+ Builder.defineMacro("__GCC_ATOMIC_POINTER_LOCK_FREE",
+ getLockFreeValue(TI.getPointerWidth(0),
+- TI.getPointerAlign(0),
+ InlineWidthBits));
+ #undef DEFINE_LOCK_FREE_MACRO
+ }
+diff --git a/test/Sema/atomic-ops.c b/test/Sema/atomic-ops.c
+index 8ebf3eaed4..d3ebdf67db 100644
+--- a/test/Sema/atomic-ops.c
++++ b/test/Sema/atomic-ops.c
+@@ -14,11 +14,7 @@ _Static_assert(__GCC_ATOMIC_WCHAR_T_LOCK_FREE == 2, "");
+ _Static_assert(__GCC_ATOMIC_SHORT_LOCK_FREE == 2, "");
+ _Static_assert(__GCC_ATOMIC_INT_LOCK_FREE == 2, "");
+ _Static_assert(__GCC_ATOMIC_LONG_LOCK_FREE == 2, "");
+-#ifdef __i386__
+-_Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 1, "");
+-#else
+ _Static_assert(__GCC_ATOMIC_LLONG_LOCK_FREE == 2, "");
+-#endif
+ _Static_assert(__GCC_ATOMIC_POINTER_LOCK_FREE == 2, "");
+
+ _Static_assert(__c11_atomic_is_lock_free(1), "");
+--
+2.12.0
+
diff --git a/sys-devel/clang/files/4.0.0/extra/0001-test-Fix-test-dependencies-when-using-installed-tool.patch b/sys-devel/clang/files/4.0.0/extra/0001-test-Fix-test-dependencies-when-using-installed-tool.patch
new file mode 100644
index 000000000000..3779bc620314
--- /dev/null
+++ b/sys-devel/clang/files/4.0.0/extra/0001-test-Fix-test-dependencies-when-using-installed-tool.patch
@@ -0,0 +1,48 @@
+From f1355920fbe819c5b1f5a870fc76cffcdd6328f0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 10 Feb 2017 22:44:53 +0100
+Subject: [PATCH 1/2] [test] Fix test dependencies when using installed tools
+
+Use the LLVM_UTILS_PROVIDED variable to determine whether test tool
+dependencies should be exposed for clang-tools-extra tests. If clang is
+being built stand-alone and LLVM test tools (FileCheck, count and not)
+are installed, the top-level CMakeLists.txt of clang sets this variable
+to indicate that they will not be built as a part of this build,
+and therefore no dependencies should be emitted for them. This fixes
+the dependency errors when building clang stand-alone with tests
+enabled.
+---
+ test/CMakeLists.txt | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index a852ef60..c26bd5c4 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -31,9 +31,6 @@ if(CLANG_TOOLS_TEST_USE_VG)
+ endif()
+
+ set(CLANG_TOOLS_TEST_DEPS
+- # Base line deps.
+- FileCheck count not
+-
+ # clang-tidy tests require it.
+ clang-headers
+
+@@ -58,6 +55,13 @@ set(CLANG_TOOLS_TEST_DEPS
+ ExtraToolsUnitTests
+ )
+
++if(NOT LLVM_UTILS_PROVIDED)
++ list(APPEND CLANG_TOOLS_TEST_DEPS
++ # Base line deps.
++ FileCheck count not
++ )
++endif()
++
+ add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
+ ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${CLANG_TOOLS_TEST_DEPS}
+--
+2.12.0
+
diff --git a/sys-devel/clang/files/4.0.0/extra/0002-test-Fix-clang-library-dir-in-LD_LIBRARY_PATH-For-st.patch b/sys-devel/clang/files/4.0.0/extra/0002-test-Fix-clang-library-dir-in-LD_LIBRARY_PATH-For-st.patch
new file mode 100644
index 000000000000..22f6d5685f33
--- /dev/null
+++ b/sys-devel/clang/files/4.0.0/extra/0002-test-Fix-clang-library-dir-in-LD_LIBRARY_PATH-For-st.patch
@@ -0,0 +1,83 @@
+From f3ff810e81c35133f6a7e463d860bcd4ca30be84 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 19 Feb 2017 12:13:04 +0100
+Subject: [PATCH 2/2] [test] Fix clang library dir in LD_LIBRARY_PATH For
+ stand-alone build
+
+Prepend the clang library directory (determined using SHLIBDIR, alike
+in clang) to the LD_LIBRARY_PATH to ensure that just-built clang
+libraries will be used instead of a previous installed version.
+
+When a stand-alone build is performed, LLVM_LIBS_DIR contains the path
+to installed LLVM library directory. The same directory frequently
+contains a previously installed version of clang. SHLIBDIR, on the other
+hand, is always the build-tree directory, and therefore contains
+the freshly built clang libraries.
+
+In a non-stand-alone build, both paths will be the same and therefore
+including them both will not cause any issues.
+---
+ test/Unit/lit.cfg | 9 ++++++---
+ test/lit.cfg | 5 ++++-
+ test/lit.site.cfg.in | 1 +
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
+index ff70123c..3a1da187 100644
+--- a/test/Unit/lit.cfg
++++ b/test/Unit/lit.cfg
+@@ -41,14 +41,17 @@ elif platform.system() == 'Windows':
+ shlibpath_var = 'PATH'
+
+ # Point the dynamic loader at dynamic libraries in 'lib'.
++shlibdir = getattr(config, 'shlibdir', None)
++if not shlibdir:
++ lit_config.fatal('No shlibdir set!')
+ 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_libs_dir,
++shlibpath = os.path.pathsep.join((shlibdir, llvm_libs_dir,
+ config.environment.get(shlibpath_var,'')))
+
+ # Win32 seeks DLLs along %PATH%.
+-if sys.platform in ['win32', 'cygwin'] and os.path.isdir(config.shlibdir):
+- shlibpath = os.path.pathsep.join((config.shlibdir, shlibpath))
++if sys.platform in ['win32', 'cygwin'] and os.path.isdir(shlibdir):
++ shlibpath = os.path.pathsep.join((shlibdir, shlibpath))
+
+ config.environment[shlibpath_var] = shlibpath
+diff --git a/test/lit.cfg b/test/lit.cfg
+index bb592936..0e7de849 100644
+--- a/test/lit.cfg
++++ b/test/lit.cfg
+@@ -99,10 +99,13 @@ if clang_tools_binary_dir is not None:
+ clang_tools_dir, llvm_tools_dir, config.environment['PATH']))
+ config.environment['PATH'] = path
+
++ clang_libs_dir = getattr(config, 'clang_libs_dir', None)
++ if not clang_libs_dir:
++ lit_config.fatal('No Clang libs dir set!')
+ llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
+ if not llvm_libs_dir:
+ lit_config.fatal('No LLVM libs dir set!')
+- path = os.path.pathsep.join((llvm_libs_dir,
++ path = os.path.pathsep.join((clang_libs_dir, llvm_libs_dir,
+ config.environment.get('LD_LIBRARY_PATH','')))
+ config.environment['LD_LIBRARY_PATH'] = path
+
+diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
+index dfd0164c..f310b59a 100644
+--- a/test/lit.site.cfg.in
++++ b/test/lit.site.cfg.in
+@@ -7,6 +7,7 @@ config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+ config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
+ config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
++config.clang_libs_dir = "@SHLIBDIR@"
+ config.python_executable = "@PYTHON_EXECUTABLE@"
+ config.target_triple = "@TARGET_TRIPLE@"
+
+--
+2.12.0
+