Skip to content

Commit 38b8f29

Browse files
committed
---
yaml --- r: 140511 b: refs/heads/try2 c: 7b2020f h: refs/heads/master i: 140509: f18c2b9 140507: 0d2daa1 140503: 19beb9f 140495: 4844fae 140479: 7d0eb93 v: v3
1 parent 0883f70 commit 38b8f29

File tree

278 files changed

+15740
-5722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

278 files changed

+15740
-5722
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cb918e1a831782d6072a0b93dd57614cb9c2d961
8+
refs/heads/try2: 7b2020f2c3f51de0dd4dcfe4a107673eda6f25e7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ endif
110110
ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113+
ifdef ASM_COMMENTS
114+
CFG_RUSTC_FLAGS += -z asm-comments
115+
endif
113116
ifdef TIME_PASSES
114117
CFG_RUSTC_FLAGS += -Z time-passes
115118
endif

branches/try2/configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ then
439439
probe CFG_ZCAT zcat
440440
fi
441441

442+
step_msg "looking for target specific programs"
443+
444+
probe CFG_ADB adb
445+
442446
if [ ! -z "$CFG_PANDOC" ]
443447
then
444448
PV_MAJOR_MINOR=$(pandoc --version | grep '^pandoc ' |

branches/try2/doc/tutorial-ffi.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ wrapping `malloc` and `free`:
150150

151151
~~~~
152152
use core::libc::{c_void, size_t, malloc, free};
153-
154-
#[abi = "rust-intrinsic"]
155-
extern "rust-intrinsic" mod rusti {
156-
fn init<T>() -> T;
157-
}
153+
use core::unstable::intrinsics;
158154
159155
// a wrapper around the handle returned by the foreign code
160156
pub struct Unique<T> {
@@ -166,7 +162,8 @@ pub impl<'self, T: Owned> Unique<T> {
166162
unsafe {
167163
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
168164
assert!(!ptr::is_null(ptr));
169-
*ptr = value;
165+
// `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it
166+
intrinsics::move_val_init(&mut *ptr, value);
170167
Unique{ptr: ptr}
171168
}
172169
}
@@ -186,7 +183,7 @@ pub impl<'self, T: Owned> Unique<T> {
186183
impl<T: Owned> Drop for Unique<T> {
187184
fn finalize(&self) {
188185
unsafe {
189-
let mut x = rusti::init(); // dummy value to swap in
186+
let mut x = intrinsics::init(); // dummy value to swap in
190187
x <-> *self.ptr; // moving the object out is needed to call the destructor
191188
free(self.ptr as *c_void)
192189
}

branches/try2/mk/host.mk

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ $$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
2929
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
3030
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
3131
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
32-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
32+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
33+
| $$(HBIN$(2)_H_$(4))/
34+
3335
@$$(call E, cp: $$@)
3436
$$(Q)cp $$< $$@
3537

@@ -39,7 +41,9 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
3941
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
4042
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
4143
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
42-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
44+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
45+
| $$(HLIB$(2)_H_$(4))/
46+
4347
@$$(call E, cp: $$@)
4448
$$(Q)cp $$< $$@
4549
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_GLOB_$(4)) \
@@ -51,21 +55,24 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \
5155
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
5256
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
5357
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
54-
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
58+
$$(HSTDLIB_DEFAULT$(2)_H_$(4)) \
59+
| $$(HLIB$(2)_H_$(4))/
5560
@$$(call E, cp: $$@)
5661
$$(Q)cp $$< $$@
5762
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_GLOB_$(4)) \
5863
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_DSYM_GLOB_$(4))) \
5964
$$(HLIB$(2)_H_$(4))
6065

6166
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)): \
62-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4))
67+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4)) \
68+
| $$(HLIB$(2)_H_$(4))/
6369
@$$(call E, cp: $$@)
6470
$$(Q)cp $$< $$@
6571

6672
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)): \
6773
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
68-
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
74+
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
75+
| $$(HLIB$(2)_H_$(4))/
6976
@$$(call E, cp: $$@)
7077
$$(Q)cp $$< $$@
7178
# Subtle: We do not let the shell expand $(CORELIB_DSYM_GLOB) directly rather
@@ -82,7 +89,8 @@ $$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)): \
8289
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
8390
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
8491
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)) \
85-
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
92+
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
93+
| $$(HLIB$(2)_H_$(4))/
8694
@$$(call E, cp: $$@)
8795
$$(Q)cp $$< $$@
8896
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB_$(4)) \
@@ -91,30 +99,40 @@ $$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
9199

92100
$$(HLIB$(2)_H_$(4))/libcore.rlib: \
93101
$$(TLIB$(1)_T_$(4)_H_$(3))/libcore.rlib \
94-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
102+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
103+
| $$(HLIB$(2)_H_$(4))/
95104
@$$(call E, cp: $$@)
96105
$$(Q)cp $$< $$@
97106

98107
$$(HLIB$(2)_H_$(4))/libstd.rlib: \
99108
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \
100109
$$(HLIB$(2)_H_$(4))/libcore.rlib \
101-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
110+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
111+
| $$(HLIB$(2)_H_$(4))/
102112
@$$(call E, cp: $$@)
103113
$$(Q)cp $$< $$@
104114

105115
$$(HLIB$(2)_H_$(4))/librustc.rlib: \
106116
$$(TLIB$(1)_T_$(4)_H_$(3))/librustc.rlib \
107117
$$(HLIB$(2)_H_$(4))/libcore.rlib \
108118
$$(HLIB$(2)_H_$(4))/libstd.rlib \
109-
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
119+
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4)) \
120+
| $$(HLIB$(2)_H_$(4))/
110121
@$$(call E, cp: $$@)
111122
$$(Q)cp $$< $$@
112123

