Skip to content

Commit 80d520f

Browse files
Don't use the same llvmdeps.rs for every host.
1 parent 2264049 commit 80d520f

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

mk/docs.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ $(2) += doc/$(1)/index.html
299299
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
300300
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
301301
@$$(call E, rustdoc: $$@)
302-
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<
302+
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
303+
$$(RUSTDOC) --cfg dox --cfg stage2 $$<
303304
endef
304305

305306
$(foreach crate,$(DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),DOC_TARGETS)))

mk/llvm.mk

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ else
4949
LLVM_STDCPP_LOCATION_$(1) =
5050
endif
5151

52+
53+
# LLVM linkage:
54+
LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
55+
$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
56+
$(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(LLVM_COMPONENTS)" "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
57+
$$(LLVM_CONFIG_$(1))
5258
endef
5359

5460
$(foreach host,$(CFG_HOST), \
@@ -57,10 +63,14 @@ $(foreach host,$(CFG_HOST), \
5763
$(foreach host,$(CFG_HOST), \
5864
$(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
5965

60-
$(S)src/librustc_llvm/llvmdeps.rs: \
61-
$(LLVM_CONFIGS) \
62-
$(S)src/etc/mklldeps.py \
63-
$(MKFILE_DEPS)
64-
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
65-
"$@" "$(LLVM_COMPONENTS)" "$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
66-
$(LLVM_CONFIGS)
66+
# This can't be done in target.mk because it's included before this file.
67+
define LLVM_LINKAGE_DEPS
68+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(3))
69+
endef
70+
71+
$(foreach source,$(CFG_HOST), \
72+
$(foreach target,$(CFG_TARGET), \
73+
$(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \
74+
$(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \
75+
$(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \
76+
$(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source)))))

mk/target.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7979
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
8080
$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
8181
$$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
82-
$$(STAGE$(1)_T_$(2)_H_$(3)) \
82+
$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
83+
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \
8384
$$(RUST_LIB_FLAGS_ST$(1)) \
8485
-L "$$(RT_OUTPUT_DIR_$(2))" \
8586
-L "$$(LLVM_LIBDIR_$(2))" \
@@ -134,8 +135,6 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
134135

135136
define TARGET_HOST_RULES
136137

137-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $(S)src/librustc_llvm/llvmdeps.rs
138-
139138
$$(TBIN$(1)_T_$(2)_H_$(3))/:
140139
mkdir -p $$@
141140

src/librustc_llvm/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2214,4 +2214,6 @@ pub unsafe fn static_link_hack_this_sucks() {
22142214
// parts of LLVM that rustllvm depends on aren't thrown away by the linker.
22152215
// Works to the above fix for #15460 to ensure LLVM dependencies that
22162216
// are only used by rustllvm don't get stripped by the linker.
2217-
mod llvmdeps;
2217+
mod llvmdeps {
2218+
include!(env!("CFG_LLVM_LINKAGE_FILE"))
2219+
}

0 commit comments

Comments
 (0)