@@ -2321,6 +2321,23 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
2321
2321
}
2322
2322
}
2323
2323
2324
+ fn finish_register_fn ( ccx : @mut CrateContext , sp : Span , sym : ~str , node_id : ast:: NodeId ,
2325
+ llfn : ValueRef ) {
2326
+ ccx. item_symbols . insert ( node_id, sym) ;
2327
+
2328
+ if !* ccx. sess . building_library {
2329
+ lib:: llvm:: SetLinkage ( llfn, lib:: llvm:: InternalLinkage ) ;
2330
+ }
2331
+
2332
+ // FIXME #4404 android JNI hacks
2333
+ let is_entry = is_entry_fn ( & ccx. sess , node_id) && ( !* ccx. sess . building_library ||
2334
+ ( * ccx. sess . building_library &&
2335
+ ccx. sess . targ_cfg . os == session:: OsAndroid ) ) ;
2336
+ if is_entry {
2337
+ create_entry_wrapper ( ccx, sp, llfn) ;
2338
+ }
2339
+ }
2340
+
2324
2341
pub fn register_fn ( ccx : @mut CrateContext ,
2325
2342
sp : Span ,
2326
2343
sym : ~str ,
@@ -2336,15 +2353,7 @@ pub fn register_fn(ccx: @mut CrateContext,
2336
2353
} ;
2337
2354
2338
2355
let llfn = decl_rust_fn ( ccx, f. sig . inputs , f. sig . output , sym) ;
2339
- ccx. item_symbols . insert ( node_id, sym) ;
2340
-
2341
- // FIXME #4404 android JNI hacks
2342
- let is_entry = is_entry_fn ( & ccx. sess , node_id) && ( !* ccx. sess . building_library ||
2343
- ( * ccx. sess . building_library &&
2344
- ccx. sess . targ_cfg . os == session:: OsAndroid ) ) ;
2345
- if is_entry {
2346
- create_entry_wrapper ( ccx, sp, llfn) ;
2347
- }
2356
+ finish_register_fn ( ccx, sp, sym, node_id, llfn) ;
2348
2357
llfn
2349
2358
}
2350
2359
@@ -2361,15 +2370,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext,
2361
2370
ast_map:: path_to_str( item_path( ccx, & node_id) , token:: get_ident_interner( ) ) ) ;
2362
2371
2363
2372
let llfn = decl_fn ( ccx. llmod , sym, cc, fn_ty) ;
2364
- ccx. item_symbols . insert ( node_id, sym) ;
2365
-
2366
- // FIXME #4404 android JNI hacks
2367
- let is_entry = is_entry_fn ( & ccx. sess , node_id) && ( !* ccx. sess . building_library ||
2368
- ( * ccx. sess . building_library &&
2369
- ccx. sess . targ_cfg . os == session:: OsAndroid ) ) ;
2370
- if is_entry {
2371
- create_entry_wrapper ( ccx, sp, llfn) ;
2372
- }
2373
+ finish_register_fn ( ccx, sp, sym, node_id, llfn) ;
2373
2374
llfn
2374
2375
}
2375
2376
0 commit comments