summaryrefslogtreecommitdiff
path: root/mjit_worker.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-17 21:55:11 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-17 21:55:11 +0000
commitfea28863729f7a28b3a2bd0269d92d1d0c9ea348 (patch)
tree1d39b65b6665c9f4b33c075b391b54ee7c3f84ee /mjit_worker.c
parentb2f102d11909e3aa18c37ff4881d0add9a975359 (diff)
merge revision(s) 66817: [Backport #15513]
mjit_worker.c: pass -nostdlib when making pch as well [Bug #15513] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_worker.c')
-rw-r--r--mjit_worker.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/mjit_worker.c b/mjit_worker.c
index 9860bb13e6..41aec5dbcd 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -247,6 +247,14 @@ static char *libruby_pathflag;
# define MJIT_CFLAGS_PIPE 0
#endif
+// Use `-nodefaultlibs -nostdlib` for GCC where possible, which does not work on mingw and cygwin.
+// This seems to improve MJIT performance on GCC.
+#if defined __GNUC__ && !defined __clang__ && !defined(_WIN32) && !defined(__CYGWIN__)
+# define GCC_NOSTDLIB_FLAGS "-nodefaultlibs", "-nostdlib",
+#else
+# define GCC_NOSTDLIB_FLAGS /* empty */
+#endif
+
static const char *const CC_COMMON_ARGS[] = {
MJIT_CC_COMMON MJIT_CFLAGS GCC_PIC_FLAGS
NULL
@@ -260,11 +268,8 @@ static const char *const CC_DLDFLAGS_ARGS[] = {
MJIT_DLDFLAGS
#if defined __GNUC__ && !defined __clang__
"-nostartfiles",
-# if !defined(_WIN32) && !defined(__CYGWIN__)
- "-nodefaultlibs", "-nostdlib",
-# endif
#endif
- NULL
+ GCC_NOSTDLIB_FLAGS NULL
};
static const char *const CC_LIBS[] = {
@@ -735,6 +740,9 @@ make_pch(void)
# ifdef __clang__
"-emit-pch",
# endif
+ // -nodefaultlibs is a linker flag, but it may affect cc1 behavior on Gentoo, which should NOT be changed on pch:
+ // https://gitweb.gentoo.org/proj/gcc-patches.git/tree/7.3.0/gentoo/13_all_default-ssp-fix.patch
+ GCC_NOSTDLIB_FLAGS
"-o", NULL, NULL,
NULL,
};