Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread John Paul Adrian Glaubitz
Hi,

On Tue, 2025-12-02 at 18:08 +0100, Rene Engelhard wrote:
> > On Tue, 2025-12-02 at 18:03 +0100, Rene Engelhard wrote:
> > > Am 02.12.25 um 17:58 schrieb John Paul Adrian Glaubitz:
> > > > 14:43  (__arch64__) sollte wohl entfernt werden 
> > > > -https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h
> > > > OK, I'll drop __arch64__ altogether then. I'm still struggling to fix 
> > > > my Gerrit access
> > > > in the mean time to fix this issue upstream in pdfium.
> > > If I understand that one right this *is* like this upstream in master 
> > > already. That link is to
> > > 
> > > https://pdfium.googlesource.com/pdfium/+/refs/heads/main
> > What do you mean? The wrong check for the __arch64__ macro is still there, 
> > see:
> > 
> > https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_math_clang_gcc_impl.h#17
> 
> Ah, right, he mentioned the gcc one where this is the clang one (which is 
> used).
> 
> 
> Will remove in the patch anyways.

Yeah, just drop the __arch64__ then, please.

I will take care of landing this fix upstream and also the arch definitions for 
the
other architectures to enable the pdfium build there out of the box.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread Rene Engelhard

Hi,

Am 02.12.25 um 18:04 schrieb John Paul Adrian Glaubitz:

Hello,

On Tue, 2025-12-02 at 18:03 +0100, Rene Engelhard wrote:

Am 02.12.25 um 17:58 schrieb John Paul Adrian Glaubitz:

14:43  (__arch64__) sollte wohl entfernt werden 
-https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h
OK, I'll drop __arch64__ altogether then. I'm still struggling to fix my Gerrit 
access
in the mean time to fix this issue upstream in pdfium.

If I understand that one right this *is* like this upstream in master already. 
That link is to

https://pdfium.googlesource.com/pdfium/+/refs/heads/main

What do you mean? The wrong check for the __arch64__ macro is still there, see:

https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_math_clang_gcc_impl.h#17


Ah, right, he mentioned the gcc one where this is the clang one (which is used).


Will remove in the patch anyways.


Regards,


Rene



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread John Paul Adrian Glaubitz
Hello,

On Tue, 2025-12-02 at 18:03 +0100, Rene Engelhard wrote:
> Am 02.12.25 um 17:58 schrieb John Paul Adrian Glaubitz:
> > 14:43  (__arch64__) sollte wohl entfernt werden 
> > -https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h
> 
> > OK, I'll drop __arch64__ altogether then. I'm still struggling to fix my 
> > Gerrit access
> > in the mean time to fix this issue upstream in pdfium.
> 
> If I understand that one right this *is* like this upstream in master 
> already. That link is to
> 
> https://pdfium.googlesource.com/pdfium/+/refs/heads/main

What do you mean? The wrong check for the __arch64__ macro is still there, see:

https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_math_clang_gcc_impl.h#17

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread Rene Engelhard

Hi,

Am 02.12.25 um 17:58 schrieb John Paul Adrian Glaubitz:

14:43  (__arch64__) sollte wohl entfernt werden 
-https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h



OK, I'll drop __arch64__ altogether then. I'm still struggling to fix my Gerrit 
access
in the mean time to fix this issue upstream in pdfium.


If I understand that one right this *is* like this upstream in master already. 
That link is to

https://pdfium.googlesource.com/pdfium/+/refs/heads/main


Regards,


Rene



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread John Paul Adrian Glaubitz
Hi Rene,

