about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure15
-rw-r--r--mk/target.mk41
2 files changed, 27 insertions, 29 deletions
diff --git a/configure b/configure
index 1360a1ff0ee..60d366100f8 100755
--- a/configure
+++ b/configure
@@ -625,7 +625,6 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
 valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
 valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
 valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
-valopt_nosave libc-dir "/usr/lib" "installation directory of the system libc"
 
 # Temporarily support old triples until buildbots get updated
 CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
@@ -1081,9 +1080,6 @@ program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name=
 CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}")
 putvar CFG_STDCPP_NAME
 
-#CFG_LIB_SEARCH_PATH=$($CFG_CC -print-search-dirs | sed -n "/libraries: =/  { s/.*=//; P }")
-#putvar CFG_LIB_SEARCH_PATH
-
 # a little post-processing of various config values
 CFG_PREFIX=${CFG_PREFIX%/}
 CFG_MANDIR=${CFG_MANDIR%/}
@@ -1284,16 +1280,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
             putvar CFG_DISABLE_JEMALLOC
             ;;
 
-        *-windows-gnu)
-            if [ -z "$CFG_LIBC_DIR_PROVIDED" ]; then
-                # Use gcc location to find mingw libc directory
-                for dir in $(dirname $CFG_GCC)/../*-mingw32/lib; do
-                    if [ -d "$dir" ]; then
-                        CFG_LIBC_DIR=$dir
-                    fi
-                done
-            fi
-            ;;
         *)
             ;;
     esac
@@ -1752,7 +1738,6 @@ putvar CFG_AARCH64_LINUX_ANDROID_NDK
 putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
 putvar CFG_I686_LINUX_ANDROID_NDK
 putvar CFG_MANDIR
-putvar CFG_LIBC_DIR
 
 # Avoid spurious warnings from clang by feeding it original source on
 # ccache-miss rather than preprocessed input.
diff --git a/mk/target.mk b/mk/target.mk
index fcb3d4a1e53..5caf8d8e81e 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -146,19 +146,10 @@ define TARGET_RT_STARTUP
 $$(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 $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core : $$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj)) \
-	$$(eval $$(call COPY_LIBC_STARTUP,$$(TLIB$(1)_T_$(2)_H_$(3)),$$(obj))) )
-endef
-
-# TARGET_RT_STARTUP's helper for copying LibC startup objects
-# $(1) - target lib directory
-# $(2) - object name
-define COPY_LIBC_STARTUP
+	$$(eval $$(call TARGET_LIBC_STARTUP_OBJ,$(1),$(2),$(3),$$(obj))) )
 
-$(1)/$(2) : $$(CFG_LIBC_DIR)/$(2)
-	@$$(call E, cp: $$@)
-	@cp $$^ $$@
 endef
 
 # Macro for building runtime startup/shutdown object files;
@@ -167,10 +158,10 @@ endef
 # $(1) - stage
 # $(2) - target triple
 # $(3) - host triple
-# $(4) - object name
+# $(4) - object basename
 define TARGET_RUSTRT_STARTUP_OBJ
 
-$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o:\
+$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \
 		$(S)src/rtstartup/$(4).rs \
 		$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \
 		$$(HSREQ$(1)_T_$(2)_H_$(3)) \
@@ -183,9 +174,31 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o:\
 # but before everything else (since they are needed for linking dylib crates).
 $$(foreach crate, $$(TARGET_CRATES), \
 	$$(if $$(findstring core,$$(DEPS_$$(crate))), \
-		$$(eval $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o) ))
+		$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o
+
 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