[前][次][番号順一覧][スレッド一覧]

ruby-changes:53982

From: odaira <ko1@a...>
Date: Wed, 5 Dec 2018 07:19:14 +0900 (JST)
Subject: [ruby-changes:53982] odaira:r66202 (trunk): Enable MJIT on AIX

odaira	2018-12-05 07:19:09 +0900 (Wed, 05 Dec 2018)

  New Revision: 66202

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66202

  Log:
    Enable MJIT on AIX
    
    * configure.ac: disable using __builtin_setjmp to avoid errors when execution
      globally jumps out of JITted code. Specify -std=gnu99 to JIT compilation
      to avoid errors regarding the "restrict" keyword in the precompiled header.
      Specify -shared in addition to -Wl,-G when building shared libraries
      to make mjit_build_dir.so expose the MJIT_BUILD_DIR symbol.  Use LDR_PRELOAD
      to load mjit_build_dir.so.
    
    * mjit_worker.c: do not specify -nodefaultlibs or -nostdlibs because on AIX
      JITted code internally refers to the memcpy function.

  Modified files:
    trunk/configure.ac
    trunk/mjit_worker.c
Index: mjit_worker.c
===================================================================
--- mjit_worker.c	(revision 66201)
+++ mjit_worker.c	(revision 66202)
@@ -260,7 +260,7 @@ static const char *const CC_DLDFLAGS_ARG https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L260
     MJIT_DLDFLAGS
 #if defined __GNUC__ && !defined __clang__
     "-nostartfiles",
-# if !defined(_WIN32) && !defined(__CYGWIN__)
+# if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(_AIX)
     "-nodefaultlibs", "-nostdlib",
 # endif
 #endif
Index: configure.ac
===================================================================
--- configure.ac	(revision 66201)
+++ configure.ac	(revision 66202)
@@ -996,6 +996,7 @@ main() https://github.com/ruby/ruby/blob/trunk/configure.ac#L996
 		],
 [aix*],[	LIBS="-lm $LIBS"
 		ac_cv_func_round=no
+		ac_cv_func___builtin_setjmp=no
 		],
 [linux*],[	LIBS="-lm $LIBS"
 		# __builtin_longjmp in ppc64* Linux does not restore
@@ -2563,7 +2564,10 @@ AC_SUBST(ARCH_FLAG)dnl https://github.com/ruby/ruby/blob/trunk/configure.ac#L2564
 AC_SUBST(MJIT_HEADER_FLAGS)dnl
 AC_SUBST(MJIT_HEADER_INSTALL_DIR)dnl
 AC_SUBST(MJIT_CC)dnl
-AC_SUBST(MJIT_CFLAGS, [${MJIT_CFLAGS-"-w ${orig_cflags}"}])dnl
+AS_IF([test "$GCC" = "yes"], [
+    AS_CASE(["$target_os"],[aix*],[mjit_std_cflag="-std=gnu99"])
+])
+AC_SUBST(MJIT_CFLAGS, [${MJIT_CFLAGS-"-w ${mjit_std_cflag} ${orig_cflags}"}])dnl
 AC_SUBST(MJIT_OPTFLAGS, [${MJIT_OPTFLAGS-'$(optflags)'}])dnl
 AC_SUBST(MJIT_DEBUGFLAGS, [${MJIT_DEBUGFLAGS-'$(debugflags)'}])dnl
 AC_SUBST(MJIT_LDSHARED)dnl
@@ -2679,7 +2683,11 @@ AS_IF([test "$with_dln_a_out" != yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L2683
 			: ${PRELOADENV=DYLD_INSERT_LIBRARIES}
 			rb_cv_dlopen=yes],
         [aix*], [	: ${LDSHARED='$(CC)'}
-			LDSHARED="$LDSHARED ${linker_flag}-G"
+			AS_IF([test "$GCC" = yes], [
+			    LDSHARED="$LDSHARED ${linker_flag}-G -shared"
+			], [
+			    LDSHARED="$LDSHARED ${linker_flag}-G"
+			])
 			EXTDLDFLAGS='-e$(TARGET_ENTRY)'
 			XLDFLAGS="${linker_flag}"'-bE:$(ARCHFILE)'" ${linker_flag}-brtl"
 			XLDFLAGS="$XLDFLAGS ${linker_flag}-blibpath:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
@@ -2687,6 +2695,7 @@ AS_IF([test "$with_dln_a_out" != yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L2695
                         TRY_LINK='$(CC) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
                         TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(LOCAL_LIBS) $(LIBS)'
 			: ${LIBPATHENV=LIBPATH}
+			: ${PRELOADENV=LDR_PRELOAD}
 			rb_cv_dlopen=yes],
 	[nto-qnx*], [	DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
 			: ${LDSHARED='$(LD) -Bshareable -x'}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]