Skip to content

Rollup of 3 pull requests #26649

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 57 commits into from
Jun 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1ec520a
mk: Move logic out of MSVC's 64-bit cfg makefile
alexcrichton Jun 19, 2015
91d799e
msvc: Implement runtime support for unwinding
alexcrichton Jun 19, 2015
9e3cb64
rustc_trans: Handle empty dlls on MSVC
alexcrichton Jun 25, 2015
759a7f1
test: Use liblibc in lang-item-public
alexcrichton Jun 25, 2015
3f178b8
Fix links in release notes.
brson Jun 25, 2015
74fbe3e
Correct typos and remove unused references from RELEASES.md
barosl Jun 25, 2015
8e3ea5d
Ignore KDevelop 4 (and 5 pre-release) project files
CruzBishop Jun 25, 2015
fd9b2ca
Correct a missing reference in the release note.
omasanori Jun 26, 2015
aa03871
rustc: combine type-flag-checking traits and fns and into one trait.
eddyb Jun 23, 2015
59935f7
rustc: move some functions in middle::ty working on Ty to methods.
eddyb Jun 24, 2015
2332765
rustc: prefer unqualified `ctxt` to `ty::ctxt` in middle::ty.
eddyb Jun 24, 2015
6db5126
rustc: make ty::mk_* constructors into methods on ty::ctxt.
eddyb Jun 25, 2015
5cedd66
rustc: remove 3 dead functions in middle::ty.
eddyb Jun 25, 2015
ad66c21
rustc: switch most remaining middle::ty functions to methods.
eddyb Jun 25, 2015
2051b3e
Avoid storing fat pointers as first class aggregates
dotdash Jun 26, 2015
2cb8a31
Auto merge of #26595 - dotdash:fca_slice, r=eddyb
bors Jun 26, 2015
30cde07
std: clean up duplicated attrs and comment on panic
richo Jun 26, 2015
c98e46c
accessing private fields is not safe, and io isn't scary
Gankra Jun 26, 2015
9001da6
make book match reference
Gankra Jun 26, 2015
1032384
Auto merge of #26568 - barosl:rel-notes-refs, r=alexcrichton
bors Jun 26, 2015
532235b
Use Box::into_raw rather than the deprecated boxed::into_raw in tests…
Ms2ger Jun 26, 2015
0f6d4aa
core: fix deprecation since version of align_of_min.
huonw Jun 26, 2015
cb7d062
Auto merge of #26605 - Ms2ger:raw-doc, r=alexcrichton
bors Jun 26, 2015
1aabbd0
Initial documentation for 1.2.0, uploading to test markdown
CruzBishop Jun 26, 2015
773052a
Auto merge of #26574 - brson:relnotes-fix, r=alexcrichton
bors Jun 27, 2015
d3c03d0
Auto merge of #26569 - alexcrichton:msvc-llvm-update, r=brson
bors Jun 27, 2015
650566e
Auto merge of #26575 - eddyb:tycx, r=nikomatsakis
bors Jun 27, 2015
ec232c8
Rollup merge of #26565 - Techern:ignore-kdevelop, r=brson
Manishearth Jun 27, 2015
1ce9b59
Rollup merge of #26584 - omasanori:fix-26537, r=alexcrichton
Manishearth Jun 27, 2015
0bf0ea3
Rollup merge of #26596 - richo:richo-cleanup-macros, r=alexcrichton
Manishearth Jun 27, 2015
6dd33b4
Rollup merge of #26603 - Gankro:ref, r=steveklabnik
Manishearth Jun 27, 2015
04daae7
Auto merge of #26579 - Techern:start-12-doc, r=brson
bors Jun 27, 2015
b36ae01
Auto merge of #26609 - huonw:align, r=alexcrichton
bors Jun 27, 2015
ca0601a
std: someone missed removing this doc and the annotations
tshepang Jun 27, 2015
2ba46f8
Auto merge of #26616 - Manishearth:rollup, r=Manishearth
bors Jun 27, 2015
8fa2185
Auto merge of #26621 - tshepang:missed-removal, r=steveklabnik
bors Jun 27, 2015
ae36d4f
mk: Add support for i686-pc-windows-msvc
alexcrichton Jun 25, 2015
5de665e
rustc_back: Learn about i686-pc-windows-msvc
alexcrichton Jun 25, 2015
8790958
std: Avoid missing fns on i686-pc-windows-msvc
alexcrichton Jun 25, 2015
79d0289
Begin refactor type checking state
jroesch Jun 24, 2015
480cd8f
Ground work for replacing the ClosureTyper trait
jroesch Jun 25, 2015
e5b3684
Remove ClosureTyper impl for FnCtxt
jroesch Jun 26, 2015
ba7b47e
rustc_driver: Fix incorrect comment
richo Jun 26, 2015
9e58fb8
rt: Update comment for new location of unwind
richo Jun 26, 2015
10b103a
std: Fix Windows XP compatibility
alexcrichton Jun 26, 2015
15bc4a3
Address nits
jroesch Jun 26, 2015
5da0d41
Auto merge of #26601 - alexcrichton:xp, r=brson
bors Jun 28, 2015
c1b8bd2
Auto merge of #26631 - richo:comment-updates, r=steveklabnik
bors Jun 28, 2015
5c3753f
Fix librustc_driver/test.rs
jroesch Jun 28, 2015
78ec055
Add `.write(true)` to append and truncate examples
remram44 Jun 28, 2015
2671e8c
Auto merge of #26642 - remram44:doc-openoptions-missing-write, r=alex…
bors Jun 28, 2015
a973e4c
Auto merge of #26582 - jroesch:infer-ctxt-refactor, r=nikomatsakis
bors Jun 29, 2015
9b6fe6c
Add tip to do partial compile.
pelmers Jun 29, 2015
f07b11d
mk: Fix a typo in the tips
richo Jun 29, 2015
4adcc78
Rollup merge of #26593 - GuillaumeGomez:patch-2, r=Manishearth
Manishearth Jun 29, 2015
1659075
Rollup merge of #26644 - pelmers:make_stage_tip, r=sfackler
Manishearth Jun 29, 2015
08a8ee1
Rollup merge of #26645 - richo:makefile-typo, r=sfackler
Manishearth Jun 29, 2015
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*.exe
*.fn
*.html
*.kdev4
*.ky
*.ll
*.llvm
Expand Down
3 changes: 2 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
# * tidy-basic - show file / line stats
# * tidy-errors - show the highest rustc error code
# * tidy-features - show the status of language and lib features
# * rustc-stage$(stage) - Only build up to a specific stage
#
# Then mix in some of these environment variables to harness the
# ultimate power of The Rust Build System.
Expand Down Expand Up @@ -90,7 +91,7 @@
#
# # Rust recipes for build system success
#
# // Modifying libstd? Use this comment to run unit tests just on your change
# // Modifying libstd? Use this command to run unit tests just on your change
# make check-stage1-std NO_REBUILD=1 NO_BENCH=1
#
# // Added a run-pass test? Use this to test running your test
Expand Down
28 changes: 19 additions & 9 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 1.2.0 (August 2015)
===========================

