Fix boehm-gc runtime on arm

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix boehm-gc runtime on arm

Jeremie Courreges-Anglas-2

(gdb) r
Starting program: /home/jca/a.out
(no debugging symbols found)

Program received signal SIGILL, Illegal instruction.
0x55f9e880 in GC_stop_world () at arm.h:587
587     arm.h: No such file or directory.
        in arm.h
(gdb) bt
#0  0x55f9e880 in GC_stop_world () at arm.h:587
#1  0x55f87610 in GC_stopped_mark (stop_func=0x55f866a4 <GC_never_stop_func>) at alloc.c:646
#2  0x55f87adc in GC_try_to_collect_inner (stop_func=Variable "stop_func" is not available.
) at alloc.c:486
#3  0x55f96370 in GC_init () at misc.c:1282
#4  0x0ff5749c in main () from /home/jca/a.out

This is the cause of the w3m failure:

http://build-failures.rhaalovely.net//arm/2016-12-20/www/w3m,image.log

gc/libatomic_ops tries to use swp instead of ldrex, because our base gcc
defines __ARM_ARCH_5TE__ instead of something more recent.  But swp
doesn't work anymore on armv7 (I read that it can be enabled with
appropriate black magic).

Let's pretend that we don't define __ARM_ARCH_5TE__, which is enough to
convince gc to use ldrex.  With this, all tests pass.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/boehm-gc/Makefile,v
retrieving revision 1.63
diff -u -p -r1.63 Makefile
--- Makefile 12 Nov 2016 10:33:04 -0000 1.63
+++ Makefile 31 Dec 2016 00:40:55 -0000
@@ -7,6 +7,7 @@ VERSION= 7.6.0
 LIBAO_VERSION= 7.4.4
 
 DISTNAME= gc-${VERSION}
+REVISION= 0
 
 PKGNAME-atomic= libatomic_ops-${LIBAO_VERSION}
 PKGNAME-main= boehm-gc-${VERSION}
Index: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
===================================================================
RCS file: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
diff -N patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h 31 Dec 2016 00:40:55 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+gcc-4.2.1 says our armv7 port is __ARM_ARCH_5TE__ instead of
+__ARM_ARCH_7something__.  Fix test to use ldrex and friends instead of
+swp (deprecated).
+
+--- libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h.orig Sat Dec 31 01:02:18 2016
++++ libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h Sat Dec 31 01:06:15 2016
+@@ -44,9 +44,7 @@
+ #if !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_3__) \
+     && !defined(__ARM_ARCH_3M__) && !defined(__ARM_ARCH_4__) \
+     && !defined(__ARM_ARCH_4T__) \
+-    && ((!defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5E__) \
+-         && !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) \
+-         && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6M__)) \
++    && (1 \
+         || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+         || defined(__ARM_ARCH_8A__))
+ # define AO_ARM_HAVE_LDREX


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: Fix boehm-gc runtime on arm

Jonathan Gray-11
On Sat, Dec 31, 2016 at 01:55:22AM +0100, Jeremie Courreges-Anglas wrote:

>
> (gdb) r
> Starting program: /home/jca/a.out
> (no debugging symbols found)
>
> Program received signal SIGILL, Illegal instruction.
> 0x55f9e880 in GC_stop_world () at arm.h:587
> 587     arm.h: No such file or directory.
>         in arm.h
> (gdb) bt
> #0  0x55f9e880 in GC_stop_world () at arm.h:587
> #1  0x55f87610 in GC_stopped_mark (stop_func=0x55f866a4 <GC_never_stop_func>) at alloc.c:646
> #2  0x55f87adc in GC_try_to_collect_inner (stop_func=Variable "stop_func" is not available.
> ) at alloc.c:486
> #3  0x55f96370 in GC_init () at misc.c:1282
> #4  0x0ff5749c in main () from /home/jca/a.out
>
> This is the cause of the w3m failure:
>
> http://build-failures.rhaalovely.net//arm/2016-12-20/www/w3m,image.log
>
> gc/libatomic_ops tries to use swp instead of ldrex, because our base gcc
> defines __ARM_ARCH_5TE__ instead of something more recent.  But swp
> doesn't work anymore on armv7 (I read that it can be enabled with
> appropriate black magic).
>
> Let's pretend that we don't define __ARM_ARCH_5TE__, which is enough to
> convince gc to use ldrex.  With this, all tests pass.
>
> ok?

Does building with base gcc and "-march=armv6" like the kernel does work?

That will then define __ARM_ARCH_6__.

