Skip to content

Commit 820271d

Browse files
committed
auto merge of #10809 : alexcrichton/rust/static-snapshot, r=alexcrichton
Now that we have the necessary logic in rustc for windows, this is possible to land.
2 parents aa4455e + e91ffb0 commit 820271d

File tree

18 files changed

+124
-66
lines changed

18 files changed

+124
-66
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,4 @@ src/etc/dl
9090
.settings/
9191
build/
9292
i686-pc-mingw32/
93+
src/librustc/lib/llvmdeps.rs

Makefile.in

+8-5
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,13 @@ endif
134134
# static copies of libstd and libextra. We also generate dynamic versions of all
135135
# libraries, so in the interest of space, prefer dynamic linking throughout the
136136
# compilation process.
137+
#
138+
# Note though that these flags are omitted for stage2+. This means that the
139+
# snapshot will be generated with a statically linked rustc so we only have to
140+
# worry about the distribution of one file (with its native dynamic
141+
# dependencies)
137142
RUSTFLAGS_STAGE0 += -Z prefer-dynamic
138143
RUSTFLAGS_STAGE1 += -Z prefer-dynamic
139-
RUSTFLAGS_STAGE2 += -Z prefer-dynamic
140-
RUSTFLAGS_STAGE3 += -Z prefer-dynamic
141144

142145
# platform-specific auto-configuration
143146
include $(CFG_SRC_DIR)mk/platform.mk
@@ -224,7 +227,7 @@ GENERATED :=
224227
define DEF_LIBS
225228

226229
CFG_RUNTIME_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustrt)
227-
CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm)
230+
CFG_RUSTLLVM_$(1) :=$(call CFG_STATIC_LIB_NAME_$(1),rustllvm)
228231
CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
229232
CFG_EXTRALIB_$(1) :=$(call CFG_LIB_NAME_$(1),extra)
230233
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
@@ -251,6 +254,8 @@ LIBRUSTUV_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustuv)
251254
EXTRALIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,extra)
252255
STDLIB_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,std)
253256
LIBRUSTUV_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustuv)
257+
LIBSYNTAX_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,syntax)
258+
LIBRUSTC_RGLOB_$(1) :=$(call CFG_RLIB_GLOB,rustc)
254259

255260
endef
256261

@@ -428,8 +433,6 @@ TLIBRUSTUV_DEFAULT$(1)_T_$(2)_H_$(3) = \
428433
# Preqrequisites for using the stageN compiler
429434
HSREQ$(1)_H_$(3) = \
430435
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
431-
$$(HLIB$(1)_H_$(3))/$(CFG_RUNTIME_$(3)) \
432-
$$(HLIB$(1)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
433436
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
434437
$$(HEXTRALIB_DEFAULT$(1)_H_$(3)) \
435438
$$(HLIBSYNTAX_DEFAULT$(1)_H_$(3)) \

mk/clean.mk

+2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ clean$(1)_T_$(2)_H_$(3):
132132
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_GLOB_$(2))
133133
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTUV_RGLOB_$(2))
134134
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_GLOB_$(2))
135+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTC_RGLOB_$(2))
135136
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_GLOB_$(2))
137+
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBSYNTAX_RGLOB_$(2))
136138
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
137139
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
138140
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(2))

mk/host.mk

+2-10
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,20 @@ define CP_HOST_STAGE_N
2626
$$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
2727
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4)) \
2828
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
29-
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
3029
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
3130
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
3231
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
3332
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
33+
$$(HLIBRUSTC_DEFAULT$(2)_H_$(4)) \
34+
$$(HLIBSYNTAX_DEFAULT$(2)_H_$(4)) \
3435
| $$(HBIN$(2)_H_$(4))/
35-
3636
@$$(call E, cp: $$@)
3737
$$(Q)cp $$< $$@
3838

