Skip to content

Commit

Permalink
rollup merge of rust-lang#27678: alexcrichton/snapshots
Browse files Browse the repository at this point in the history
* Lots of core prelude imports removed
* Makefile support for MSVC env vars and Rust crates removed
* Makefile support for morestack removed
  • Loading branch information
alexcrichton committed Aug 12, 2015
2 parents bbef889 + 938099a commit 837ae4f
Show file tree
Hide file tree
Showing 95 changed files with 25 additions and 483 deletions.
5 changes: 0 additions & 5 deletions mk/cfg/i686-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ CFG_LDPATH_i686-pc-windows-msvc :=
CFG_RUN_i686-pc-windows-msvc=$(2)
CFG_RUN_TARG_i686-pc-windows-msvc=$(call CFG_RUN_i686-pc-windows-msvc,,$(2))
CFG_GNU_TRIPLE_i686-pc-windows-msvc := i686-pc-win32

# All windows nightiles are currently a GNU triple, so this MSVC triple is not
# bootstrapping from itself. This is relevant during stage0, and other parts of
# the build system take this into account.
BOOTSTRAP_FROM_i686-pc-windows-msvc := i686-pc-windows-gnu
5 changes: 0 additions & 5 deletions mk/cfg/x86_64-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ CFG_LDPATH_x86_64-pc-windows-msvc :=
CFG_RUN_x86_64-pc-windows-msvc=$(2)
CFG_RUN_TARG_x86_64-pc-windows-msvc=$(call CFG_RUN_x86_64-pc-windows-msvc,,$(2))
CFG_GNU_TRIPLE_x86_64-pc-windows-msvc := x86_64-pc-win32

# All windows nightiles are currently a GNU triple, so this MSVC triple is not
# bootstrapping from itself. This is relevant during stage0, and other parts of
# the build system take this into account.
BOOTSTRAP_FROM_x86_64-pc-windows-msvc := x86_64-pc-windows-gnu
5 changes: 0 additions & 5 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,6 @@ TSREQ$(1)_T_$(2)_H_$(3) = \
$$(foreach obj,$$(INSTALLED_OBJECTS_$(2)),\
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(obj))

ifeq ($(1),0)
TSREQ$(1)_T_$(2)_H_$(3) += \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(call CFG_STATIC_LIB_NAME_$(2),morestack)
endif

# Prerequisites for a working stageN compiler and libraries, for a specific
# target
SREQ$(1)_T_$(2)_H_$(3) = \
Expand Down
61 changes: 0 additions & 61 deletions mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -237,64 +237,3 @@ endef

$(foreach target,$(CFG_TARGET), \
$(eval $(call CFG_MAKE_TOOLCHAIN,$(target))))

# There are more comments about this available in the target specification for
# Windows MSVC in the compiler, but the gist of it is that we use `llvm-ar.exe`
# instead of `lib.exe` for assembling archives, so we need to inject this custom
# dependency here.
#
# FIXME(stage0): remove this and all other relevant support in the makefiles
# after a snapshot is made
define ADD_LLVM_AR_TO_MSVC_DEPS
ifeq ($$(findstring msvc,$(1)),msvc)
NATIVE_TOOL_DEPS_core_T_$(1) += llvm-ar.exe
INSTALLED_BINS_$(1) += llvm-ar.exe
endif
endef

$(foreach target,$(CFG_TARGET), \
$(eval $(call ADD_LLVM_AR_TO_MSVC_DEPS,$(target))))

# When working with MSVC on windows, each DLL needs to explicitly declare its
# interface to the outside world through some means. The options for doing so
# include:
#
# 1. A custom attribute on each function itself
# 2. A linker argument saying what to export
# 3. A file which lists all symbols that need to be exported
#
# The Rust compiler takes care (1) for us for all Rust code by annotating all
# public-facing functions with dllexport, but we have a few native dependencies
# which need to cross the DLL boundary. The most important of these dependencies
# is LLVM which is linked into `rustc_llvm.dll` but primarily used from
# `rustc_trans.dll`. This means that many of LLVM's C API functions need to be
# exposed from `rustc_llvm.dll` to be forwarded over the boundary.
#
# Unfortunately, at this time, LLVM does not handle this sort of exportation on
# Windows for us, so we're forced to do it ourselves if we want it (which seems
# like the path of least resistance right now). To do this we generate a `.DEF`
# file [1] which we then custom-pass to the linker when building the rustc_llvm
# crate. This DEF file list all symbols that are exported from
# `src/librustc_llvm/lib.rs` and is generated by a small python script.
#
# Fun times!
#
# [1]: https://msdn.microsoft.com/en-us/library/28d6s79h.aspx
#
# FIXME(stage0): remove this macro and the usage below (and the commments above)
# when a new snapshot is available. Also remove the
# RUSTFLAGS$(1)_.._T_ variable in mk/target.mk along with
# CUSTOM_DEPS (as they were only added for this)
define ADD_RUSTC_LLVM_DEF_TO_MSVC
ifeq ($$(findstring msvc,$(1)),msvc)
RUSTFLAGS0_rustc_llvm_T_$(1) += -C link-args="-DEF:$(1)/rt/rustc_llvm.def"
CUSTOM_DEPS0_rustc_llvm_T_$(1) += $(1)/rt/rustc_llvm.def

