Skip to content

Fix -windows-gnu installer #29681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mk/cfg/i686-pc-windows-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ CFG_LDPATH_i686-pc-windows-gnu :=
CFG_RUN_i686-pc-windows-gnu=$(2)
CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2))
CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
CFG_LIBC_STARTUP_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
3 changes: 2 additions & 1 deletion mk/cfg/x86_64-pc-windows-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ CFG_LDPATH_x86_64-pc-windows-gnu :=
CFG_RUN_x86_64-pc-windows-gnu=$(2)
CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2))
CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
CFG_LIBC_STARTUP_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
6 changes: 3 additions & 3 deletions mk/cfg/x86_64-unknown-linux-musl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CFG_LDPATH_x86_64-unknown-linux-musl :=
CFG_RUN_x86_64-unknown-linux-musl=$(2)
CFG_RUN_TARG_x86_64-unknown-linux-musl=$(call CFG_RUN_x86_64-unknown-linux-musl,,$(2))
CFG_GNU_TRIPLE_x86_64-unknown-linux-musl := x86_64-unknown-linux-musl
CFG_THIRD_PARTY_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o
CFG_INSTALLED_OBJECTS_x86_64-unknown-linux-musl := crt1.o crti.o crtn.o

NATIVE_DEPS_libc_T_x86_64-unknown-linux-musl += libc.a
NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += libunwind.a \
crt1.o crti.o crtn.o
INSTALLED_OBJECTS_x86_64-unknown-linux-musl += crt1.o crti.o crtn.o
NATIVE_DEPS_std_T_x86_64-unknown-linux-musl += libunwind.a crt1.o crti.o crtn.o
2 changes: 1 addition & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ endif
# Prerequisites for using the stageN compiler to build target artifacts
TSREQ$(1)_T_$(2)_H_$(3) = \
$$(HSREQ$(1)_H_$(3)) \
$$(foreach obj,$$(INSTALLED_OBJECTS_$(2)),\
$$(foreach obj,$$(REQUIRED_OBJECTS_$(2)),\
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))

# Prerequisites for a working stageN compiler and libraries, for a specific
Expand Down
3 changes: 3 additions & 0 deletions mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ CFG_RLIB_GLOB=lib$(1)-*.rlib
include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk)

define ADD_INSTALLED_OBJECTS
INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1))
REQUIRED_OBJECTS_$(1) += $$(CFG_THIRD_PARTY_OBJECTS_$(1))
INSTALLED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
REQUIRED_OBJECTS_$(1) += $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
endef

$(foreach target,$(CFG_TARGET), \
Expand Down
4 changes: 4 additions & 0 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ endif # endif for darwin
ifeq ($$(findstring musl,$(1)),musl)
$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
cp $$^ $$@
else
# Ask gcc where it is
$$(RT_OUTPUT_DIR_$(1))/%:
cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@
endif

endef
Expand Down
44 changes: 2 additions & 42 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,6 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \

endef

# Macro for building runtime startup objects
# Of those we have two kinds:
# - Rust runtime-specific: these are Rust's equivalents of GCC's crti.o/crtn.o,
# - LibC-specific: these we don't build ourselves, but copy them from the system lib directory.
#
# $(1) - stage
# $(2) - target triple
# $(3) - host triple
define TARGET_RT_STARTUP

# Expand build rules for rsbegin.o and rsend.o
$$(foreach obj,rsbegin rsend, \
$$(eval $$(call TARGET_RUSTRT_STARTUP_OBJ,$(1),$(2),$(3),$$(obj))) )

# Expand build rules for libc startup objects
$$(foreach obj,$$(CFG_LIBC_STARTUP_OBJECTS_$(2)), \
$$(eval $$(call TARGET_LIBC_STARTUP_OBJ,$(1),$(2),$(3),$$(obj))) )

endef

# Macro for building runtime startup/shutdown object files;
# these are Rust's equivalent of crti.o, crtn.o
#
Expand All @@ -178,27 +158,6 @@ $$(foreach crate, $$(TARGET_CRATES), \

endef

# Macro for copying libc startup objects into the target's lib directory.
#
# $(1) - stage
# $(2) - target triple
# $(3) - host triple
# $(4) - object name
define TARGET_LIBC_STARTUP_OBJ

# Ask gcc where the startup object is located
$$(TLIB$(1)_T_$(2)_H_$(3))/$(4) : $$(shell $$(CC_$(2)) -print-file-name=$(4))
@$$(call E, cp: $$@)
@cp $$^ $$@

# Make sure this is done before libcore has finished building
# (libcore itself does not depend on these objects, but other crates do,
# so might as well do it here)
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4)

endef


# Every recipe in RUST_TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
# a directory that can be cleaned out during the middle of a run of
# the get-snapshot.py script. Therefore, every recipe needs to have
Expand Down Expand Up @@ -245,4 +204,5 @@ $(foreach host,$(CFG_HOST), \
$(foreach host,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(foreach stage,$(STAGES), \
$(eval $(call TARGET_RT_STARTUP,$(stage),$(target),$(host))))))
$(foreach obj,rsbegin rsend, \
$(eval $(call TARGET_RUSTRT_STARTUP_OBJ,$(stage),$(target),$(host),$(obj)))))))
4 changes: 0 additions & 4 deletions src/etc/make-win-dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ def make_win_dist(rust_root, plat_root, target_triple):
rustc_dlls.append("libgcc_s_seh-1.dll")

target_libs = [ # MinGW libs
"crtbegin.o",
"crtend.o",
"crt2.o",
"dllcrt2.o",
"libgcc.a",
"libgcc_eh.a",
"libgcc_s.a",
Expand Down