Skip to content

Initial MSVC support for the compiler #25350

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 31 commits into from
May 20, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
315750a
Very hacky MSVC hacks.
ricky26 Mar 4, 2015
4cc025d
Scale back changes made
alexcrichton May 8, 2015
2d5e577
rustc_trans: Abstract linker support behind a trait
alexcrichton May 8, 2015
40570eb
rustc_llvm: Expose setting more DLL storage classes
alexcrichton May 11, 2015
cb513c7
rt: Clean up to build with cl.exe
alexcrichton May 11, 2015
eb5bf15
mk: Remove generation of .d files
alexcrichton May 11, 2015
150663c
mk: Correct names of installed libs on windows
alexcrichton May 11, 2015
ee258c5
mk: Fix native LLVM deps for cross-host builds
alexcrichton May 11, 2015
7cf0b17
configure: Start adding MSVC support
alexcrichton May 11, 2015
b56d47c
mk: Enable building LLVM targeting MSVC
alexcrichton May 11, 2015
fcf7ecd
mk: Add build system support for cl.exe
alexcrichton May 11, 2015
ee64bab
mk: Don't add cross prefixes for MSVC
alexcrichton May 11, 2015
64412a4
mk: Fix building compiler-rt on MSVC
alexcrichton May 11, 2015
6122a5f
mk: Fix MSVC build for rustllvm.lib
alexcrichton May 11, 2015
a4ef308
mk: Add the ability to depend on native LLVM tools
alexcrichton May 11, 2015
f9846e9
rustc: Shorten MSVC metadata section name
alexcrichton May 11, 2015
839dcfd
rustc_back: Refactor Archive to better express intent
alexcrichton May 11, 2015
37659a1
rustc_back: Remove unneeded explicit variable
alexcrichton May 11, 2015
af56e2e
rustc_back: Tweak the MSVC target spec
alexcrichton May 11, 2015
d97b4af
mklldeps: Don't link stdc++/c++ on MSVC
alexcrichton May 11, 2015
e2854b3
libc: Add necessary libraries for MSVC
alexcrichton May 11, 2015
eb50ffd
rustc_trans: Clean up some style in back::link
alexcrichton May 11, 2015
181dbd7
rustc_trans: Add MSVC linker support
alexcrichton May 11, 2015
ce8b317
rustc_trans: Tidy up some style and line lengths
alexcrichton May 11, 2015
b538189
mk: Generate a .def file for rustc_llvm on MSVC
alexcrichton May 11, 2015
847c852
rustc_llvm: Don't export constants across dlls
alexcrichton May 12, 2015
f5222fb
std: Implement aborting stubs for MSVC unwinding
alexcrichton May 12, 2015
9a2415b
std: Mark rust_get_num_cpus as dllexport
alexcrichton May 12, 2015
3d32cf5
rustc_trans: Apply dllexport attributes for MSVC
alexcrichton May 12, 2015
74f4f39
std: Don't require rust_try as an exported symbol
alexcrichton May 12, 2015
cb3071b
mk: Update `make dist` for MSVC targets
alexcrichton May 13, 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
Prev Previous commit
Next Next commit
mk: Add the ability to depend on native LLVM tools
The compiler will require that `llvm-ar.exe` be available for MSVC-targeting
builds (more comments on this soon), so this commit adds support for targets to
depend on LLVM tools. The `core` library for MSVC depends on `llvm-ar.exe` which
will be copied into place for the target before the compiler starts to run.

Note that these targets all depend on `llvm-config.exe` to ensure that they're
built before they're attempted to be copied.
  • Loading branch information
alexcrichton committed May 19, 2015
commit a4ef308473f284a93d2d9f32763e09ba7424540b
6 changes: 6 additions & 0 deletions mk/cfg/x86_64-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ endif
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
2 changes: 2 additions & 0 deletions mk/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ else
clean-llvm$(1):
endif

$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))

# This is used to independently force an LLVM clean rebuild
# when we changed something not otherwise captured by builtin
# dependencies. In these cases, commit a change that touches
Expand Down
1 change: 1 addition & 0 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ endif
# Any rules that depend on LLVM should depend on LLVM_CONFIG
LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1))
LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
Expand Down
9 changes: 8 additions & 1 deletion mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ 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))
$$(RT_OUTPUT_DIR_$(2))/$$(dep)) \
$$(foreach dep,$$(NATIVE_TOOL_DEPS_$(4)_T_$(2)), \
$$(TBIN$(1)_T_$(3)_H_$(3))/$$(dep))
endef

$(foreach host,$(CFG_HOST), \
Expand Down Expand Up @@ -149,6 +151,11 @@ $$(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 Down