Skip to content

Commit 44a9eda

Browse files
committed
---
yaml --- r: 93995 b: refs/heads/try c: c1e287a h: refs/heads/master i: 93993: a256a84 93991: 13daf41 v: v3
1 parent c4814f1 commit 44a9eda

File tree

5 files changed

+62
-11
lines changed

5 files changed

+62
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 6d6ccb75ff2240ed294fcf6aa57e96c72316954c
5+
refs/heads/try: c1e287af7788261bd50f47a166fbbd3493355a38
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use extra::time;
7777
use extra::sort;
7878
use syntax::ast::Name;
7979
use syntax::ast_map::{path, path_elt_to_str, path_name, path_pretty_name};
80-
use syntax::ast_util::{local_def};
80+
use syntax::ast_util::{local_def, is_local};
8181
use syntax::attr;
8282
use syntax::codemap::Span;
8383
use syntax::parse::token;
@@ -2996,7 +2996,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
29962996
return map;
29972997
}
29982998

2999-
pub fn fill_crate_map(ccx: &mut CrateContext, map: ValueRef) {
2999+
pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
30003000
let mut subcrates: ~[ValueRef] = ~[];
30013001
let mut i = 1;
30023002
let cstore = ccx.sess.cstore;
@@ -3014,19 +3014,20 @@ pub fn fill_crate_map(ccx: &mut CrateContext, map: ValueRef) {
30143014
subcrates.push(p2i(ccx, cr));
30153015
i += 1;
30163016
}
3017-
let event_loop_factory = if !*ccx.sess.building_library {
3018-
match ccx.tcx.lang_items.event_loop_factory() {
3019-
Some(did) => unsafe {
3017+
let event_loop_factory = match ccx.tcx.lang_items.event_loop_factory() {
3018+
Some(did) => unsafe {
3019+
if is_local(did) {
3020+
llvm::LLVMConstPointerCast(get_item_val(ccx, did.node),
3021+
ccx.int_type.ptr_to().to_ref())
3022+
} else {
30203023
let name = csearch::get_symbol(ccx.sess.cstore, did);
30213024
let global = name.with_c_str(|buf| {
30223025
llvm::LLVMAddGlobal(ccx.llmod, ccx.int_type.to_ref(), buf)
30233026
});
30243027
global
3025-
},
3026-
None => C_null(ccx.int_type.ptr_to())
3027-
}
3028-
} else {
3029-
C_null(ccx.int_type.ptr_to())
3028+
}
3029+
},
3030+
None => C_null(ccx.int_type.ptr_to())
30303031
};
30313032
unsafe {
30323033
let maptype = Type::array(&ccx.int_type, subcrates.len() as u64);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) lib.rs -Z gen-crate-map
5+
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6+
$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
7+
$(call RUN,main)
8+
rm $(call DYLIB,boot)
9+
$(call FAIL,main)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[link(package_id = "boot", name = "boot", vers = "0.1")];
12+
#[crate_type = "lib"];
13+
14+
extern mod rustuv; // pull in uvio
15+
16+
use std::rt;
17+
18+
#[no_mangle] // this needs to get called from C
19+
pub extern "C" fn foo(argc: int, argv: **u8) -> int {
20+
do rt::start(argc, argv) {
21+
do spawn {
22+
println!("hello");
23+
}
24+
}
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// this is the rust entry point that we're going to call.
12+
int foo(int argc, char *argv[]);
13+
14+
int main(int argc, char *argv[]) {
15+
return foo(argc, argv);
16+
}

0 commit comments

Comments
 (0)