Skip to content

Commit 6ac0b90

Browse files
committed
rm dead code, jit.mk
1 parent 66bc76c commit 6ac0b90

5 files changed

Lines changed: 55 additions & 60 deletions

File tree

.github/auto_request_review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ files:
1010
'zjit/src/cruby_bindings.inc.rs': []
1111
'doc/zjit*': [team:jit]
1212
'test/ruby/test_zjit*': [team:jit]
13+
'defs/jit.mk': [team:jit]
1314
options:
1415
ignore_draft: true
1516
# This currently doesn't work as intended. We want to skip reviews when only

defs/gmake.mk

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -443,58 +443,7 @@ endif
443443

444444
include $(top_srcdir)/yjit/yjit.mk
445445
include $(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
#

defs/jit.mk

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Make recipes that deal with the rust code of YJIT and ZJIT
2+
3+
# Because of Cargo cache, if the actual binary is not changed from the
4+
# previous build, the mtime is preserved as the cached file.
5+
# This means the target is not updated actually, and it will need to
6+
# rebuild at the next build.
7+
RUST_LIB_TOUCH = touch $@
8+
9+
ifneq ($(RUST_JIT_SUPPORT),no)
10+
$(RUST_LIB):
11+
$(Q)if [ '$(ZJIT_SUPPORT)' != no -a '$(YJIT_SUPPORT)' != no ]; then \
12+
echo 'building YJIT and ZJIT ($(RUST_JIT_SUPPORT:yes=release) mode)'; \
13+
elif [ '$(ZJIT_SUPPORT)' != no ]; then \
14+
echo 'building ZJIT ($(RUST_JIT_SUPPORT) mode)'; \
15+
elif [ '$(YJIT_SUPPORT)' != no ]; then \
16+
echo 'building YJIT ($(RUST_JIT_SUPPORT) mode)'; \
17+
fi
18+
+$(Q)CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \
19+
CARGO_TERM_PROGRESS_WHEN='never' \
20+
$(CARGO) $(CARGO_VERBOSE) build --manifest-path '$(top_srcdir)/Cargo.toml' $(CARGO_BUILD_ARGS)
21+
$(RUST_LIB_TOUCH)
22+
endif
23+
24+
RUST_LIB_SYMBOLS = $(RUST_LIB:.a=).symbols
25+
$(RUST_LIBOBJ): $(RUST_LIB)
26+
$(ECHO) 'partial linking $(RUST_LIB) into $@'
27+
ifneq ($(findstring darwin,$(target_os)),)
28+
$(Q) $(CC) -nodefaultlibs -r -o $@ -exported_symbols_list $(RUST_LIB_SYMBOLS) $(RUST_LIB)
29+
else
30+
$(Q) $(LD) -r -o $@ --whole-archive $(RUST_LIB)
31+
-$(Q) $(OBJCOPY) --wildcard --keep-global-symbol='$(SYMBOL_PREFIX)rb_*' $(@)
32+
endif
33+
34+
rust-libobj: $(RUST_LIBOBJ)
35+
rust-lib: $(RUST_LIB)
36+
37+
# For Darwin only: a list of symbols that we want the glommed Rust static lib to export.
38+
# Unfortunately, using wildcard like '_rb_*' with -exported-symbol does not work, at least
39+
# not on version 820.1. Assume llvm-nm, so XCode 8.0 (from 2016) or newer.
40+
#
41+
# The -exported_symbols_list pulls out the right archive members. Symbols not listed
42+
# in the list are made private extern, which are in turn made local as we're using `ld -r`.
43+
# Note, section about -keep_private_externs in ld's man page hints at this behavior on which
44+
# we rely.
45+
ifneq ($(findstring darwin,$(target_os)),)
46+
$(RUST_LIB_SYMBOLS): $(RUST_LIB)
47+
$(Q) $(tooldir)/darwin-ar $(NM) --defined-only --extern-only $(RUST_LIB) | \
48+
sed -n -e 's/.* //' -e '/^$(SYMBOL_PREFIX)rb_/p' \
49+
-e '/^$(SYMBOL_PREFIX)rust_eh_personality/p' \
50+
> $@
51+
52+
$(RUST_LIBOBJ): $(RUST_LIB_SYMBOLS)
53+
endif

yjit/yjit.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ $(BUILD_YJIT_LIBS): $(YJIT_SRC_FILES)
3030
$(ECHO) 'building Rust YJIT (release mode)'
3131
+$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
3232
$(YJIT_LIB_TOUCH)
33-
else ifeq ($(YJIT_SUPPORT),no)
34-
$(BUILD_YJIT_LIBS):
35-
$(ECHO) 'Error: Tried to build YJIT without configuring it first. Check `make showconfig`?'
36-
@false
3733
endif
3834

3935
# By using YJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install`

zjit/zjit.mk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ $(BUILD_ZJIT_LIBS): $(ZJIT_SRC_FILES)
2929
$(ECHO) 'building Rust ZJIT (release mode)'
3030
+$(Q) $(RUSTC) $(ZJIT_RUSTC_ARGS)
3131
$(ZJIT_LIB_TOUCH)
32-
else ifeq ($(ZJIT_SUPPORT),no)
33-
$(BUILD_ZJIT_LIBS):
34-
$(ECHO) 'Error: Tried to build ZJIT without configuring it first. Check `make showconfig`?'
35-
@false
3632
endif
3733

3834
# By using ZJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install`

0 commit comments

Comments
 (0)