3939
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
4040
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
4141
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)) \
4242
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
43-
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
4443
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
4544
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
4645
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -57,7 +56,6 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
5756
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
5857
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \
5958
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
60-
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
6159
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
6260
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \
6361
$$(HLIBRUSTUV_DEFAULT$(2)_H_$(4)) \
@@ -130,12 +128,6 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTUV_$(4)): \
130128
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(4)),$$(notdir $$@))
131129
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(4)),$$(notdir $$@))
132130

133-
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
134-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
135-
| $$(HLIB$(2)_H_$(4))/
136-
@$$(call E, cp: $$@)
137-
$$(Q)cp $$< $$@
138-
139131
$$(HBIN$(2)_H_$(4))/:
140132
mkdir -p $$@
141133

mk/install.mk

-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
103103
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
104104
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
105105
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
106-
$$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1)))
107106
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
108107
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
109108
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
@@ -154,7 +153,6 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
154153
$(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD)))
155154
$(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD)))
156155
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
157-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
158156
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1)
159157
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1)
160158
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustpkg.1)
@@ -169,7 +167,6 @@ uninstall:
169167
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD))
170168
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD))
171169
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD))
172-
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD))
173170
$(Q)for i in \
174171
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \
175172
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \

mk/llvm.mk

+10
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,15 @@ $$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
4444

4545
endef
4646

47+
$(foreach host,$(CFG_HOST), \
48+
$(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
49+
50+
$(S)src/librustc/lib/llvmdeps.rs: \
51+
$(LLVM_CONFIGS) \
52+
$(S)src/etc/mklldeps.py
53+
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
54+
"$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
55+
> $@
56+
4757
$(foreach host,$(CFG_HOST), \
4858
$(eval $(call DEF_LLVM_RULES,$(host))))

mk/rustllvm.mk

+2-6
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
3232
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
3333
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
3434

35-
$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
36-
$$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
35+
$(1)/rustllvm/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1))
3736
@$$(call E, link: $$@)
38-
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
39-
$$(CFG_GCCISH_PRE_LIB_FLAGS_$(1)) $$(LLVM_LIBS_$(1)) \
40-
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
41-
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
37+
$$(Q)$$(AR_$(1)) rcs $$@ $$(RUSTLLVM_OBJS_OBJS_$(1))
4238

4339
$(1)/rustllvm/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
4440
@$$(call E, compile: $$@)

mk/stage0.mk

+2-11
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ endif
2727

2828
# Host libs will be extracted by the above rule
2929

30-
$(HLIB0_H_$(CFG_BUILD))/$(CFG_RUNTIME_$(CFG_BUILD)): \
31-
$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
32-
| $(HLIB0_H_$(CFG_BUILD))/
33-
$(Q)touch $@
34-
30+
# NOTE: remove all these after the next snapshot
3531
$(HLIB0_H_$(CFG_BUILD))/$(CFG_STDLIB_$(CFG_BUILD)): \
3632
$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD)) \
3733
| $(HLIB0_H_$(CFG_BUILD))/
@@ -76,12 +72,7 @@ $$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
7672
@$$(call E, cp: $$@)
7773
$$(Q)cp $$< $$@
7874

79-
$$(HLIB0_H_$(1))/$(CFG_RUNTIME_$(1)): \
80-
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_RUNTIME_$(1)) \
81-
| $(HLIB0_H_$(1))/
82-
@$$(call E, cp: $$@)
83-
$$(Q)cp $$< $$@
84-
75+
# NOTE: removing everything below after the next snapshot
8576
$$(HLIB0_H_$(1))/$(CFG_STDLIB_$(1)): \
8677
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CFG_STDLIB_$(1)) \
8778
| $(HLIB0_H_$(1))/

mk/target.mk

+8-1
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
103103
| $$(TLIB$(1)_T_$(2)_H_$(3))/
104104
@$$(call E, compile_and_link: $$@)
105105
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
106+
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
106107
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
107108
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
109+
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
108110

