On 01/12 07:50, Jeremy Evans wrote:
> Thank you very much for the testing and analysis.  I can confirm the JIT
> compilation problems on amd64 because it uses the cached cc path (before
> it would even get to the __guard_local issues on gcc).
> 
> Below is a new Makefile that will use dist patches pulled from Ruby's
> SVN to handle the random.c and addr2line.c issues, as well as an
> additional significant regression.  I tested that it also builds with
> CC=/usr/bin/gcc.
> 
> I will keep working on the JIT issues to see if I can fix them and get
> something that works with both base clang and gcc.

I think was able to fix both JIT issues.  Here's an updated Makefile as
well as a new patch to mjit_worker.c.  I've tested this with both base
clang and base gcc on amd64, same results on both.

I would appreciate testing to see if this fixes the issues identified,
and if so, OKs to import and hookup.  Assuming the mjit_worker.c patch
fixes the JIT issues on gcc, I'll try to get it upstreamed.

Thanks,
Jeremy

lang/ruby/2.6/Makefile:

# $OpenBSD: Makefile,v 1.4 2018/03/31 21:12:45 jeremy Exp $

VERSION =               2.6.0
DISTNAME =              ruby-${VERSION}
SHARED_LIBS =           ruby26  0.0
NEXTVER =               2.7

MASTER_SITES0 =         
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_2_6/
PATCHFILES =            
ruby26-lib-net-protocol.patch{lib/net/protocol.rb?r1=66799\&r2=66798\&pathrev=66799\&view=patch}:0
 \
                        
ruby26-addr2line.patch{addr2line.c?r1=66800\&r2=66799\&pathrev=66800\&view=patch}:0
 \
                        
ruby26-random.patch{random.c?r1=66729\&r2=66728\&pathrev=66729\&view=patch}:0
PATCH_DIST_STRIP =      -p2

PSEUDO_FLAVORS=         no_ri_docs bootstrap
# Do not build the RI docs on slow arches
.if ${MACHINE_ARCH:Malpha} || ${MACHINE_ARCH:Marm} || ${MACHINE_ARCH:Mhppa}
FLAVOR?=                no_ri_docs bootstrap
.else
FLAVOR?=
.endif

MULTI_PACKAGES =        -main -gdbm -ri_docs
.include <bsd.port.arch.mk>

.if ${BUILD_PACKAGES:M-ri_docs}
ALL_TARGET +=           rdoc
INSTALL_TARGET +=       install-doc
.endif

# Remove after 2.6.1
BUILD_DEPENDS =         archivers/gtar
TAR =                   gtar

# Fix path for JIT compiler to not use shims in ports obj bin dir
CONFIGURE_ENV +=        ac_cv_path_MJIT_CC=`which ${CC}`

WANTLIB-main += curses

post-extract:
        ${POST_EXTRACT}

pre-configure:
        ${FIX_RIPPER}

pre-install:
        ${PRE_INSTALL}

post-install:
        ${FIX_RBCONFIG}

# 20197 tests, 2280013 assertions, 12 failures, 15 errors, 76 skips
do-test:
        -cd ${WRKSRC} && make test-sample
        -cd ${WRKSRC} && make btest-ruby
        -cd ${WRKSRC} && make test-spec SPECOPTS="-f s"
        cd ${WRKSRC} && make test-all TESTOPTS="-v -q"

.include <bsd.port.mk>

lang/ruby/2.6/patches/patch-mjit_worker_c:

$OpenBSD$

Fix JIT compilation when using base gcc.

Index: mjit_worker.c
--- mjit_worker.c.orig
+++ mjit_worker.c
@@ -258,7 +258,7 @@ static const char *const CC_OPTIMIZE_ARGS[] = {MJIT_OP
 static const char *const CC_LDSHARED_ARGS[] = {MJIT_LDSHARED GCC_PIC_FLAGS 
NULL};
 static const char *const CC_DLDFLAGS_ARGS[] = {
     MJIT_DLDFLAGS
-#if defined __GNUC__ && !defined __clang__
+#if defined __GNUC__ && !defined __clang__ && !defined(__OpenBSD__)
     "-nostartfiles",
 # if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(_AIX)
     "-nodefaultlibs", "-nostdlib",

Reply via email to