$(1)/rt/rustc_llvm.def: $$(S)src/etc/mklldef.py $$(S)src/librustc_llvm/lib.rs
$$(CFG_PYTHON) $$^ $$@ rustc_llvm-$$(CFG_FILENAME_EXTRA)
endif
endef

$(foreach target,$(CFG_TARGET), \
$(eval $(call ADD_RUSTC_LLVM_DEF_TO_MSVC,$(target))))

4 changes: 1 addition & 3 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
# that's per-target so you're allowed to conditionally add files based on the
# target.
################################################################################
NATIVE_LIBS := rust_builtin hoedown miniz \
rust_test_helpers morestack
NATIVE_LIBS := rust_builtin hoedown miniz rust_test_helpers

# $(1) is the target triple
define NATIVE_LIBRARIES
Expand All @@ -54,7 +53,6 @@ NATIVE_DEPS_miniz_$(1) = miniz.c
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
rust_android_dummy.c
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
NATIVE_DEPS_morestack_$(1) := empty.c

################################################################################
# You shouldn't find it that necessary to edit anything below this line.
Expand Down
93 changes: 1 addition & 92 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
$$(foreach dep,$$(NATIVE_DEPS_$(4)), \
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
$$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
$$(RT_OUTPUT_DIR_$(2))/$$(dep)) \
$$(foreach dep,$$(NATIVE_TOOL_DEPS_$(4)_T_$(2)), \
$$(TBIN$(1)_T_$(3)_H_$(3))/$$(dep)) \
$$(CUSTOM_DEPS$(1)_$(4)_T_$(2))
$$(RT_OUTPUT_DIR_$(2))/$$(dep))
endef

$(foreach host,$(CFG_HOST), \
Expand Down Expand Up @@ -142,21 +139,13 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))

define TARGET_HOST_RULES

$$(TBIN$(1)_T_$(2)_H_$(3))/:
mkdir -p $$@

$$(TLIB$(1)_T_$(2)_H_$(3))/:
mkdir -p $$@

$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@

$$(TBIN$(1)_T_$(2)_H_$(3))/%: $$(CFG_LLVM_INST_DIR_$(2))/bin/% \
| $$(TBIN$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endef

$(foreach source,$(CFG_HOST), \
Expand All @@ -180,83 +169,3 @@ $(foreach host,$(CFG_HOST), \
$(foreach stage,$(STAGES), \
$(foreach tool,$(TOOLS), \
$(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))

# We have some triples which are bootstrapped from other triples, and this means
# that we need to fixup some of the native tools that a triple depends on.
#
# For example, MSVC requires the llvm-ar.exe executable to manage archives, but
# it bootstraps from the GNU Windows triple. This means that the compiler will
# add this directory to PATH when executing new processes:
#
# $SYSROOT/rustlib/x86_64-pc-windows-gnu/bin
#
# Unfortunately, however, the GNU triple is not known about in stage0, so the
# tools are actually located in:
#
# $SYSROOT/rustlib/x86_64-pc-windows-msvc/bin
#
# To remedy this problem, the rules below copy all native tool dependencies into
# the bootstrap triple's location in stage 0 so the bootstrap compiler can find
# the right sets of tools. Later stages (1+) will have the right host triple for
# the compiler, so there's no need to worry there.
#
# $(1) - stage
# $(2) - triple that's being used as host/target
# $(3) - triple snapshot is built for
# $(4) - crate
# $(5) - tool
#
# FIXME(stage0): remove this and all other relevant support in the makefiles
# after a snapshot is made
define MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR
ifneq (,$(3))
$$(TLIB$(1)_T_$(2)_H_$(2))/stamp.$(4): $$(HLIB$(1)_H_$(2))/rustlib/$(3)/bin/$(5)

$$(HLIB$(1)_H_$(2))/rustlib/$(3)/bin/$(5): $$(TBIN$(1)_T_$(2)_H_$(2))/$(5)
mkdir -p $$(@D)
cp $$< $$@
endif
endef

$(foreach target,$(CFG_TARGET), \
$(foreach crate,$(CRATES), \
$(foreach tool,$(NATIVE_TOOL_DEPS_$(crate)_T_$(target)), \
$(eval $(call MOVE_TOOLS_TO_SNAPSHOT_HOST_DIR,0,$(target),$(BOOTSTRAP_FROM_$(target)),$(crate),$(tool))))))

# For MSVC targets we need to set up some environment variables for the linker
# to work correctly when building Rust crates. These two variables are:
#
# - LIB tells the linker the default search path for finding system libraries,
# for example kernel32.dll
# - PATH needs to be modified to ensure that MSVC's link.exe is first in the
# path instead of MinGW's /usr/bin/link.exe (entirely unrelated)
#
# The values for these variables are detected by the configure script.
#
# FIXME(stage0): remove this and all other relevant support in the makefiles
# after a snapshot is made
define SETUP_LIB_MSVC_ENV_VARS
ifeq ($$(findstring msvc,$(2)),msvc)
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
endif
endef
define SETUP_TOOL_MSVC_ENV_VARS
ifeq ($$(findstring msvc,$(2)),msvc)
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(2)))
$$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
export PATH := $$(CFG_MSVC_BINDIR_$$(HOST_$(2))):$$(PATH)
endif
endef

$(foreach host,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(foreach crate,$(CRATES), \
$(eval $(call SETUP_LIB_MSVC_ENV_VARS,0,$(target),$(host),$(crate))))))
$(foreach host,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(foreach tool,$(TOOLS), \
$(eval $(call SETUP_TOOL_MSVC_ENV_VARS,0,$(target),$(host),$(tool))))))
3 changes: 0 additions & 3 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@

