!12 [sync] PR-11: fix loongarch64 sw_64 build error

From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2023-09-22 02:10:51 +00:00 committed by Gitee
commit ff8920f9b5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 167 additions and 6 deletions

156
hdf-loongarch-sw.patch Normal file
View File

@ -0,0 +1,156 @@
diff --git a/hdf/src/atom.h b/hdf/src/atom.h
index 7617bd0..4253c78 100644
--- a/hdf/src/atom.h
+++ b/hdf/src/atom.h
@@ -34,7 +34,9 @@
#define HASH_SIZE_POWER_2
/* Define the following macro for atom caching over all the atoms */
+#if !defined(__loongarch__) && !defined(__sw_64__)
#define ATOMS_ARE_CACHED
+#endif
/* Define the following macro for "inline" atom lookups from the cache */
#ifdef ATOMS_ARE_CACHED /* required for this to work */
diff --git a/hdf/src/hconv.h b/hdf/src/hconv.h
index d6a8748..2179f5b 100644
--- a/hdf/src/hconv.h
+++ b/hdf/src/hconv.h
@@ -59,7 +59,7 @@
/* CONSTANT DEFINITIONS */
/*****************************************************************************/
/* Generally Big-Endian machines */
-#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__) && !defined(__LITTLE_ENDIAN__)
+#if !defined(INTEL86) && !defined(MIPSEL) && !defined(DEC_ALPHA) && !defined(I860) && !defined(SUN386) && !(defined(__ia64) && !(defined(hpux) || defined(__hpux))) && !defined(__x86_64__) && !defined(__arm__) && !defined(__AARCH64EL__) && !defined(__loongarch__) && !defined(__sw_64__) && !defined(__LITTLE_ENDIAN__)
# define UI8_IN DFKnb1b /* Unsigned Integer, 8 bits */
# define UI8_OUT DFKnb1b
# define SI16_IN DFKnb2b /* S = Signed */
diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h
index 42673a7..12c9fff 100644
--- a/hdf/src/hdfi.h
+++ b/hdf/src/hdfi.h
@@ -62,6 +62,7 @@
#define DFMT_CTSS 0x3331
#define DFMT_VAX 0x2221
#define DFMT_MIPSEL 0x4441
+#define DFMT_LOONGARCH 0x4441
#define DFMT_PC 0x4441
#define DFMT_APPLE 0x1111
#define DFMT_APPLE_INTEL 0x4441
@@ -70,6 +71,7 @@
#define DFMT_NEXT 0x1111
#define DFMT_MOTOROLA 0x1111
#define DFMT_ALPHA 0x4441
+#define DFMT_SW_64 0x4441
#define DFMT_VP 0x6611
#define DFMT_I860 0x4441
#define DFMT_IA64 0x4441
@@ -1248,6 +1250,108 @@ typedef int hdf_pint_t; /* an integer the same size as a pointer
#endif /* Linux ARM */
+/* Linux LOONGARCH */
+#if defined __loongarch__
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h> /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT DFMT_LOONGARCH
+typedef void VOID;
+typedef void *VOIDP;
+typedef char *_fcd;
+typedef char char8;
+typedef unsigned char uchar8;
+typedef char int8;
+typedef unsigned char uint8;
+typedef short int int16;
+typedef unsigned short int uint16;
+typedef long int int32;
+typedef unsigned long int uint32;
+typedef int intn;
+typedef unsigned int uintn;
+typedef int intf; /* size of INTEGERs in Fortran compiler */
+typedef float float32;
+typedef double float64;
+typedef int hdf_pint_t; /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#ifdef HAVE_FMPOOL
+#define FILELIB PAGEBUFIO /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#endif
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */
+/* what each does */
+#define JMEMSYS MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /* Linux LOONGARCH */
+
+/* Linux SW_64 */
+#if defined __sw_64__
+
+#ifdef GOT_MACHINE
+If you get an error on this line more than one machine type has been defined.
+Please check your Makefile.
+#endif
+#define GOT_MACHINE
+
+#include <sys/file.h> /* for unbuffered i/o stuff */
+#include <sys/stat.h>
+#define DF_MT DFMT_SW_64
+typedef void VOID;
+typedef void *VOIDP;
+typedef char *_fcd;
+typedef char char8;
+typedef unsigned char uchar8;
+typedef char int8;
+typedef unsigned char uint8;
+typedef short int int16;
+typedef unsigned short int uint16;
+typedef long int int32;
+typedef unsigned long int uint32;
+typedef int intn;
+typedef unsigned int uintn;
+typedef int intf; /* size of INTEGERs in Fortran compiler */
+typedef float float32;
+typedef double float64;
+typedef int hdf_pint_t; /* an integer the same size as a pointer */
+#define FNAME_POST_UNDERSCORE
+#define _fcdtocp(desc) (desc)
+#ifdef HAVE_FMPOOL
+#define FILELIB PAGEBUFIO /* enable page buffering */
+#else
+#define FILELIB UNIXBUFIO
+#endif
+
+/* JPEG #define's - Look in the JPEG docs before changing - (Q) */
+
+/* Determine the memory manager we are going to use. Valid values are: */
+/* MEM_DOS, MEM_ANSI, MEM_NAME, MEM_NOBS. See the JPEG docs for details on */
+/* what each does */
+#define JMEMSYS MEM_ANSI
+
+#ifdef __GNUC__
+#define HAVE_STDC
+#define INCLUDES_ARE_ANSI
+#endif
+
+#endif /* Linux SW_64 */
+
/*-----------------------------------------------------*/
/* 64-bit Free BSD */