On Tue, 2025-12-02 at 17:53 +0100, Rene Engelhard wrote:
> Am 27.11.25 um 18:32 schrieb John Paul Adrian Glaubitz:
> > No, the build log is confusing here. It's definitely in pdfium. I have 
> > applied the
> > patch locally and the build continues past this error now.
> > 
> > You can see the bug here in the source code [1]. The preprocessor check is
> > incorrect and the reason why the the inline assembly code in [2] is emitted:
> > 
> > asm("qsub %[result], %[first], %[second]"
> > 
> > As shown above __arch64__ is incorrect for AArch64 since it's supposed to 
> > be __aarch64__.
> 
> Apparently that's wrong. From Ubuntu:
> 
> 14:27  hi, dieser sparc64 fix macht nun aber arm64 kaputt?
>   
> https://salsa.debian.org/libreoffice-team/libreoffice/libreoffice/-/commit/526f26e484aed8c398b44ee6a7dbcd374e89d7f4
> 14:29     91 |     asm("qsub %[result], %[first], %[second]"
> 14:29        |         ^
> 14:29  :1:2: note: instantiated into assembly here
> 14:29      1 |         qsub x22, x9, x8
> 14:29        |         ^
> 14:29  
> workdir/UnpackedTarball/pdfium/core/fxcrt/numerics/safe_math_arm_impl.h:91:9: 
> error: unrecognized instruction mnemonic, did you mean: fsub,
>                 msub, sqsub, sub, subs, uqsub?
> 14:43  (__arch64__) sollte wohl entfernt werden - 
> https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h
> 17:42 <_rene_> hatte das noch nicht auf arm getestet
> 17:42 <_rene_> schreib das mal in den bug an Adrian
> 17:45 <_rene_> s/bug/bug und/
> 
> 17:49  
> https://git.launchpad.net/~libreoffice/ubuntu/+source/libreoffice/commit/?h=ubuntu-resolute-25.8&id=6099cd68b729afc128ecf8fe3f2dad15d7569e32

OK, I'll drop __arch64__ altogether then. I'm still struggling to fix my Gerrit 
access
in the mean time to fix this issue upstream in pdfium.

I'm surprised though what the original intention of the author of these lines 
were then
if not to enable ARM-optimized code on AArch64. There is no other 64-bit 
variant of ARM
that I know of, is there?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-12-02 Thread Rene Engelhard

Hi,

Am 27.11.25 um 18:32 schrieb John Paul Adrian Glaubitz:

No, the build log is confusing here. It's definitely in pdfium. I have applied 
the
patch locally and the build continues past this error now.

You can see the bug here in the source code [1]. The preprocessor check is
incorrect and the reason why the the inline assembly code in [2] is emitted:

asm("qsub %[result], %[first], %[second]"

As shown above __arch64__ is incorrect for AArch64 since it's supposed to be 
__aarch64__.


Apparently that's wrong. From Ubuntu:

14:27  hi, dieser sparc64 fix macht nun aber arm64 kaputt?
 
https://salsa.debian.org/libreoffice-team/libreoffice/libreoffice/-/commit/526f26e484aed8c398b44ee6a7dbcd374e89d7f4
14:29     91 |     asm("qsub %[result], %[first], %[second]"
14:29        |         ^
14:29  :1:2: note: instantiated into assembly here
14:29      1 |         qsub x22, x9, x8
14:29        |         ^
14:29  
workdir/UnpackedTarball/pdfium/core/fxcrt/numerics/safe_math_arm_impl.h:91:9: error: 
unrecognized instruction mnemonic, did you mean: fsub,
               msub, sqsub, sub, subs, uqsub?
14:43  (__arch64__) sollte wohl entfernt werden - 
https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_conversions.h
17:42 <_rene_> hatte das noch nicht auf arm getestet
17:42 <_rene_> schreib das mal in den bug an Adrian
17:45 <_rene_> s/bug/bug und/

17:49  
https://git.launchpad.net/~libreoffice/ubuntu/+source/libreoffice/commit/?h=ubuntu-resolute-25.8&id=6099cd68b729afc128ecf8fe3f2dad15d7569e32


Regards,


Rene



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-11-27 Thread Rene Engelhard

Hi,

Am 27.11.25 um 19:11 schrieb John Paul Adrian Glaubitz:

It would have been a patch to *libreoffice* if it included external/ etc and
is not just the pdfium part which needs to be applied with makefile magic...

Yes, it's complicated by the fact that the code that needs to be patched sits
inside a compressed tar archive which is why I have pushed the patch to pdfium
upstream already.


Actually it's fairly trivial. Ther's already gazillions of patches.

See the pending message.


Regards,


Rene



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-11-27 Thread John Paul Adrian Glaubitz
On Thu, 2025-11-27 at 18:59 +0100, Rene Engelhard wrote:
> BTW, is this is not a patch. Not for *libreoffice*.

I'm aware of that. I have opened this bug report and attached the patch to
make you aware of the problem. The bug actually affects arm64 as well since
it won't use the optimized code on arm64 which it's supposed to use.

> It would have been a patch to *libreoffice* if it included external/ etc and
> is not just the pdfium part which needs to be applied with makefile magic...

Yes, it's complicated by the fact that the code that needs to be patched sits
inside a compressed tar archive which is why I have pushed the patch to pdfium
upstream already.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: Bug#1121498: libreoffice: Preprocessor macros in pdfium confuse arm64 with sparc64

2025-11-27 Thread John Paul Adrian Glaubitz
Hello,

On Thu, 2025-11-27 at 18:22 +0100, Rene Engelhard wrote:
> > the libreoffice package fails to build from source on sparc64 with:
> > /tmp/ccLEFgM7.s: Assembler messages:
> > /tmp/ccLEFgM7.s:10332: Error: Unknown opcode: `qsub'
> > /tmp/ccLEFgM7.s:10365: Error: Unknown opcode: `qsub'
> 
> ??
> 
> https://buildd.debian.org/status/fetch.php?pkg=libreoffice&arch=sparc64&ver=4%3A25.8.3-1&stamp=1763053335&raw=0
>  looks like pdfium just builds fine?
> 
> The actual error is in lp-solve.

No, the build log is confusing here. It's definitely in pdfium. I have applied 
the
patch locally and the build continues past this error now.

You can see the bug here in the source code [1]. The preprocessor check is
incorrect and the reason why the the inline assembly code in [2] is emitted:

asm("qsub %[result], %[first], %[second]"

As shown above __arch64__ is incorrect for AArch64 since it's supposed to be 
__aarch64__.

Adrian

> [1] 
> https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_math_clang_gcc_impl.h#17
> [2] 
> https://pdfium.googlesource.com/pdfium/+/refs/heads/main/core/fxcrt/numerics/safe_math_arm_impl.h#91

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913