Re: mupdf on arm

2019-07-30 Thread Stuart Henderson
On 2019/07/30 11:03, adr wrote:
> 
> Mupdf needs to be compiled with gcc on armv7. With llvm it will
> fail with a bus error. I think the problem is in the memory management
> functions. I'm not attaching patches because I'm not familiar with
> the ports system. I added COMPILER= ports-gcc; estdc++ to WANTILB;
> lang/gcc/8,-libs>=8,<9 to LIB_DEPENDS and make plist.
> 
> adr.
> 
> 

Are things any different with 1.16.0rc2?
https://junkpile.org/mupdf-1.16.0rc2.diff

Or if you are on 6.5,
https://junkpile.org/mupdf-1.16.0rc2.stable.diff




Re: mupdf on arm

2019-07-30 Thread Stuart Henderson
On 2019/07/30 14:00, Stuart Henderson wrote:
> On 2019/07/30 11:03, adr wrote:
> > 
> > Mupdf needs to be compiled with gcc on armv7. With llvm it will
> > fail with a bus error. I think the problem is in the memory management
> > functions. I'm not attaching patches because I'm not familiar with
> > the ports system. I added COMPILER= ports-gcc; estdc++ to WANTILB;
> > lang/gcc/8,-libs>=8,<9 to LIB_DEPENDS and make plist.
> > 
> > adr.
> > 
> > 
> 
> Are things any different with 1.16.0rc2?
> https://junkpile.org/mupdf-1.16.0rc2.diff
> 
> Or if you are on 6.5,
> https://junkpile.org/mupdf-1.16.0rc2.stable.diff
> 
> 

Actually I see 1.16.0 is released now, I'll commit it to -current, if you want 
to
try it on 6.5 just update the V line in the port Makefile after patching and run
"make makesum" before building to test.



Re: mupdf on arm

2019-07-30 Thread adr

On Tue, 30 Jul 2019, Stuart Henderson wrote:


Date: Tue, 30 Jul 2019 14:18:36 +0100
From: Stuart Henderson 
To: adr 
Cc: ports@openbsd.org
Subject: Re: mupdf on arm

On 2019/07/30 14:00, Stuart Henderson wrote:

On 2019/07/30 11:03, adr wrote:


Mupdf needs to be compiled with gcc on armv7. With llvm it will
fail with a bus error. I think the problem is in the memory management
functions. I'm not attaching patches because I'm not familiar with
the ports system. I added COMPILER= ports-gcc; estdc++ to WANTILB;
lang/gcc/8,-libs>=8,<9 to LIB_DEPENDS and make plist.

adr.




Are things any different with 1.16.0rc2?
https://junkpile.org/mupdf-1.16.0rc2.diff

Or if you are on 6.5,
https://junkpile.org/mupdf-1.16.0rc2.stable.diff




Actually I see 1.16.0 is released now, I'll commit it to -current, if you want 
to
try it on 6.5 just update the V line in the port Makefile after patching and run
"make makesum" before building to test.




I'll try it when it arrives (and I get time). I'm on current.

Regards,
adr.



Re: mupdf on arm

2019-07-30 Thread adr

I've tested 1.16.0. You still need to compile it with
gcc.

adr.



Re: mupdf on arm

2019-07-31 Thread Stuart Henderson
On 2019/07/30 15:51, adr wrote:
> I've tested 1.16.0. You still need to compile it with
> gcc.
> 
> adr.
> 

In this case it's possible to do, so I've changed the port to use gcc
on armv7.

However if there are problems here it wouldn't be a big surprise if there
are similar problems with other ports too (some of which probably can't
be built with gcc, e.g. things using C++ where this could result in a
conflict between C++ standard libraries) so it would be good to have some
more details about what's happening. Could you send a backtrace please?



Re: mupdf on arm

2019-07-31 Thread adr

On Wed, 31 Jul 2019, Stuart Henderson wrote:

conflict between C++ standard libraries) so it would be good to have some
more details about what's happening. Could you send a backtrace please?


Sure, I'll do it when I have time. I'm pretty sure it is
about accessing memory unaligned. I'm having problems
making my own assembly work in llvm|OpenBSD.

Regards,
adr.



Re: mupdf on arm

