instance method
Gem::Ext::CargoBuilder#linker_args
linker_args
lib/rubygems/ext/cargo_builder.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/ext/cargo_builder.rb, line 159
def linker_args
cc_flag = self.class.shellsplit(makefile_config("CC"))
# Avoid to ccache like tool from Rust build
# see https://github.com/ruby/rubygems/pull/8521#issuecomment-2689854359
# ex. CC="ccache gcc" or CC="sccache clang --any --args"
cc_flag.shift if cc_flag.size >= 2 && !cc_flag[1].start_with?("-")
linker = cc_flag.shift
link_args = cc_flag.flat_map {|a| ["-C", "link-arg=#{a}"] }
return mswin_link_args if linker == "cl"
["-C", "linker=#{linker}", *link_args]
end
We want to use the same linker that Ruby uses, so that the linker flags from mkmf work properly.
See also
#libruby_args
#makefile_config
#ldflag_to_link_modifier
#maybe_resolve_ldflag_variable
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1