aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index adb3610dec..5f52d40725 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -247,10 +247,10 @@ static char *libruby_pathflag;
# define MJIT_CFLAGS_PIPE 0
#endif
-// Use `-nostartfiles -nodefaultlibs -nostdlib` for GCC where possible, which does not work on mingw, cygwin, AIX, and OpenBSD.
-// This seems to improve MJIT performance on GCC. TODO: Check if it works with MJIT and add it on configure.
+// Use `-nodefaultlibs -nostdlib` for GCC where possible, which does not work on mingw, cygwin, AIX, and OpenBSD.
+// This seems to improve MJIT performance on GCC.
#if defined __GNUC__ && !defined __clang__ && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(_AIX) && !defined(__OpenBSD__)
-# define GCC_NOSTDLIB_FLAGS "-nostartfiles", "-nodefaultlibs", "-nostdlib",
+# define GCC_NOSTDLIB_FLAGS "-nodefaultlibs", "-nostdlib",
#else
# define GCC_NOSTDLIB_FLAGS /* empty */
#endif
@@ -264,7 +264,13 @@ static const char *const CC_DEBUG_ARGS[] = {MJIT_DEBUGFLAGS NULL};
static const char *const CC_OPTIMIZE_ARGS[] = {MJIT_OPTFLAGS NULL};
static const char *const CC_LDSHARED_ARGS[] = {MJIT_LDSHARED GCC_PIC_FLAGS NULL};
-static const char *const CC_DLDFLAGS_ARGS[] = {MJIT_DLDFLAGS GCC_NOSTDLIB_FLAGS NULL};
+static const char *const CC_DLDFLAGS_ARGS[] = {
+ MJIT_DLDFLAGS
+#if defined __GNUC__ && !defined __clang__ && !defined(__OpenBSD__)
+ "-nostartfiles",
+#endif
+ GCC_NOSTDLIB_FLAGS NULL
+};
static const char *const CC_LIBS[] = {
#if defined(_WIN32) || defined(__CYGWIN__)
@@ -274,7 +280,7 @@ static const char *const CC_LIBS[] = {
# if defined(_WIN32)
"-lmsvcrt", // mingw
# endif
- "-lgcc", // all platforms using GCC
+ "-lgcc", // mingw, cygwin, and GCC platforms using `-nodefaultlibs -nostdlib`
#endif
NULL
};