]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Fix building with NVHPC (NVIDIA HPC SDK).
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Wed, 13 Mar 2024 12:07:13 +0000 (13:07 +0100)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 21 May 2024 21:11:58 +0000 (00:11 +0300)
NVHPC compiler has several issues that make it impossible to
build liblzma:
  - the compiler cannot handle unions that contain pointers that
    are not the first members;
  - the compiler fails to produce valid code for delta_decode if the
    vectorization is enabled, which results in failed tests.

This introduces NVHPC-specific workarounds that address the issues.

(This commit was contributed under 0BSD but the author confirmed
that it is fine to backport it to the public domain branches. See
https://github.com/tukaani-project/xz/pull/90#issuecomment-2100185936
and the next two messages.)

(cherry picked from commit 096bc0e3f8fb4bfc4d2f3f64a7f219401ffb4c31)

src/liblzma/common/string_conversion.c
src/liblzma/delta/delta_decoder.c

index d2c1e80936b24477b99fd6af17d3347eed8605b2..8d6b3fb9b1bd1e43bf0da68730d1a06f67897c2e 100644 (file)
@@ -218,12 +218,14 @@ typedef struct {
        uint16_t offset;
 
        union {
+// NVHPC has problems with unions that contain pointers that are not the first
+// members
+               const name_value_map *map;
+
                struct {
                        uint32_t min;
                        uint32_t max;
                } range;
-
-               const name_value_map *map;
        } u;
 } option_map;
 
index 77cf65cc76d8096ce5d85af97e6c3250bf2e71f0..3953bc4aaa28c9f65f64b216d1aba5f45ba552ad 100644 (file)
@@ -26,6 +26,9 @@ decode_buffer(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
 }
 
 
+#ifdef __NVCOMPILER
+#      pragma routine novector
+#endif
 static lzma_ret
 delta_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,