From 65ab2ab1c053a3277b2dedbbba52bbaafb59b65f Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 25 Jun 2018 02:52:29 +0000 Subject: [PATCH] mjit.c: set PIC flags on clang for FreeBSD and glibc This seems required on FreeBSD 11.1 (clang 4.0.0) and Debian stretch (clang 3.8.1) for shared libraries. Note: Not checking __linux__ because there are statically-linked Linux distros (I don't know if they can support MJIT). But glibc doesn't support static linking, so we guard on that. Maybe other platforms will need this, too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mjit.c b/mjit.c index 2f025a66b6..b207986c2b 100644 --- a/mjit.c +++ b/mjit.c @@ -616,7 +616,9 @@ free_list(struct rb_mjit_unit_list *list) static const char *const CC_DEBUG_ARGS[] = {MJIT_DEBUGFLAGS NULL}; static const char *const CC_OPTIMIZE_ARGS[] = {MJIT_OPTFLAGS NULL}; -#if defined __GNUC__ && !defined __clang__ +#if defined(__GNUC__) && \ + (!defined(__clang__) || \ + (defined(__clang__) && (defined(__FreeBSD__) || defined(__GLIBC__)))) #define GCC_PIC_FLAGS "-Wfatal-errors", "-fPIC", "-shared", "-w", \ "-pipe", #else