Skip to content

Commit f8f723d

Browse files
committed
Simplify logic for mkmf's try_link
1 parent 1bb7537 commit f8f723d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

lib/mri/mkmf.rb

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,19 +2887,11 @@ def MAIN_DOES_NOTHING(*refs)
28872887
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
28882888

28892889
if defined?(::TruffleRuby)
2890-
# We need to link to libtruffleruby for MakeMakefile#try_link to succeed.
2891-
# The created executable will link against both libgraalvm-llvm.so and libtruffleruby and
2892-
# might be executed for #try_constant and #try_run so we also need -rpath for both.
2893-
# TODO: could likely always use the second branch here
2894-
if Truffle::Boot.get_option('cexts-sulong')
2895-
libtruffleruby_dir = File.dirname(RbConfig::CONFIG['libtruffleruby'])
2896-
TRY_LINK << " -L#{libtruffleruby_dir} -rpath #{libtruffleruby_dir} -ltruffleruby"
2897-
libgraalvm_llvm_dir = ::Truffle::Boot.toolchain_paths(:LD_LIBRARY_PATH)
2898-
TRY_LINK << " -rpath #{libgraalvm_llvm_dir}"
2899-
else
2900-
libtrufflerubytrampoline_dir = File.dirname(RbConfig::CONFIG['libtrufflerubytrampoline'])
2901-
TRY_LINK << " -L#{libtrufflerubytrampoline_dir} -Wl,-rpath,#{libtrufflerubytrampoline_dir} -ltrufflerubytrampoline"
2902-
end
2890+
# We need to link to libtrufflerubytrampoline for MakeMakefile#try_link to succeed.
2891+
# The created executable will link against libtrufflerubytrampoline and
2892+
# might be executed for #try_constant and #try_run so we also need -rpath.
2893+
libtrufflerubytrampoline_dir = File.dirname(RbConfig::CONFIG['libtrufflerubytrampoline'])
2894+
TRY_LINK << " -L#{libtrufflerubytrampoline_dir} -Wl,-rpath,#{libtrufflerubytrampoline_dir} -ltrufflerubytrampoline"
29032895
end
29042896

29052897
##

0 commit comments

Comments
 (0)