Highlights
----------

* [Parallel codegen][parcodegen] is now working again, which can substantially
speed up large builds in debug mode; It also gets another ~33% speedup when
bootstrapping on a 4 core machine (using 8 jobs). It's not enabled by default,
but will be "in the near future"


[parcodegen]: https://github.com/rust-lang/rust/pull/26018


Version 1.1.0 (June 2015)
=========================

Expand All @@ -6,7 +21,7 @@ Version 1.1.0 (June 2015)
Highlights
----------

* The [`std::fs` module has been expanded][fs-expand] to expand the set of
* The [`std::fs` module has been expanded][fs] to expand the set of
functionality exposed:
* `DirEntry` now supports optimizations like `file_type` and `metadata` which
don't incur a syscall on some platforms.
Expand All @@ -23,11 +38,11 @@ Highlights
Libraries
---------

* The `str::split_whitespace` method splits a string on unicode
* The [`str::split_whitespace`] method splits a string on unicode
whitespace boundaries.
* On both Windows and Unix, new extension traits provide conversion of
I/O types to and from the underlying system handles. On Unix, these
traits are [`FrowRawFd`] and [`AsRawFd`], on Windows `FromRawHandle`
traits are [`FromRawFd`] and [`AsRawFd`], on Windows `FromRawHandle`
and `AsRawHandle`. These are implemented for `File`, `TcpStream`,
`TcpListener`, and `UpdSocket`. Further implementations for
`std::process` will be stabilized later.
Expand Down Expand Up @@ -79,8 +94,7 @@ Misc
* [The `drop_with_repr_extern` lint warns about mixing `repr(C)`
with `Drop`][drop].