2019-07-31 Thread adr
In the attachment are the bt, the disas	sembly of the function of interest 
until the bus error, and the state of the registers. I'm completely new to 
llvm, and I'm trying to build my cabin here, so I can't be of any help 
(I'm not familiar with the restrictions you are imposing here), altough I 
bet the problem is in their memory management: source/fitz/memory.c.


Good luck!
adr.
$ mupdf somefile.pdf
Bus error (core dumped)
$ gdb mupdf mupdf-x11.core
[...]
(gdb) bt
#0  0x07e332dc in fz_paint_glyph () from /usr/local/bin/mupdf
#1  0x in ?? ()
(gdb) disassemble
Dump of assembler code for function fz_paint_glyph:
0x07e31a44 :  stmdb   sp!, {r4, r5, r6, r7, r8, r9, r10, r11, 
lr}
0x07e31a48 :  add r11, sp, #28; 0x1c
0x07e31a4c :  sub sp, sp, #4  ; 0x4
0x07e31a50 : fstmdbd sp!, {d8-d15}
0x07e31a54 : sub sp, sp, #264; 0x108
0x07e31a58 : undefined
0x07e31a5c : str r3, [sp, #244]
0x07e31a60 : str r2, [sp, #256]
0x07e31a64 : ldr r3, [r1, #44]
0x07e31a68 : ldr r4, [r11, #20]
0x07e31a6c : ldr r2, [r11, #12]
0x07e31a70 : cmp r3, #0  ; 0x0
0x07e31a74 : beq 0x7e31f2c 
0x07e31a78 : ldrbr6, [r1, #24]
0x07e31a7c : ldrblr, [r1, #26]
0x07e31a80 : str r0, [sp, #260]
0x07e31a84 : sub r8, r6, lr
0x07e31a88 : ldrbr7, [r0, r8]
0x07e31a8c : cmp r7, #0  ; 0x0
0x07e31a90 : beq 0x7e32288 
0x07e31a94 : ldr r10, [r11, #24]
0x07e31a98 : mov r5, r2
0x07e31a9c : mov r2, r4
0x07e31aa0 : cmp r7, #255; 0xff
0x07e31aa4 : bne 0x7e32298 
0x07e31aa8 :cmp r10, #0 ; 0x0
0x07e31aac :ldr r0, [r1, #28]
0x07e31ab0 :ldrne   r1, [r10]
0x07e31ab4 :str r0, [sp, #220]
0x07e31ab8 :cmpne   r1, #0  ; 0x0
0x07e31abc :bne 0x7e328a0 
0x07e31ac0 :cmp r8, #4  ; 0x4
0x07e31ac4 :beq 0x7e32f4c 
0x07e31ac8 :cmp r8, #3  ; 0x3
0x07e31acc :beq 0x7e332bc 
0x07e31ad0 :cmp r8, #1  ; 0x1
0x07e31ad4 :bne 0x7e338f0 
0x07e31ad8 :cmp lr, #0  ; 0x0
0x07e31adc :beq 0x7e35540 
0x07e31ae0 :cmp r5, #0  ; 0x0
0x07e31ae4 :beq 0x7e32288 
0x07e31ae8 :ldr r0, [sp, #260]
0x07e31aec :bicnv   r2, r7, #95 ; 0x5f
0x07e31af0 :mov r9, #1  ; 0x1
0x07e31af4 :ldrhr8, [r0]
0x07e31af8 :ldr r0, [sp, #244]
0x07e31afc :add lr, r0, #32 ; 0x20
0x07e31b00 :mcr 11, 5, r8, cr0, cr0, {5}
0x07e31b04 :str lr, [sp, #224]
0x07e31b08 :ldr r0, [lr, r2, lsl #2]
0x07e31b0c :sub r5, r5, #1  ; 0x1
0x07e31b10 :str r2, [sp, #248]
0x07e31b14 :str r5, [sp, #252]
0x07e31b18 :cmp r0, #0  ; 0x0
0x07e31b1c :blt 0x7e31be8 
0x07e31b20 :ldr r1, [sp, #244]
0x07e31b24 :ldr r2, [r11, #16]
0x07e31b28 :add r0, r1, r0
0x07e31b2c :ldr r4, [sp, #256]
0x07e31b30 :add r7, r0, #32 ; 0x20
0x07e31b34 :mov r1, #0  ; 0x0
0x07e31b38 :cmp r2, #0  ; 0x0
0x07e31b3c :beq 0x7e31bf0 
0x07e31b40 :ldr r5, [sp, #260]
0x07e31b44 :mov r1, #0  ; 0x0
0x07e31b48 :ldrbr6, [r7], #1
0x07e31b4c :and r0, r6, #3  ; 0x3
0x07e31b50 :cmp r0, #2  ; 0x2
0x07e31b54 :beq 0x7e31b7c 
0x07e31b58 :cmp r0, #1  ; 0x1
0x07e31b5c :beq 0x7e31b94 
0x07e31b60 :cmp r0, #0  ; 0x0
0x07e31b64 :bne 0x7e31bac 
0x07e31b68 :mov r1, r6, lsr #2
0x07e31b6c :mov r3, #0  ; 0x0
0x07e31b70 :subsr2, r2, r3
0x07e31b74 :bne 0x7e31b48 
0x07e31b78 :b   0x7e31bd8 
0x07e31b7c :orr r0, r9, r1, lsl #5
0x07e31b80 :and r12, r6, #4 ; 0x4
0x07e31b84 :add r3, r0, r6, lsr #3
0x07e31b88 :cmp r3, r2
0x07e31b8c :ble 0x7e31bc4 
0x07e31b90 :b   0x7e31c0c 
0x07e31b94 :orr r0, r9, r1, lsl #6
0x07e31b98 :mov r1, #0  ; 0x0
0x07e31b9c :add r3, r0, r6, lsr #2
0x07e31ba0 :cmp r3, r2
0x07e31ba4 :ble 0x7e31bd0 
0x07e31ba8 :b   0x7e31c1c 
0x07e31bac :orr r0, r9, r1, lsl #5
0x07e31bb0 :and r12, r6, #4 ; 0x4
0x07e31bb4 :add r3, r0, r6, lsr #3
0x07e31bb8 :cmp r3, r2
0x07e31bbc :bgt 0x7e31c30 
0x07e31bc0 :add r7, r7, r3
0x07e31bc4 :mov r1, #0  ; 0x0
0x07e31bc8 :cmp r12, #0 ; 0x0
0x07e31bcc :bne 0x7e31c00 
0x07e31bd0 :subsr2, r2, r3
0x07e31bd4 :bne 0x7e31b48 
0x07e31bd8 :mov r12, #0 ; 0x0
0x07e31bdc :mov r6, r4
0x07e31be0 :ldr r10, [r11, #8]
0x07e31be4 :b   0x7e31c40 
0x07e31be8 :ldr r4, [sp, #256]
0x07e31bec :b   0x7e31f08 
0x07e31bf