mjit_worker.c: pass -lgcc to GCC platforms

using `-nodefaultlibs -nostdlib`.

I assume libgcc is needed when we use -nostdlib, and it's linked on some
platforms but not linked on some platforms (like aarch64, and possibly
AIX as well) as said in https://wiki.osdev.org/Libgcc :

> You can link with libgcc by passing -lgcc when linking your kernel
with your compiler. You don't need to do this unless you pass the
-nodefaultlibs option (implied by -nostdlib)

Also note that -nostdlib is not strictly needed (rather implied
-nodefaultlibs is problematic for Gentoo like Bug#15513, which will be
approached later) but helpful for performance. So I want to keep it for
now.

[Bug #15522]

I'm not trying to add `-nodefaultlibs -nostdlib` for AIX in this commit
because AIX RubyCI is dead right now, but I'll try to add them again
once RubyCI is fixed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2019-01-14 06:18:53 +00:00
parent d89d1d4687
commit d14089fb3c

View File

@ -268,14 +268,14 @@ static const char *const CC_DLDFLAGS_ARGS[] = {
};
static const char *const CC_LIBS[] = {
#if defined(_WIN32) || defined(__CYGWIN__) // mswin, mingw, cygwin
MJIT_LIBS
#if defined(_WIN32) || defined(__CYGWIN__)
MJIT_LIBS // mswin, mingw, cygwin
#endif
#if defined(_WIN32) && defined __GNUC__ && !defined __clang__ // mingw
"-lmsvcrt",
#endif
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined __GNUC__ && !defined __clang__ // mingw, cygwin
"-lgcc",
#if defined __GNUC__ && !defined __clang__
# if defined(_WIN32)
"-lmsvcrt", // mingw
# endif
"-lgcc", // mingw, cygwin, and GCC platforms using `-nodefaultlibs -nostdlib`
#endif
NULL
};