From a2c3c4dce68226c6e9b905e6f9d9bd063b9d6568 Mon Sep 17 00:00:00 2001 From: doupengda Date: Wed, 5 Jul 2023 16:59:03 +0800 Subject: [PATCH 1/2] libEMF add support for loongarch64 --- 0001-libEMF-add-loongarch64.patch | 140 ++++++++++++++++++++++++++++++ libEMF.spec | 6 +- 2 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 0001-libEMF-add-loongarch64.patch diff --git a/0001-libEMF-add-loongarch64.patch b/0001-libEMF-add-loongarch64.patch new file mode 100644 index 0000000..c1eb957 --- /dev/null +++ b/0001-libEMF-add-loongarch64.patch @@ -0,0 +1,140 @@ +From 5d147320abe6989d34765c9ab7dbda150496708d Mon Sep 17 00:00:00 2001 +From: doupengda +Date: Wed, 5 Jul 2023 08:53:52 +0000 +Subject: [PATCH] libEMF add loongarch64 + +--- + include/libEMF/wine/winnt.h | 103 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 103 insertions(+) + +diff --git a/include/libEMF/wine/winnt.h b/include/libEMF/wine/winnt.h +index 39e2f90..fc0a514 100644 +--- a/include/libEMF/wine/winnt.h ++++ b/include/libEMF/wine/winnt.h +@@ -69,6 +69,10 @@ + # define WORDS_BIGENDIAN + # define BITFIELDS_BIGENDIAN + # undef ALLOW_UNALIGNED_ACCESS ++#elif defined(__loongarch64) ++# undef WORDS_BIGENDIAN ++# undef BITFIELDS_BIGENDIAN ++# undef ALLOW_UNALIGNED_ACCESS + #elif !defined(RC_INVOKED) + # error Unknown CPU architecture! + #endif +@@ -480,6 +484,7 @@ typedef HANDLE *PHANDLE, *LPHANDLE; + #define PROCESSOR_ARCHITECTURE_PPC 3 + #define PROCESSOR_ARCHITECTURE_SHX 4 + #define PROCESSOR_ARCHITECTURE_ARM 5 ++#define PROCESSOR_ARCHITECTURE_LOONGARCH64 6 + #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF + + /* dwProcessorType */ +@@ -1020,6 +1025,104 @@ typedef struct _CONTEXT + + #endif /* _ALPHA_ */ + ++#if defined(__loongarch64) ++ ++#define CONTEXT_LOONGARCH64 0x00010000 ++ ++#define CONTEXT_CONTROL (CONTEXT_LOONGARCH64 | 0x00000001) ++#define CONTEXT_FLOATING_POINT (CONTEXT_LOONGARCH64 | 0x00000002) ++#define CONTEXT_INTEGER (CONTEXT_LOONGARCH64 | 0x00000004) ++ ++#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) ++ ++typedef struct _CONTEXT ++{ ++ ULONG ContextFlags; ++ /* CONTEXT_INTEGER */ ++ union ++ { ++ struct ++ { ++ DWORD64 R1; ++ DWORD64 R2; ++ DWORD64 R3; ++ DWORD64 R4; ++ DWORD64 R5; ++ DWORD64 R6; ++ DWORD64 R7; ++ DWORD64 R8; ++ DWORD64 R9; ++ DWORD64 R10; ++ DWORD64 R11; ++ DWORD64 R12; ++ DWORD64 R13; ++ DWORD64 R14; ++ DWORD64 R15; ++ DWORD64 R16; ++ DWORD64 R17; ++ DWORD64 R18; ++ DWORD64 R19; ++ DWORD64 R20; ++ DWORD64 R21; ++ DWORD64 R22; ++ DWORD64 R23; ++ DWORD64 R24; ++ DWORD64 R25; ++ DWORD64 R26; ++ DWORD64 R27; ++ DWORD64 R28; ++ DWORD64 R29; ++ DWORD64 R30; ++ DWORD64 R31; ++ } DUMMYSTRUCTNAME; ++ DWORD64 R[31]; ++ } DUMMYUNIONNAME1; ++ /* CONTEXT_CONTROL */ ++ DWORD64 pc; ++ /* CONTEXT_FLOATING_POINT */ ++ union ++ { ++ struct ++ { ++ DWORD64 F0; ++ DWORD64 F1; ++ DWORD64 F2; ++ DWORD64 F3; ++ DWORD64 F4; ++ DWORD64 F5; ++ DWORD64 F6; ++ DWORD64 F7; ++ DWORD64 F8; ++ DWORD64 F9; ++ DWORD64 F10; ++ DWORD64 F11; ++ DWORD64 F12; ++ DWORD64 F13; ++ DWORD64 F14; ++ DWORD64 F15; ++ DWORD64 F16; ++ DWORD64 F17; ++ DWORD64 F18; ++ DWORD64 F19; ++ DWORD64 F20; ++ DWORD64 F21; ++ DWORD64 F22; ++ DWORD64 F23; ++ DWORD64 F24; ++ DWORD64 F25; ++ DWORD64 F26; ++ DWORD64 F27; ++ DWORD64 F28; ++ DWORD64 F29; ++ DWORD64 F30; ++ DWORD64 F31; ++ } DUMMYSTRUCTNAME; ++ DWORD64 F[32]; ++ } DUMMYUNIONNAME2; ++ /* CONTEXT_DEBUG_REGISTERS */ ++} CONTEXT; ++#endif /* __loongarch64 */ ++ + /* Mips context definitions */ + #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__) + +-- +2.33.0 + diff --git a/libEMF.spec b/libEMF.spec index 79cffe3..65a1a71 100644 --- a/libEMF.spec +++ b/libEMF.spec @@ -1,10 +1,11 @@ Name: libEMF Version: 1.0.13 -Release: 1 +Release: 2 Summary: A library for generating Enhanced Metafiles License: LGPLv2+ and GPLv2+ URL: http://libemf.sourceforge.net/ Source0: https://downloads.sourceforge.net/project/libemf/libemf/%{version}/libemf-%{version}.tar.gz +Patch0: 0001-libEMF-add-loongarch64.patch BuildRequires: gcc-c++ chrpath @@ -59,6 +60,9 @@ make check %doc doc/html/* NEWS README %changelog +* Wed Jul 5 2023 doupengda - 1.0.13-2 +- libEMF add support for loongarch64 + * Tue Sep 28 2021 yaoxin - 1.0.13-1 - Upgrade libEMF to 1.0.13; fix CVE-2020-13999 CVE-2020-11863 CVE-2020-11865 CVE-2020-11866 CVE-2020-11864 -- Gitee From f96c9341a6ee8d02021dfd3f2a8c9d07fd8db69f Mon Sep 17 00:00:00 2001 From: dpd Date: Fri, 14 Jul 2023 09:02:37 +0000 Subject: [PATCH 2/2] update libEMF.spec. Signed-off-by: dpd --- libEMF.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libEMF.spec b/libEMF.spec index 65a1a71..f8c148e 100644 --- a/libEMF.spec +++ b/libEMF.spec @@ -28,7 +28,10 @@ Summary: Documentation for libEMF Documentation for libEMF. %prep -%autosetup -n libemf-%{version} -p1 +%setup -q -n libemf-%{version} +%ifarch loongarch64 +%patch0 -p1 +%endif %build %configure --disable-static --enable-editing -- Gitee