summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2022-03-12 16:01:47 +0900
committernagachika <nagachika@ruby-lang.org>2022-03-12 16:01:47 +0900
commit09b27ec6a984ec1b660d5b7b48f2ff4d5a0065bc (patch)
treecdd442df20d2aaac54173b05dfa60153bfc6e8a0
parent4b1cee1431b44e923611c65a8ec5cc61d4025641 (diff)
merge revision(s) 737e4432b978eb4b9f5b10fb6cc6d9c883a5d17a: [Backport #18409]
configure: add -Wl,--no-as-needed It is reported that combination of `--enable-shared --with-jemalloc` breaks on Debian bullseye (testig). Deeper investigation revealed that this system's `ld(1)` is patched, to turn `ld --as-needed` on by default. This linker flag strips "unnecessary" library dependencies from an executable. In case of `ruby(1)` (of `--enable-shared`), because everything is in `libruby.so`, the binary itself doesn't include any calls to `malloc(3)` at all. So in spite of our explicit `-ljemalloc` flag, it is ignored. Libc's one is chosen instead. This is not what we want. Let's force our `ruby(1)` link what we want. Fixes https://github.com/ruby/ruby/pull/4627 The author would like to acknowledge Akihiko Odaki <akihiko.odaki@gmail.com> for their contributions. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+)
-rw-r--r--configure.ac5
-rw-r--r--version.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 2dcebdde9f..49e0c79a4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3292,6 +3292,11 @@ AS_CASE("$enable_shared", [yes], [
AC_DEFINE_UNQUOTED(LIBDIR_BASENAME, ["${libdir_basename}"])
libdir_basename="${libdir_basename}"${multiarch+'/${arch}'}
+ RUBY_TRY_LDFLAGS([${linker_flag}--no-as-needed], [no_as_needed=yes], [no_as_needed=no])
+ AS_IF([test "$no_as_needed" = yes], [
+ RUBY_APPEND_OPTIONS(LDFLAGS, [${linker_flag}--no-as-needed])
+ ])
+
AS_CASE(["$target_os"],
[freebsd*|dragonfly*], [],
[
diff --git a/version.h b/version.h
index c58e649e5a..640459726e 100644
--- a/version.h
+++ b/version.h
@@ -12,7 +12,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 4
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 184
+#define RUBY_PATCHLEVEL 185
#define RUBY_RELEASE_YEAR 2022
#define RUBY_RELEASE_MONTH 3