>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/boehm-gc/Makefile,v
> retrieving revision 1.63
> diff -u -p -r1.63 Makefile
> --- Makefile 12 Nov 2016 10:33:04 -0000 1.63
> +++ Makefile 31 Dec 2016 00:40:55 -0000
> @@ -7,6 +7,7 @@ VERSION= 7.6.0
>  LIBAO_VERSION= 7.4.4
>  
>  DISTNAME= gc-${VERSION}
> +REVISION= 0
>  
>  PKGNAME-atomic= libatomic_ops-${LIBAO_VERSION}
>  PKGNAME-main= boehm-gc-${VERSION}
> Index: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
> ===================================================================
> RCS file: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
> diff -N patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h 31 Dec 2016 00:40:55 -0000
> @@ -0,0 +1,19 @@
> +$OpenBSD$
> +
> +gcc-4.2.1 says our armv7 port is __ARM_ARCH_5TE__ instead of
> +__ARM_ARCH_7something__.  Fix test to use ldrex and friends instead of
> +swp (deprecated).
> +
> +--- libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h.orig Sat Dec 31 01:02:18 2016
> ++++ libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h Sat Dec 31 01:06:15 2016
> +@@ -44,9 +44,7 @@
> + #if !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_3__) \
> +     && !defined(__ARM_ARCH_3M__) && !defined(__ARM_ARCH_4__) \
> +     && !defined(__ARM_ARCH_4T__) \
> +-    && ((!defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5E__) \
> +-         && !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) \
> +-         && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6M__)) \
> ++    && (1 \
> +         || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
> +         || defined(__ARM_ARCH_8A__))
> + # define AO_ARM_HAVE_LDREX
>
>
> --
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: Fix boehm-gc runtime on arm

Jeremie Courreges-Anglas-2
Jonathan Gray <[hidden email]> writes:

> On Sat, Dec 31, 2016 at 01:55:22AM +0100, Jeremie Courreges-Anglas wrote:
>>
>> (gdb) r
>> Starting program: /home/jca/a.out
>> (no debugging symbols found)
>>
>> Program received signal SIGILL, Illegal instruction.
>> 0x55f9e880 in GC_stop_world () at arm.h:587
>> 587     arm.h: No such file or directory.
>>         in arm.h
>> (gdb) bt
>> #0  0x55f9e880 in GC_stop_world () at arm.h:587
>> #1  0x55f87610 in GC_stopped_mark (stop_func=0x55f866a4 <GC_never_stop_func>) at alloc.c:646
>> #2  0x55f87adc in GC_try_to_collect_inner (stop_func=Variable "stop_func" is not available.
>> ) at alloc.c:486
>> #3  0x55f96370 in GC_init () at misc.c:1282
>> #4  0x0ff5749c in main () from /home/jca/a.out
>>
>> This is the cause of the w3m failure:
>>
>> http://build-failures.rhaalovely.net//arm/2016-12-20/www/w3m,image.log
>>
>> gc/libatomic_ops tries to use swp instead of ldrex, because our base gcc
>> defines __ARM_ARCH_5TE__ instead of something more recent.  But swp
>> doesn't work anymore on armv7 (I read that it can be enabled with
>> appropriate black magic).
>>
>> Let's pretend that we don't define __ARM_ARCH_5TE__, which is enough to
>> convince gc to use ldrex.  With this, all tests pass.
>>
>> ok?
>
> Does building with base gcc and "-march=armv6" like the kernel does work?
>
> That will then define __ARM_ARCH_6__.

This produced a working gc package.

The diff not needed anymore after Jonathan's commit to
gnu/gcc/gcc/config/arm/openbsd.h.

>>
>>
>> Index: Makefile
>> ===================================================================
>> RCS file: /cvs/ports/devel/boehm-gc/Makefile,v
>> retrieving revision 1.63
>> diff -u -p -r1.63 Makefile
>> --- Makefile 12 Nov 2016 10:33:04 -0000 1.63
>> +++ Makefile 31 Dec 2016 00:40:55 -0000
>> @@ -7,6 +7,7 @@ VERSION= 7.6.0
>>  LIBAO_VERSION= 7.4.4
>>  
>>  DISTNAME= gc-${VERSION}
>> +REVISION= 0
>>  
>>  PKGNAME-atomic= libatomic_ops-${LIBAO_VERSION}
>>  PKGNAME-main= boehm-gc-${VERSION}
>> Index: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
>> ===================================================================
>> RCS file: patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
>> diff -N patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h
>> --- /dev/null 1 Jan 1970 00:00:00 -0000
>> +++ patches/patch-libatomic_ops_src_atomic_ops_sysdeps_gcc_arm_h 31 Dec 2016 00:40:55 -0000
>> @@ -0,0 +1,19 @@
>> +$OpenBSD$
>> +
>> +gcc-4.2.1 says our armv7 port is __ARM_ARCH_5TE__ instead of
>> +__ARM_ARCH_7something__.  Fix test to use ldrex and friends instead of
>> +swp (deprecated).
>> +
>> +--- libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h.orig Sat Dec 31 01:02:18 2016
>> ++++ libatomic_ops/src/atomic_ops/sysdeps/gcc/arm.h Sat Dec 31 01:06:15 2016
>> +@@ -44,9 +44,7 @@
>> + #if !defined(__ARM_ARCH_2__) && !defined(__ARM_ARCH_3__) \
>> +     && !defined(__ARM_ARCH_3M__) && !defined(__ARM_ARCH_4__) \
>> +     && !defined(__ARM_ARCH_4T__) \
>> +-    && ((!defined(__ARM_ARCH_5__) && !defined(__ARM_ARCH_5E__) \
>> +-         && !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) \
>> +-         && !defined(__ARM_ARCH_5TEJ__) && !defined(__ARM_ARCH_6M__)) \
>> ++    && (1 \
>> +         || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
>> +         || defined(__ARM_ARCH_8A__))
>> + # define AO_ARM_HAVE_LDREX
>>
>>
>> --
>> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
>

--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE