i386 builds as well, as expected!

> Move aarch64 to the front of the list.

Sure, will do that.

sthen, naddy: OK to put it in, or too late?

Am Sat, Apr 10, 2021 at 01:18:05AM +0200 schrieb Patrick Wildt:
> Cool, thanks, Robert.
> 
> > sthen | makes sense to have that mono diff, need to be sure it doesn't 
> > break existing working archs (looked good from a quick read but i haven't 
> > tested)
> 
> The changes are all encapsulated in proper arch ifdefs.  To verify that
> is the case I'll compile it on our two mono arches;  amd64 works, and I
> will test i386 tomorrow morning.
> 
> Patrick
> 
> Am Fri, Apr 09, 2021 at 09:00:39PM +0200 schrieb Robert Nagy:
> > Hi
> > 
> > I am okay with this and i do not see why it cannot make release.
> > 
> > On 09/04/21 17:15 +0200, Patrick Wildt wrote:
> > > Hi,
> > > 
> > > to do some release tests with iked we wanted to play^Wtest games/openra
> > > over IPsec.  Turns out that arm64 does not support lang/mono, but I have
> > > gotten it to run.  With the following diff, games/openra builds and I
> > > can even play it.
> > > 
> > > This doesn't need to make release, so no worries.  Would be nice for
> > > others, but I myself run -current anyway.
> > > 
> > > The arch-defines.mk enables all mono-related packages.  In gcconfig.h
> > > OPENBSD needs to be checked so make sure in case it's AArch64, it
> > > doesn't define NOSYS.  Additionally apparently one has to check for
> > > OPENBSD and __aarch64__ to define the mach type.  Then there's another
> > > AARCH64 block where OS-related stuff has to be defined.  I simply used
> > > the AMD64 block, but skipping ELFCLASS.  In boringssl we need to have
> > > the 'find aarch64 crypto accel' code as well.  We don't have a nice API
> > > yet to extract info, so let's for now only use NEON, which we require
> > > on AArch64.  As far as I can see, ucontext is sigcontext, so I provide
> > > the same defines as FreeBSD but with sigcontext context.
> > > 
> > > I can try to get the diffs upstreamed.
> > > 
> > > Patrick
> > > 
> > > diff --git a/infrastructure/mk/arch-defines.mk 
> > > b/infrastructure/mk/arch-defines.mk
> > > index 228c3991f50..965949a964b 100644
> > > --- a/infrastructure/mk/arch-defines.mk
> > > +++ b/infrastructure/mk/arch-defines.mk
> > > @@ -21,7 +21,7 @@ LP64_ARCHS = aarch64 alpha amd64 mips64 mips64el 
> > > powerpc64 sparc64
> > >  GCC4_ARCHS = alpha hppa sh sparc64
> > >  GCC3_ARCHS = m88k
> > >  # XXX easier for ports that depend on mono
> > > -MONO_ARCHS = amd64 i386
> > > +MONO_ARCHS = amd64 i386 aarch64
> > >  OCAML_NATIVE_ARCHS = i386 amd64
> > >  OCAML_NATIVE_DYNLINK_ARCHS = i386 amd64
> > >  GO_ARCHS = aarch64 amd64 arm arm64 armv7 i386
> > > diff --git 
> > > a/lang/mono/patches/patch-external_bdwgc_include_private_gcconfig_h 
> > > b/lang/mono/patches/patch-external_bdwgc_include_private_gcconfig_h
> > > new file mode 100644
> > > index 00000000000..e2d766861a7
> > > --- /dev/null
> > > +++ b/lang/mono/patches/patch-external_bdwgc_include_private_gcconfig_h
> > > @@ -0,0 +1,51 @@
> > > +$OpenBSD$
> > > +
> > > +Index: external/bdwgc/include/private/gcconfig.h
> > > +--- external/bdwgc/include/private/gcconfig.h.orig
> > > ++++ external/bdwgc/include/private/gcconfig.h
> > > +@@ -155,7 +155,7 @@ EXTERN_C_BEGIN
> > > + # if defined(__aarch64__)
> > > + #    define AARCH64
> > > + #    if !defined(LINUX) && !defined(DARWIN) && !defined(FREEBSD) \
> > > +-        && !defined(NN_BUILD_TARGET_PLATFORM_NX)
> > > ++        && !defined(OPENBSD) && !defined(NN_BUILD_TARGET_PLATFORM_NX)
> > > + #      define NOSYS
> > > + #      define mach_type_known
> > > + #    endif
> > > +@@ -348,6 +348,10 @@ EXTERN_C_BEGIN
> > > + #    define X86_64
> > > + #    define mach_type_known
> > > + # endif
> > > ++# if defined(OPENBSD) && defined(__aarch64__)
> > > ++#   define AARCH64
> > > ++#   define mach_type_known
> > > ++# endif
> > > + # if defined(LINUX) && (defined(i386) || defined(__i386__))
> > > + #    define I386
> > > + #    define mach_type_known
> > > +@@ -2298,6 +2302,25 @@ EXTERN_C_BEGIN
> > > +       extern char etext[];
> > > + #     define DATASTART GC_FreeBSDGetDataStart(0x1000, (ptr_t)etext)
> > > + #     define DATASTART_USES_BSDGETDATASTART
> > > ++#   endif
> > > ++#   ifdef OPENBSD
> > > ++#     define OS_TYPE "OPENBSD"
> > > ++#     ifndef GC_OPENBSD_THREADS
> > > ++        EXTERN_C_END
> > > ++#       include <sys/param.h>
> > > ++#       include <uvm/uvm_extern.h>
> > > ++        EXTERN_C_BEGIN
> > > ++#       ifdef USRSTACK
> > > ++#         define STACKBOTTOM ((ptr_t)USRSTACK)
> > > ++#       else
> > > ++#         define HEURISTIC2
> > > ++#       endif
> > > ++#     endif
> > > ++      extern int __data_start[];
> > > ++      extern int _end[];
> > > ++#     define DATASTART ((ptr_t)__data_start)
> > > ++#     define DATAEND ((ptr_t)(&_end))
> > > ++#     define DYNAMIC_LOADING
> > > + #   endif
> > > + #   ifdef NINTENDO_SWITCH
> > > +       static int zero_fd = -1;
> > > diff --git 
> > > a/lang/mono/patches/patch-external_boringssl_crypto_cpu-aarch64-linux_c 
> > > b/lang/mono/patches/patch-external_boringssl_crypto_cpu-aarch64-linux_c
> > > new file mode 100644
> > > index 00000000000..472cc8637e0
> > > --- /dev/null
> > > +++ 
> > > b/lang/mono/patches/patch-external_boringssl_crypto_cpu-aarch64-linux_c
> > > @@ -0,0 +1,31 @@
> > > +$OpenBSD$
> > > +
> > > +Index: external/boringssl/crypto/cpu-aarch64-linux.c
> > > +--- external/boringssl/crypto/cpu-aarch64-linux.c.orig
> > > ++++ external/boringssl/crypto/cpu-aarch64-linux.c
> > > +@@ -16,7 +16,9 @@
> > > + 
> > > + #if defined(OPENSSL_AARCH64) && !defined(OPENSSL_STATIC_ARMCAP)
> > > + 
> > > ++#if !defined(__OpenBSD__)
> > > + #include <sys/auxv.h>
> > > ++#endif
> > > + 
> > > + #include <openssl/arm_arch.h>
> > > + 
> > > +@@ -63,6 +65,15 @@ void OPENSSL_cpuid_setup(void) {
> > > +   if (ID_AA64ISAR0_SHA2_VAL(isar0_val) >= ID_AA64ISAR0_SHA2_BASE) {
> > > +     OPENSSL_armcap_P |= ARMV8_SHA256;
> > > +   }
> > > ++}
> > > ++
> > > ++#elif defined(__OpenBSD__)
> > > ++
> > > ++#include <stdlib.h>
> > > ++#include <sys/types.h>
> > > ++
> > > ++void OPENSSL_cpuid_setup(void) {
> > > ++  OPENSSL_armcap_P |= ARMV7_NEON;
> > > + }
> > > + 
> > > + #else // linux
> > > diff --git a/lang/mono/patches/patch-mono_utils_mono-sigcontext_h 
> > > b/lang/mono/patches/patch-mono_utils_mono-sigcontext_h
> > > new file mode 100644
> > > index 00000000000..0d036cac533
> > > --- /dev/null
> > > +++ b/lang/mono/patches/patch-mono_utils_mono-sigcontext_h
> > > @@ -0,0 +1,18 @@
> > > +$OpenBSD$
> > > +
> > > +Index: mono/utils/mono-sigcontext.h
> > > +--- mono/utils/mono-sigcontext.h.orig
> > > ++++ mono/utils/mono-sigcontext.h
> > > +@@ -472,6 +472,12 @@ typedef struct ucontext {
> > > +         #define UCONTEXT_REG_SP(ctx) 
> > > (((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_sp)
> > > +         #define UCONTEXT_REG_R0(ctx) 
> > > (((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_x [ARMREG_R0])
> > > +         #define UCONTEXT_GREGS(ctx) 
> > > (&(((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_x))
> > > ++#elif defined(__OpenBSD__)
> > > ++        /* ucontext_t == sigcontext */
> > > ++        #define UCONTEXT_REG_PC(ctx) (((ucontext_t*)(ctx))->sc_elr)
> > > ++        #define UCONTEXT_REG_SP(ctx) (((ucontext_t*)(ctx))->sc_sp)
> > > ++        #define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->sc_x 
> > > [ARMREG_R0])
> > > ++        #define UCONTEXT_GREGS(ctx) (&(((ucontext_t*)(ctx))->sc_x))
> > > + #else
> > > + #include <ucontext.h>
> > > +         #define UCONTEXT_REG_PC(ctx) 
> > > (((ucontext_t*)(ctx))->uc_mcontext.pc)
> > 
> > -- 
> > Regards,
> > Robert Nagy
> > 

Reply via email to