View File

@ -1,6 +1,6 @@
Name: hdf Name: hdf
Version: 4.2.14 Version: 4.2.14
Release: 2 Release: 3
Summary: A general purpose library and file format for storing scientific data Summary: A general purpose library and file format for storing scientific data
License: IJG License: IJG
URL: https://portal.hdfgroup.org/ URL: https://portal.hdfgroup.org/
@ -19,6 +19,7 @@ Patch8: hdf-4.2.10-aarch64.patch
# ppc64le support # ppc64le support
# https://bugzilla.redhat.com/show_bug.cgi?id=1134385 # https://bugzilla.redhat.com/show_bug.cgi?id=1134385
Patch9: hdf-ppc64le.patch Patch9: hdf-ppc64le.patch
Patch10:hdf-loongarch-sw.patch
# Fix syntax error on epel6 builds # Fix syntax error on epel6 builds
# Use only if java is disabled # Use only if java is disabled
@ -62,6 +63,7 @@ HDF development headers and libraries.
%patch6 -p1 -b .examplesdir %patch6 -p1 -b .examplesdir
%patch8 -p1 -b .aarch64 %patch8 -p1 -b .aarch64
%patch9 -p1 -b .ppc64le %patch9 -p1 -b .ppc64le
%patch10 -p1 -b .loongarch-sw
find . -type f -name "*.h" -exec chmod 0644 '{}' \; find . -type f -name "*.h" -exec chmod 0644 '{}' \;
find . -type f -name "*.c" -exec chmod 0644 '{}' \; find . -type f -name "*.c" -exec chmod 0644 '{}' \;
@ -134,6 +136,9 @@ make -j1 check
%{_pkgdocdir}/examples/ %{_pkgdocdir}/examples/
%changelog %changelog
* Fri May 19 2023 panchenbo <panchenbo@kylinsec.com.cn> - 4.2.14-3
- fix loongarch64 sw_64 build error
* Tue Aug 10 2021 wangyue <wangyue92@huawei.com> - 4.2.14-2 * Tue Aug 10 2021 wangyue <wangyue92@huawei.com> - 4.2.14-2
- fix build error with gcc-10 - fix build error with gcc-10