summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott McMillan <scott.andrew.mcmillan@gmail.com>2021-04-08 03:57:05 -0500
committerGitHub <noreply@github.com>2021-04-08 10:57:05 +0200
commit30153b106428597b713c548d427ed7a35e776c5c (patch)
tree1f72ce91de5c90d2cd8be71fbf66de53cd32ba1b
parent2a7f588612802f3f5e6cceb674f919beecd33eea (diff)
downloadspack-30153b106428597b713c548d427ed7a35e776c5c.tar.gz
spack-30153b106428597b713c548d427ed7a35e776c5c.tar.bz2
spack-30153b106428597b713c548d427ed7a35e776c5c.tar.xz
spack-30153b106428597b713c548d427ed7a35e776c5c.zip
tar: make it build with nvhpc (#22853)
Co-authored-by: Scott McMillan <smcmillan@nvidia.com>
-rw-r--r--var/spack/repos/builtin/packages/tar/nvhpc-1.30.patch (renamed from var/spack/repos/builtin/packages/tar/nvhpc.patch)0
-rw-r--r--var/spack/repos/builtin/packages/tar/nvhpc-1.34.patch35
-rw-r--r--var/spack/repos/builtin/packages/tar/nvhpc-long-width.patch17
-rw-r--r--var/spack/repos/builtin/packages/tar/package.py7
4 files changed, 58 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/tar/nvhpc.patch b/var/spack/repos/builtin/packages/tar/nvhpc-1.30.patch
index ecd56b72e1..ecd56b72e1 100644
--- a/var/spack/repos/builtin/packages/tar/nvhpc.patch
+++ b/var/spack/repos/builtin/packages/tar/nvhpc-1.30.patch
diff --git a/var/spack/repos/builtin/packages/tar/nvhpc-1.34.patch b/var/spack/repos/builtin/packages/tar/nvhpc-1.34.patch
new file mode 100644
index 0000000000..9f8d037d3c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/tar/nvhpc-1.34.patch
@@ -0,0 +1,35 @@
+--- a/gnu/xalloc-oversized.h
++++ b/gnu/xalloc-oversized.h
+@@ -41,10 +41,10 @@
+ positive and N must be nonnegative. This is a macro, not a
+ function, so that it works correctly even when SIZE_MAX < N. */
+
+-#if 7 <= __GNUC__ && !defined __clang__
++#if 7 <= __GNUC__ && !defined __clang__ && !defined __NVCOMPILER
+ # define xalloc_oversized(n, s) \
+ __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1)
+-#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__
++#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ && !defined __NVCOMPILER
+ # define xalloc_oversized(n, s) \
+ (__builtin_constant_p (n) && __builtin_constant_p (s) \
+ ? __xalloc_oversized (n, s) \
+--- a/gnu/intprops.h
++++ b/gnu/intprops.h
+@@ -228,7 +228,7 @@
+ (A, B, P) work when P is non-null. */
+ /* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
+ see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */
+-#if 7 <= __GNUC__ && !defined __ICC
++#if 7 <= __GNUC__ && !defined __ICC && !defined __NVCOMPILER
+ # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
+ #elif defined __has_builtin
+ # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
+@@ -246,7 +246,7 @@
+
+ /* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
+ __builtin_sub_overflow_p and __builtin_mul_overflow_p. */
+-#if defined __clang__ || defined __ICC
++#if defined __clang__ || defined __ICC || defined __NVCOMPILER
+ /* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it
+ would presumably run afoul of Clang bug 16404. ICC 2021.1's
+ __builtin_add_overflow_p etc. are not treated as integral constant
diff --git a/var/spack/repos/builtin/packages/tar/nvhpc-long-width.patch b/var/spack/repos/builtin/packages/tar/nvhpc-long-width.patch
new file mode 100644
index 0000000000..9e7378a2f4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/tar/nvhpc-long-width.patch
@@ -0,0 +1,17 @@
+--- a/gnu/regex_internal.h 2020-08-21 09:14:20.039942370 -0700
++++ b/gnu/regex_internal.h 2020-08-21 10:06:57.840331452 -0700
+@@ -35,6 +35,14 @@
+ #include <intprops.h>
+ #include <verify.h>
+
++#ifndef __LONG_WIDTH__
++#if LONG_WIDTH
++#define __LONG_WIDTH__ LONG_WIDTH
++#else
++#define __LONG_WIDTH__ __WORDSIZE
++#endif
++#endif
++
+ #if defined DEBUG && DEBUG != 0
+ # include <assert.h>
+ # define DEBUG_ASSERT(x) assert (x)
diff --git a/var/spack/repos/builtin/packages/tar/package.py b/var/spack/repos/builtin/packages/tar/package.py
index b665031f29..58e4de1877 100644
--- a/var/spack/repos/builtin/packages/tar/package.py
+++ b/var/spack/repos/builtin/packages/tar/package.py
@@ -31,7 +31,12 @@ class Tar(AutotoolsPackage, GNUMirrorPackage):
patch('se-selinux.patch', when='@:1.29')
patch('argp-pgi.patch', when='@:1.29')
patch('gnutar-configure-xattrs.patch', when='@1.28')
- patch('nvhpc.patch', when='%nvhpc')
+ # The NVIDIA compilers do not currently support some GNU builtins.
+ # Detect this case and use the fallback path.
+ patch('nvhpc-1.30.patch', when='@1.30:1.32 %nvhpc')
+ patch('nvhpc-1.34.patch', when='@1.34 %nvhpc')
+ # Workaround bug where __LONG_WIDTH__ is not defined
+ patch('nvhpc-long-width.patch', when='@1.34 %nvhpc')
@classmethod
def determine_version(cls, exe):