use boxed::Box;

#[cfg(stage0)]
use core::prelude::v1::*;

use core::atomic;
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
use core::fmt;
Expand Down
3 changes: 0 additions & 3 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

use heap;
use raw_vec::RawVec;

Expand Down
3 changes: 0 additions & 3 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
#![feature(unsize)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![cfg_attr(stage0, feature(core, core_prelude))]

#![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
Expand All @@ -101,8 +100,6 @@
#[cfg(all(not(feature = "external_funcs"), not(feature = "external_crate")))]
extern crate libc;

#[cfg(stage0)] #[macro_use] extern crate core;

// Allow testing this library

#[cfg(test)] #[macro_use] extern crate std;
Expand Down
3 changes: 0 additions & 3 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

#[cfg(not(test))]
use boxed::Box;
#[cfg(test)]
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@
#![allow(missing_docs)]
#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

use core::iter::{FromIterator};
use core::mem::swap;
use core::ptr;
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/bit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
//! println!("There are {} primes below {}", num_primes, max_prime);
//! ```

#[cfg(stage0)]
use core::prelude::v1::*;

use core::cmp::Ordering;
use core::cmp;
use core::fmt;
Expand Down
5 changes: 0 additions & 5 deletions src/libcollections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

use self::Entry::*;

#[cfg(stage0)]
use core::prelude::v1::*;

use core::cmp::Ordering;
use core::fmt::Debug;
use core::hash::{Hash, Hasher};
Expand Down Expand Up @@ -531,8 +528,6 @@ enum Continuation<A, B> {
/// to nodes. By using this module much better safety guarantees can be made, and more search
/// boilerplate gets cut out.
mod stack {
#[cfg(stage0)]
use core::prelude::v1::*;
use core::marker;
use core::mem;
use core::ops::{Deref, DerefMut};
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ pub use self::SearchResult::*;
pub use self::ForceResult::*;
pub use self::TraversalItem::*;

#[cfg(stage0)]
use core::prelude::v1::*;

use core::cmp::Ordering::{Greater, Less, Equal};
use core::intrinsics::arith_offset;
use core::iter::Zip;
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
// This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface
// to TreeMap

#[cfg(stage0)]
use core::prelude::v1::*;

use core::cmp::Ordering::{self, Less, Greater, Equal};
use core::fmt::Debug;
use core::fmt;
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
reason = "matches collection reform specification, \
waiting for dust to settle")]

#[cfg(stage0)]
use core::prelude::v1::*;

use core::marker;
use core::fmt;
use core::iter::{FromIterator};
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@
#![feature(utf8_error)]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(not(test), feature(str_words))]
#![cfg_attr(stage0, feature(core, core_prelude))]

#![feature(no_std)]
#![no_std]

#[cfg(stage0)] #[macro_use] extern crate core;

extern crate rustc_unicode;
extern crate alloc;

Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

use alloc::boxed::Box;
use core::cmp::Ordering;
use core::fmt;
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

use core::fmt;
use core::hash;
use core::iter::FromIterator;
Expand Down
3 changes: 0 additions & 3 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@

#![stable(feature = "rust1", since = "1.0.0")]

#[cfg(stage0)]
use core::prelude::v1::*;

use alloc::raw_vec::RawVec;
use alloc::boxed::Box;
use alloc::heap::EMPTY;
Expand Down
Loading

0 comments on commit 837ae4f

Please sign in to comment.