[`split_whitespace`]: http://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_whitespace
[`Iterator::cloned`]: http://doc.rust-lang.org/nightly/core/iter/trait.Iterator.html#method.cloned
[`str::split_whitespace`]: http://doc.rust-lang.org/nightly/std/primitive.str.html#method.split_whitespace
[`FromRawFd`]: http://doc.rust-lang.org/nightly/std/os/unix/io/trait.FromRawFd.html
[`AsRawFd`]: http://doc.rust-lang.org/nightly/std/os/unix/io/trait.AsRawFd.html
[`std::os::unix::symlink`]: http://doc.rust-lang.org/nightly/std/os/unix/fs/fn.symlink.html
Expand Down Expand Up @@ -250,7 +264,6 @@ Misc
[sw]: https://github.com/rust-lang/rfcs/blob/master/text/1054-str-words.md
[th]: https://github.com/rust-lang/rfcs/blob/master/text/0909-move-thread-local-to-std-thread.md
[send-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0458-send-improvements.md
[scoped]: http://static.rust-lang.org/doc/master/std/thread/fn.scoped.html
[moar-ufcs]: https://github.com/rust-lang/rust/pull/22172
[prim-inherent]: https://github.com/rust-lang/rust/pull/23104
[overflow]: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md
Expand All @@ -260,12 +273,10 @@ Misc
[string-pattern]: https://github.com/rust-lang/rust/pull/22466
[oibit-final]: https://github.com/rust-lang/rust/pull/21689
[reflect]: https://github.com/rust-lang/rust/pull/23712
[debug-builder]: https://github.com/rust-lang/rfcs/blob/master/text/0640-debug-improvements.md
[conversion]: https://github.com/rust-lang/rfcs/pull/529
[num-traits]: https://github.com/rust-lang/rust/pull/23549
[index-value]: https://github.com/rust-lang/rust/pull/23601
[dropck]: https://github.com/rust-lang/rfcs/pull/769
[fundamental]: https://github.com/rust-lang/rfcs/pull/1023
[ci-compare]: https://gist.github.com/brson/a30a77836fbec057cbee
[fn-inherit]: https://github.com/rust-lang/rust/pull/23282
[fn-blanket]: https://github.com/rust-lang/rust/pull/23895
Expand Down Expand Up @@ -368,7 +379,6 @@ Version 1.0.0-alpha.2 (February 2015)
[osstr]: https://github.com/rust-lang/rust/pull/21488
[osstr-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0517-io-os-reform.md
[Self]: https://github.com/rust-lang/rust/pull/22158
[ufcs]: https://github.com/rust-lang/rust/pull/21077
[ufcs-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0132-ufcs.md
[un]: https://github.com/rust-lang/rust/pull/22256

Expand Down
60 changes: 47 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ do
fi
;;

x86_64-*-msvc)
*-msvc)
# Currently the build system is not configured to build jemalloc
# with MSVC, so we omit this optional dependency.
step_msg "targeting MSVC, disabling jemalloc"
Expand Down Expand Up @@ -1154,22 +1154,45 @@ do
CFG_MSVC_ROOT=$(echo "$install" | grep InstallDir | sed 's/.*REG_SZ[ ]*//')
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
CFG_MSVC_ROOT=$(dirname "$CFG_MSVC_ROOT")
CFG_MSVC_CL="${CFG_MSVC_ROOT}/VC/bin/amd64/cl.exe"
CFG_MSVC_LIB="${CFG_MSVC_ROOT}/VC/bin/amd64/lib.exe"
CFG_MSVC_LINK="${CFG_MSVC_ROOT}/VC/bin/amd64/link.exe"
putvar CFG_MSVC_ROOT

case $i in
x86_64-*)
bits=x86_64
msvc_part=amd64
;;
i686-*)
bits=i386
msvc_part=
;;
*)
err "can only target x86 targets for MSVC"
;;
esac
bindir="${CFG_MSVC_ROOT}/VC/bin"
if [ ! -z "$msvc_part" ]; then
bindir="$bindir/$msvc_part"
fi
eval CFG_MSVC_BINDIR_$bits="\"$bindir\""
eval CFG_MSVC_CL_$bits="\"$bindir/cl.exe\""
eval CFG_MSVC_LIB_$bits="\"$bindir/lib.exe\""
eval CFG_MSVC_LINK_$bits="\"$bindir/link.exe\""

vcvarsall="${CFG_MSVC_ROOT}/VC/vcvarsall.bat"
CFG_MSVC_INCLUDE_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %INCLUDE%")
include_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %INCLUDE%")
need_ok "failed to learn about MSVC's INCLUDE"
CFG_MSVC_LIB_PATH=$(cmd /c "\"$vcvarsall\" amd64 && cmd /c echo %LIB%")
lib_path=$(cmd /c "\"$vcvarsall\" $msvc_part && cmd /c echo %LIB%")
need_ok "failed to learn about MSVC's LIB"

putvar CFG_MSVC_ROOT
putvar CFG_MSVC_CL
putvar CFG_MSVC_LIB
putvar CFG_MSVC_LINK
putvar CFG_MSVC_INCLUDE_PATH
putvar CFG_MSVC_LIB_PATH
eval CFG_MSVC_INCLUDE_PATH_${bits}="\"$include_path\""
eval CFG_MSVC_LIB_PATH_${bits}="\"$lib_path\""