109111
# Only build the compiler for host triples
110112
ifneq ($$(findstring $(2),$$(CFG_HOST)),)
@@ -119,14 +121,19 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
119121
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER = $(2)
120122
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
121123
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
124+
$(S)src/librustc/lib/llvmdeps.rs \
122125
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
123126
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
124127
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
125128
| $$(TLIB$(1)_T_$(2)_H_$(3))/
126129
@$$(call E, compile_and_link: $$@)
127130
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
128-
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
131+
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
132+
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
133+
-L "$$(LLVM_LIBDIR_$(3))" \
134+
--out-dir $$(@D) $$< && touch $$@
129135
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
136+
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
130137

131138
# NOTE: after the next snapshot remove these '-L' flags
132139
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \

mk/tests.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ $(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): \
376376
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
377377
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
378378
@$$(call E, compile_and_link: $$@)
379-
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
379+
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
380+
-L "$$(LLVM_LIBDIR_$(3))"
380381

381382
$(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
382383
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \

src/etc/mklldeps.py

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# xfail-license
2+
3+
import os
4+
import sys
5+
import subprocess
6+
7+
components = sys.argv[1].split(' ')
8+
9+
print """// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
10+
// file at the top-level directory of this distribution and at
11+
// http://rust-lang.org/COPYRIGHT.
12+
//
13+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
14+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
15+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
16+
// option. This file may not be copied, modified, or distributed
17+
// except according to those terms.
18+
19+
// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
20+
// take a look at src/etc/mklldeps.py if you're interested
21+
"""
22+
23+
for llconfig in sys.argv[2:]:
24+
print
25+
26+
proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
27+
out, err = proc.communicate()
28+
arch, os = out.split('-', 1)
29+
arch = 'x86' if arch == 'i686' or arch == 'i386' else arch
30+
if 'darwin' in os:
31+
os = 'macos'
32+
elif 'linux' in os:
33+
os = 'linux'
34+
elif 'freebsd' in os:
35+
os = 'freebsd'
36+
elif 'android' in os:
37+
os = 'android'
38+
elif 'win' in os or 'mingw' in os:
39+
os = 'win32'
40+
cfg = [
41+
"target_arch = \"" + arch + "\"",
42+
"target_os = \"" + os + "\"",
43+
]
44+
45+
print "#[cfg(" + ', '.join(cfg) + ")]"
46+
47+
args = [llconfig, '--libs']
48+
args.extend(components)
49+
proc = subprocess.Popen(args, stdout = subprocess.PIPE)
50+
out, err = proc.communicate()
51+
52+
for lib in out.strip().split(' '):
53+
lib = lib[2:] # chop of the leading '-l'
54+
print "#[link(name = \"" + lib + "\", kind = \"static\")]"
55+
if os == 'win32':
56+
print "#[link(name = \"pthread\")]"
57+
print "#[link(name = \"imagehlp\")]"
58+
print "extern {}"

src/etc/snapshot.py

+4-28
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,10 @@ def scrub(b):
2525
download_unpack_base = os.path.join(download_dir_base, "unpack")
2626

2727
snapshot_files = {
28-
"linux": ["bin/rustc",
29-
"lib/libstd-*.so",
30-
"lib/libextra-*.so",
31-
"lib/librustc-*.so",
32-
"lib/libsyntax-*.so",
33-
"lib/librustuv-*.so",
34-
"lib/librustllvm.so"],
35-
"macos": ["bin/rustc",
36-
"lib/libstd-*.dylib",
37-
"lib/libextra-*.dylib",
38-
"lib/librustc-*.dylib",
39-
"lib/libsyntax-*.dylib",
40-
"lib/librustuv-*.dylib",
41-
"lib/librustllvm.dylib"],
42-
"winnt": ["bin/rustc.exe",
43-
"bin/std-*.dll",
44-
"bin/extra-*.dll",
45-
"bin/rustc-*.dll",
46-
"bin/syntax-*.dll",
47-
"bin/rustuv-*.dll",
48-
"bin/rustllvm.dll"],
49-
"freebsd": ["bin/rustc",
50-
"lib/libstd-*.so",
51-
"lib/libextra-*.so",
52-
"lib/librustc-*.so",
53-
"lib/libsyntax-*.so",
54-
"lib/librustuv-*.so",
55-
"lib/librustllvm.so"]
28+
"linux": ["bin/rustc"],
29+
"macos": ["bin/rustc"],
30+
"winnt": ["bin/rustc.exe"],
31+
"freebsd": ["bin/rustc"],
5632
}
5733

5834
winnt_runtime_deps = ["libgcc_s_dw2-1.dll",

src/librustc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#[comment = "The Rust compiler"];
1818
#[license = "MIT/ASL2"];
1919
#[crate_type = "dylib"];
20+
#[crate_type = "rlib"];
2021

2122
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
2223

@@ -110,6 +111,7 @@ pub mod util {
110111

111112
pub mod lib {
112113
pub mod llvm;
114+
pub mod llvmdeps;
113115
}
114116

115117
// A curious inner module that allows ::std::foo to be available in here for

src/librustc/lib/llvm.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,18 @@ pub mod llvm {
306306
use std::libc::{c_char, c_int, c_longlong, c_ushort, c_uint, c_ulonglong,
307307
size_t};
308308

309-
#[link(name = "rustllvm")]
309+
// Link to our native llvm bindings (things that we need to use the C++ api
310+
// for) and because llvm is written in C++ we need to link against libstdc++
311+
//
312+
// You'll probably notice that there is an omission of all LLVM libraries
313+
// from this location. This is because the set of LLVM libraries that we
314+
// link to is mostly defined by LLVM, and the `llvm-config` tool is used to
315+
// figure out the exact set of libraries. To do this, the build system
316+
// generates an llvmdeps.rs file next to this one which will be
317+
// automatically updated whenever LLVM is updated to include an up-to-date
318+
// set of the libraries we need to link to LLVM for.
319+
#[link(name = "rustllvm", kind = "static")]
320+
#[link(name = "stdc++")]
310321
extern {
311322
/* Create and destroy contexts. */
312323
pub fn LLVMContextCreate() -> ContextRef;

src/librustpkg/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,7 @@ fn no_rebuilding() {
11011101
}
11021102
11031103
#[test]
1104+
#[ignore]
11041105
fn no_recopying() {
11051106
let p_id = PkgId::new("foo");
11061107
let workspace = create_local_package(&p_id);

src/libstd/rt/task.rs

+1
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ impl Unwinder {
543543
#[no_split_stack] // - it would be sad for this function to trigger __morestack
544544
#[doc(hidden)] // - Function must be `pub` to get exported, but it's
545545
// irrelevant for documentation purposes.
546+
#[cfg(not(test))] // in testing, use the original libstd's version
546547
pub extern "C" fn rust_stack_exhausted() {
547548
use rt::in_green_task_context;
548549
use rt::task::Task;

src/libsyntax/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#[license = "MIT/ASL2"];
2222
#[crate_type = "dylib"];
23+
#[crate_type = "rlib"];
2324

2425
#[feature(macro_rules, globs, managed_boxes)];
2526

src/snapshots.txt

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2013-12-04 9169579
2+
freebsd-x86_64 0dc6dcd9435e23c891b9e9e37d483e92cfe51449
3+
linux-i386 9802f6ba319bec4dd02299af08e421270ede5f5f
4+
linux-x86_64 195d69ac1846cd646faaa50d05639d41b03e33ae
5+
macos-i386 b0729f5ce3f5581fbb02f963a0f5261e6f011e01
6+
macos-x86_64 5091706c1111bbbd21a22e11b18f68717be17c29
7+
winnt-i386 1f975067f08f7702ab7f1d88b13221a0c2becd2f
8+
19
S 2013-11-30 4252a24
210
freebsd-x86_64 2e0bfc6eb0dd75b8a1ad5c9958d90f3b626650dd
311
linux-i386 2ea4b43fbc22c295e60874ef494dfbea1cc08a63

0 commit comments

Comments
 (0)