summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2024-02-05 17:38:05 +0000
committerYuta Saito <kateinoigakukun@gmail.com>2024-03-01 03:16:23 +0900
commit57f014b2fae3f62b26e17a57de761a61908537c4 (patch)
tree2f5c4c519ee49db9239829a9f3dcf1862d52dbbd
parent1c0c490aa0141100d1dece9a7b5e83dc03ca0e13 (diff)
Use configured `LD` for linking enc and ext libraries
"AR" was well propagated to the enc.mk and mkmf, but "LD" was not. This caused the dynamic libraries to be linked with a linker found in the PATH, which could be different from the one used in the Ruby build process. This is especially important for cross-compilation, where the host linker may not be compatible with the target system. (e.g. WebAssembly)
-rw-r--r--enc/Makefile.in1
-rw-r--r--lib/mkmf.rb1
2 files changed, 2 insertions, 0 deletions
diff --git a/enc/Makefile.in b/enc/Makefile.in
index dd8ca1b528..c57d6c17b5 100644
--- a/enc/Makefile.in
+++ b/enc/Makefile.in
@@ -40,6 +40,7 @@ BUILTRUBY = $(topdir)/miniruby$(EXEEXT)
empty =
AR = @AR@
+LD = @LD@
CC = @CC@
ARFLAGS = @ARFLAGS@$(empty)
RANLIB = @RANLIB@
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index f59c19c554..e07bcf7ca0 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -2149,6 +2149,7 @@ DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
LDSHARED = #{CONFIG['LDSHARED']}
LDSHAREDXX = #{config_string('LDSHAREDXX') || '$(LDSHARED)'}
AR = #{CONFIG['AR']}
+LD = #{CONFIG['LD']}
EXEEXT = #{CONFIG['EXEEXT']}
}