putvar CFG_MSVC_BINDIR_${bits}
putvar CFG_MSVC_CL_${bits}
putvar CFG_MSVC_LIB_${bits}
putvar CFG_MSVC_LINK_${bits}
putvar CFG_MSVC_INCLUDE_PATH_${bits}
putvar CFG_MSVC_LIB_PATH_${bits}
;;

*)
Expand Down Expand Up @@ -1408,8 +1431,19 @@ do

msg "configuring LLVM with:"
msg "$CMAKE_ARGS"
case "$t" in
x86_64-*)
generator="Visual Studio 12 2013 Win64"
;;
i686-*)
generator="Visual Studio 12 2013"
;;
*)
err "can only build LLVM for x86 platforms"
;;
esac
(cd $LLVM_BUILD_DIR && "$CFG_CMAKE" $CFG_LLVM_SRC_DIR \
-G "Visual Studio 12 2013 Win64" \
-G "$generator" \
$CMAKE_ARGS)
need_ok "LLVM cmake configure failed"
fi
Expand Down
29 changes: 29 additions & 0 deletions mk/cfg/i686-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# i686-pc-windows-msvc configuration
CC_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
LINK_i686-pc-windows-msvc="$(CFG_MSVC_LINK_i386)" -nologo
CXX_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
CPP_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
AR_i686-pc-windows-msvc="$(CFG_MSVC_LIB_i386)" -nologo
CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll
CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib
CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib}
CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc :=
CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD
CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD
CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc :=
CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc :=
CFG_LLC_FLAGS_i686-pc-windows-msvc :=
CFG_INSTALL_NAME_i686-pc-windows-msvc =
CFG_EXE_SUFFIX_i686-pc-windows-msvc := .exe
CFG_WINDOWSY_i686-pc-windows-msvc := 1
CFG_UNIXY_i686-pc-windows-msvc :=
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
68 changes: 5 additions & 63 deletions mk/cfg/x86_64-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# x86_64-pc-windows-msvc configuration
CC_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
LINK_x86_64-pc-windows-msvc="$(CFG_MSVC_LINK)" -nologo
CXX_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
CPP_x86_64-pc-windows-msvc="$(CFG_MSVC_CL)" -nologo
AR_x86_64-pc-windows-msvc="$(CFG_MSVC_LIB)" -nologo
CC_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
LINK_x86_64-pc-windows-msvc="$(CFG_MSVC_LINK_x86_64)" -nologo
CXX_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
CPP_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
AR_x86_64-pc-windows-msvc="$(CFG_MSVC_LIB_x86_64)" -nologo
CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll
CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib}
Expand All @@ -23,64 +23,6 @@ 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

# These two environment variables are scraped by the `./configure` script and
# are necessary for `cl.exe` to find standard headers (the INCLUDE variable) and
# for `link.exe` to find standard libraries (the LIB variable).
ifdef CFG_MSVC_INCLUDE_PATH
export INCLUDE := $(CFG_MSVC_INCLUDE_PATH)
endif
ifdef CFG_MSVC_LIB_PATH
export LIB := $(CFG_MSVC_LIB_PATH)
endif

# Unfortunately `link.exe` is also a program in `/usr/bin` on MinGW installs,
# but it's not the one that we want. As a result we make sure that our detected
# `link.exe` shows up in PATH first.
ifdef CFG_MSVC_LINK
export PATH := $(CFG_MSVC_ROOT)/VC/bin/amd64:$(PATH)
endif

# 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.
NATIVE_TOOL_DEPS_core_T_x86_64-pc-windows-msvc += llvm-ar.exe
INSTALLED_BINS_x86_64-pc-windows-msvc += llvm-ar.exe

# 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
RUSTFLAGS_rustc_llvm_T_x86_64-pc-windows-msvc += \
-C link-args="-DEF:x86_64-pc-windows-msvc/rt/rustc_llvm.def"
CUSTOM_DEPS_rustc_llvm_T_x86_64-pc-windows-msvc += \
x86_64-pc-windows-msvc/rt/rustc_llvm.def

x86_64-pc-windows-msvc/rt/rustc_llvm.def: $(S)src/etc/mklldef.py \
$(S)src/librustc_llvm/lib.rs
$(CFG_PYTHON) $^ $@ rustc_llvm-$(CFG_FILENAME_EXTRA)

# 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.
Expand Down
53 changes: 53 additions & 0 deletions mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,56 @@ 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.
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
define ADD_RUSTC_LLVM_DEF_TO_MSVC
ifeq ($$(findstring msvc,$(1)),msvc)
RUSTFLAGS_rustc_llvm_T_$(1) += -C link-args="-DEF:$(1)/rt/rustc_llvm.def"
CUSTOM_DEPS_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))))

Loading