113124
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
114-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4))
125+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4)) \
126+
| $$(HLIB$(2)_H_$(4))/
115127
@$$(call E, cp: $$@)
116128
$$(Q)cp $$< $$@
117129

130+
$$(HBIN$(2)_H_$(4))/:
131+
mkdir -p $$@
132+
133+
$$(HLIB$(2)_H_$(4))/:
134+
mkdir -p $$@
135+
118136
endef
119137

120138
$(foreach t,$(CFG_HOST_TRIPLES), \

branches/try2/mk/install.mk

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,76 @@ uninstall:
154154
done
155155
$(Q)rm -Rf $(PHL)/rustc
156156
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
157+
158+
# target platform specific variables
159+
# for arm-linux-androidabi
160+
define DEF_ADB_DEVICE_STATUS
161+
CFG_ADB_DEVICE_STATUS=$(1)
162+
endef
163+
164+
$(foreach target,$(CFG_TARGET_TRIPLES), \
165+
$(if $(findstring $(target),"arm-linux-androideabi"), \
166+
$(if $(findstring adb,$(CFG_ADB)), \
167+
$(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
168+
$(info install: install-runtime-target for $(target) enabled \
169+
$(info install: android device attached) \
170+
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
171+
$(info install: install-runtime-target for $(target) disabled \
172+
$(info install: android device not attached) \
173+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
174+
), \
175+
$(info install: install-runtime-target for $(target) disabled \
176+
$(info install: adb not found) \
177+
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
178+
), \
179+
) \
180+
)
181+
182+
ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
183+
$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
184+
L_TOKEN := $(word 2,$(MAKECMDGOALS))
185+
ifeq ($(L_TOKEN),)
186+
CFG_RUNTIME_PUSH_DIR=/system/lib
187+
else
188+
CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
189+
endif
190+
191+
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
192+
ifdef VERBOSE
193+
ADB = adb $(1)
194+
ADB_PUSH = adb push $(1) $(2)
195+
ADB_SHELL = adb shell $(1) $(2)
196+
else
197+
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
198+
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
199+
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
200+
endif
201+
202+
define INSTALL_RUNTIME_TARGET_N
203+
install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
204+
$(Q)$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
205+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CFG_RUNTIME_$(1)),$(CFG_RUNTIME_PUSH_DIR))
206+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CORELIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
207+
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
208+
endef
209+
210+
define INSTALL_RUNTIME_TARGET_CLEANUP_N
211+
install-runtime-target-$(1)-cleanup:
212+
$(Q)$(call ADB,remount)
213+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(CFG_RUNTIME_$(1)))
214+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(CORELIB_GLOB_$(1)))
215+
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(STDLIB_GLOB_$(1)))
216+
endef
217+
218+
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD_TRIPLE)))
219+
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
220+
221+
install-runtime-target: \
222+
install-runtime-target-arm-linux-androideabi-cleanup \
223+
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD_TRIPLE)
224+
else
225+
install-runtime-target:
226+
@echo "No device to install runtime library"
227+
@echo
228+
endif
229+
endif

branches/try2/mk/target.mk

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,62 @@
1818
define TARGET_STAGE_N
1919

2020
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
21-
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a
21+
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a \
22+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2223
@$$(call E, cp: $$@)
2324
$$(Q)cp $$< $$@
2425

2526
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
26-
rt/$(2)/$(CFG_RUNTIME_$(2))
27+
rt/$(2)/$(CFG_RUNTIME_$(2)) \
28+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
2729
@$$(call E, cp: $$@)
2830
$$(Q)cp $$< $$@
2931

3032
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)): \
3133
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
32-
$$(TSREQ$(1)_T_$(2)_H_$(3))
34+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
35+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
3336
@$$(call E, compile_and_link: $$@)
3437
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
3538

3639
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
3740
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
3841
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)) \
39-
$$(TSREQ$(1)_T_$(2)_H_$(3))
42+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
43+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4044
@$$(call E, compile_and_link: $$@)
4145
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
4246

4347
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
4448
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
4549
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
4650
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
47-
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
51+
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
52+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
4853
@$$(call E, compile_and_link: $$@)
4954
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
5055

5156
# Only build the compiler for host triples
5257
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
5358

5459
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
55-
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3))
60+
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \
61+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
5662
@$$(call E, cp: $$@)
5763
$$(Q)cp $$< $$@
5864

5965
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
6066
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
6167
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
62-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3))
68+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
69+
| $$(TLIB$(1)_T_$(2)_H_$(3))/
6370
@$$(call E, compile_and_link: $$@)
6471
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
6572

6673
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
67-
$$(DRIVER_CRATE) \
68-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3))
74+
$$(DRIVER_CRATE) \
75+
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
76+
| $$(TBIN$(1)_T_$(2)_H_$(3))/
6977
@$$(call E, compile_and_link: $$@)
7078
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
7179
ifdef CFG_ENABLE_PAX_FLAGS
@@ -75,6 +83,12 @@ endif
7583

7684
endif
7785

86+
$$(TBIN$(1)_T_$(2)_H_$(3))/:
87+
mkdir -p $$@
88+
89+
$$(TLIB$(1)_T_$(2)_H_$(3))/:
90+
mkdir -p $$@
91+
7892
endef
7993

8094
# In principle, each host can build each target:

0 commit comments

Comments
 (0)