external/pdfium/UnpackedTarball_pdfium.mk |    2 ++
 external/pdfium/pdfium_arm64.patch.1      |   12 ++++++++++++
 2 files changed, 14 insertions(+)

New commits:
commit 67ed7f8e2da59211ac938f5ba84c31fbd812759c
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Thu Jul 28 15:44:27 2022 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Thu Jul 28 17:26:30 2022 +0200

    pdfium: fix build on windows aarch64 - no __popcnt
    
    see https://docs.microsoft.com/en-us/cpp/intrinsics/arm64-intrinsics
    
    Change-Id: I291f727c1aa6e00d02d2339fcb338159ae49d0c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137568
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 01bd6c74c42d..e3b88adb5ab4 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -14,6 +14,8 @@ pdfium_patches += build.patch.1
 # Avoids Windows 8 build dependency.
 pdfium_patches += windows7.patch.1
 pdfium_patches += c++20-comparison.patch
+# __popcnt not available on arm64
+pdfium_patches += pdfium_arm64.patch.1
 # Use CoreGraphics.h instead of Carbon.h
 pdfium_patches += cg-instead-of-carbon.patch.1
 # Android NDK 19 - that is known to work well - does not have 2 defines
diff --git a/external/pdfium/pdfium_arm64.patch.1 
b/external/pdfium/pdfium_arm64.patch.1
new file mode 100644
index 000000000000..3a517ed1da52
--- /dev/null
+++ b/external/pdfium/pdfium_arm64.patch.1
@@ -0,0 +1,12 @@
+diff -ur pdfium.org/third_party/libopenjpeg/ht_dec.c 
pdfium/third_party/libopenjpeg/ht_dec.c
+--- pdfium.org/third_party/libopenjpeg/ht_dec.c        2022-07-28 
15:19:17.366247900 +0200
++++ pdfium/third_party/libopenjpeg/ht_dec.c    2022-07-28 15:23:25.641843900 
+0200
+@@ -69,7 +69,7 @@
+ static INLINE
+ OPJ_UINT32 population_count(OPJ_UINT32 val)
+ {
+-#ifdef OPJ_COMPILER_MSVC
++#if defined(OPJ_COMPILER_MSVC) && !defined(_ARM64_)
+     return (OPJ_UINT32)__popcnt(val);
+ #elif (defined OPJ_COMPILER_GNUC)
+     return (OPJ_UINT32)__builtin_popcount(val);

Reply via email to