Skip to content

Commit c11f290

Browse files
committed
Remove workarounds from issue rust-lang#4404
Closes rust-lang#10875
1 parent e2fa3c3 commit c11f290

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

src/librustc/middle/entry.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use driver::session;
1313
use driver::session::Session;
14-
use syntax::abi;
1514
use syntax::ast::{Crate, NodeId, item, item_fn};
1615
use syntax::ast_map;
1716
use syntax::attr;
@@ -46,10 +45,7 @@ impl Visitor<()> for EntryContext {
4645
}
4746

4847
pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) {
49-
50-
// FIXME #4404 android JNI hacks
51-
if *session.building_library &&
52-
session.targ_cfg.os != abi::OsAndroid {
48+
if *session.building_library {
5349
// No need to find a main function
5450
return;
5551
}
@@ -149,10 +145,6 @@ fn configure_main(this: &mut EntryContext) {
149145
}
150146
}
151147
this.session.abort_if_errors();
152-
} else {
153-
// If we *are* building a library, then we're on android where we still might
154-
// optionally want to translate main $4404
155-
assert_eq!(this.session.targ_cfg.os, abi::OsAndroid);
156148
}
157149
}
158150
}

src/librustc/middle/trans/base.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ use syntax::parse::token::{special_idents};
8585
use syntax::print::pprust::stmt_to_str;
8686
use syntax::{ast, ast_util, codemap, ast_map};
8787
use syntax::attr::AttrMetaMethods;
88-
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32, OsAndroid};
88+
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
8989
use syntax::visit;
9090
use syntax::visit::Visitor;
9191

@@ -2268,11 +2268,7 @@ fn finish_register_fn(ccx: @mut CrateContext, sp: Span, sym: ~str, node_id: ast:
22682268
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
22692269
}
22702270

2271-
// FIXME #4404 android JNI hacks
2272-
let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library ||
2273-
(*ccx.sess.building_library &&
2274-
ccx.sess.targ_cfg.os == OsAndroid));
2275-
if is_entry {
2271+
if is_entry_fn(&ccx.sess, node_id) && !*ccx.sess.building_library {
22762272
create_entry_wrapper(ccx, sp, llfn);
22772273
}
22782274
}
@@ -2340,13 +2336,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
23402336
let llfty = Type::func([ccx.int_type, Type::i8().ptr_to().ptr_to()],
23412337
&ccx.int_type);
23422338

2343-
// FIXME #4404 android JNI hacks
2344-
let main_name = if *ccx.sess.building_library {
2345-
"amain"
2346-
} else {
2347-
"main"
2348-
};
2349-
let llfn = decl_cdecl_fn(ccx.llmod, main_name, llfty);
2339+
let llfn = decl_cdecl_fn(ccx.llmod, "main", llfty);
23502340
let llbb = "top".with_c_str(|buf| {
23512341
unsafe {
23522342
llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
@@ -3178,14 +3168,13 @@ pub fn trans_crate(sess: session::Session,
31783168
}).to_owned_vec();
31793169

31803170
// Make sure that some other crucial symbols are not eliminated from the
3181-
// module. This includes the main function (main/amain elsewhere), the crate
3182-
// map (used for debug log settings and I/O), and finally the curious
3183-
// rust_stack_exhausted symbol. This symbol is required for use by the
3184-
// libmorestack library that we link in, so we must ensure that this symbol
3185-
// is not internalized (if defined in the crate).
3171+
// module. This includes the main function, the crate map (used for debug
3172+
// log settings and I/O), and finally the curious rust_stack_exhausted
3173+
// symbol. This symbol is required for use by the libmorestack library that
3174+
// we link in, so we must ensure that this symbol is not internalized (if
3175+
// defined in the crate).
31863176
reachable.push(ccx.crate_map_name.to_owned());
31873177
reachable.push(~"main");
3188-
reachable.push(~"amain");
31893178
reachable.push(~"rust_stack_exhausted");
31903179

31913180
return CrateTranslation {

0 commit comments

Comments
 (0)