@@ -443,58 +443,7 @@ endif
443443
444444include $(top_srcdir ) /yjit/yjit.mk
445445include $(top_srcdir ) /zjit/zjit.mk
446-
447- # Because of Cargo cache, if the actual binary is not changed from the
448- # previous build, the mtime is preserved as the cached file.
449- # This means the target is not updated actually, and it will need to
450- # rebuild at the next build.
451- RUST_LIB_TOUCH = touch $@
452-
453- ifneq ($(RUST_JIT_SUPPORT ) ,no)
454- $(RUST_LIB ) :
455- $(Q ) if [ ' $(ZJIT_SUPPORT)' != no -a ' $(YJIT_SUPPORT)' != no ]; then \
456- echo ' building YJIT and ZJIT ($(RUST_JIT_SUPPORT:yes=release) mode)' ; \
457- elif [ ' $(ZJIT_SUPPORT)' != no ]; then \
458- echo ' building ZJIT ($(RUST_JIT_SUPPORT) mode)' ; \
459- elif [ ' $(YJIT_SUPPORT)' != no ]; then \
460- echo ' building YJIT ($(RUST_JIT_SUPPORT) mode)' ; \
461- fi
462- +$(Q ) CARGO_TARGET_DIR=' $(CARGO_TARGET_DIR)' \
463- CARGO_TERM_PROGRESS_WHEN=' never' \
464- $(CARGO ) $(CARGO_VERBOSE ) build --manifest-path ' $(top_srcdir)/Cargo.toml' $(CARGO_BUILD_ARGS )
465- $(RUST_LIB_TOUCH )
466- endif
467-
468- rust-libobj : $(RUST_LIBOBJ )
469- rust-lib : $(RUST_LIB )
470-
471- RUST_LIB_SYMBOLS = $(RUST_LIB:.a= ) .symbols
472- $(RUST_LIBOBJ ) : $(RUST_LIB )
473- $(ECHO ) ' partial linking $(RUST_LIB) into $@'
474- ifneq ($(findstring darwin,$(target_os ) ) ,)
475- $(Q) $(CC) -nodefaultlibs -r -o $@ -exported_symbols_list $(RUST_LIB_SYMBOLS) $(RUST_LIB)
476- else
477- $(Q) $(LD) -r -o $@ --whole-archive $(RUST_LIB)
478- -$(Q) $(OBJCOPY) --wildcard --keep-global-symbol='$(SYMBOL_PREFIX)rb_*' $(@)
479- endif
480-
481- # For Darwin only: a list of symbols that we want the glommed Rust static lib to export.
482- # Unfortunately, using wildcard like '_rb_*' with -exported-symbol does not work, at least
483- # not on version 820.1. Assume llvm-nm, so XCode 8.0 (from 2016) or newer.
484- #
485- # The -exported_symbols_list pulls out the right archive members. Symbols not listed
486- # in the list are made private extern, which are in turn made local as we're using `ld -r`.
487- # Note, section about -keep_private_externs in ld's man page hints at this behavior on which
488- # we rely.
489- ifneq ($(findstring darwin,$(target_os ) ) ,)
490- $(RUST_LIB_SYMBOLS ) : $(RUST_LIB )
491- $(Q ) $(tooldir ) /darwin-ar $(NM ) --defined-only --extern-only $(RUST_LIB ) | \
492- sed -n -e ' s/.* //' -e ' /^$(SYMBOL_PREFIX)rb_/p' \
493- -e ' /^$(SYMBOL_PREFIX)rust_eh_personality/p' \
494- > $@
495-
496- $(RUST_LIBOBJ ) : $(RUST_LIB_SYMBOLS )
497- endif
446+ include $(top_srcdir ) /defs/jit.mk
498447
499448# Query on the generated rdoc
500449#
0 commit comments