@@ -170,7 +170,7 @@ fn mangle_name_by_type(@crate_ctxt cx, @ty.t t) -> str {
170
170
auto f = metadata. def_to_str ;
171
171
cx. sha . input_str ( metadata. ty_str ( t, f) ) ;
172
172
ret sep( ) + "rust" + sep ( )
173
- + cx. sha . result_str ( ) + sep ( )
173
+ + _str . substr ( cx. sha . result_str ( ) , 0 u , 16 u ) + sep ( )
174
174
+ path_name ( cx. path ) ;
175
175
}
176
176
@@ -891,6 +891,13 @@ fn decl_fastcall_fn(ModuleRef llmod, str name, TypeRef llty) -> ValueRef {
891
891
ret decl_fn ( llmod, name, lib. llvm . LLVMFastCallConv , llty) ;
892
892
}
893
893
894
+ fn decl_private_fastcall_fn ( ModuleRef llmod,
895
+ str name , TypeRef llty) -> ValueRef {
896
+ auto llfn = decl_fn ( llmod, name, lib. llvm . LLVMFastCallConv , llty) ;
897
+ llvm. LLVMSetLinkage ( llfn, lib. llvm . LLVMPrivateLinkage as llvm . Linkage ) ;
898
+ ret llfn;
899
+ }
900
+
894
901
fn decl_glue ( ModuleRef llmod, type_names tn, str s) -> ValueRef {
895
902
ret decl_cdecl_fn ( llmod, s, T_fn ( vec ( T_taskptr ( tn) ) , T_void ( ) ) ) ;
896
903
}
@@ -1576,8 +1583,7 @@ fn declare_generic_glue(@crate_ctxt cx, @ty.t t, str name) -> ValueRef {
1576
1583
auto gcx = @rec( path=vec( "glue", name) with * cx) ;
1577
1584
auto fn_name = mangle_name_by_type( gcx, t) ;
1578
1585
fn_name = sanitize( fn_name) ;
1579
- auto llfn = decl_fastcall_fn( cx. llmod, fn_name, llfnty) ;
1580
- llvm. LLVMSetLinkage ( llfn, lib. llvm. LLVMPrivateLinkage as llvm. Linkage ) ;
1586
+ auto llfn = decl_private_fastcall_fn( cx. llmod, fn_name, llfnty) ;
1581
1587
ret llfn;
1582
1588
}
1583
1589
@@ -3231,8 +3237,8 @@ fn trans_for_each(@block_ctxt cx,
3231
3237
vec( rec( mode=ast. val, ty=decl_ty) ) ,
3232
3238
plain_ty( ty. ty_nil) , 0 u) ;
3233
3239
3234
- let ValueRef lliterbody = decl_fastcall_fn ( cx. fcx. ccx. llmod,
3235
- s, iter_body_llty) ;
3240
+ let ValueRef lliterbody = decl_private_fastcall_fn ( cx. fcx. ccx. llmod,
3241
+ s, iter_body_llty) ;
3236
3242
3237
3243
// FIXME: handle ty params properly.
3238
3244
let vec[ ast. ty_param] ty_params = vec( ) ;
@@ -3813,7 +3819,7 @@ fn trans_bind_thunk(@crate_ctxt cx,
3813
3819
3814
3820
let str s = mangle_name_by_seq( cx, "thunk") ;
3815
3821
let TypeRef llthunk_ty = get_pair_fn_ty( type_of( cx, incoming_fty) ) ;
3816
- let ValueRef llthunk = decl_fastcall_fn ( cx. llmod, s, llthunk_ty) ;
3822
+ let ValueRef llthunk = decl_private_fastcall_fn ( cx. llmod, s, llthunk_ty) ;
3817
3823
3818
3824
auto fcx = new_fn_ctxt( cx, llthunk) ;
3819
3825
auto bcx = new_top_block_ctxt( fcx) ;
@@ -5402,11 +5408,10 @@ fn trans_vtbl(@crate_ctxt cx, TypeRef self_ty,
5402
5408
5403
5409
let @crate_ctxt mcx = extend_path( cx, m. node. ident) ;
5404
5410
let str s = mangle_name_by_seq( mcx, "method") ;
5405
- let ValueRef llfn = decl_fastcall_fn ( cx. llmod, s, llfnty) ;
5411
+ let ValueRef llfn = decl_private_fastcall_fn ( cx. llmod, s, llfnty) ;
5406
5412
cx. item_ids. insert( m. node. id, llfn) ;
5407
5413
cx. item_symbols. insert( m. node. id, s) ;
5408
5414
5409
-
5410
5415
trans_fn( mcx, m. node. meth, m. node. id, some[ TypeRef ] ( self_ty) ,
5411
5416
ty_params, m. node. ann) ;
5412
5417
methods += vec( llfn) ;
@@ -5713,7 +5718,7 @@ fn decl_fn_and_pair(@crate_ctxt cx,
5713
5718
5714
5719
// Declare the function itself.
5715
5720
let str s = mangle_name_by_seq ( cx, flav) ;
5716
- let ValueRef llfn = decl_fastcall_fn ( cx. llmod , s, llfty) ;
5721
+ let ValueRef llfn = decl_private_fastcall_fn ( cx. llmod , s, llfty) ;
5717
5722
5718
5723
// Declare the global constant pair that points to it.
5719
5724
let str ps = mangle_name_by_type ( cx, node_ann_type ( cx, ann) ) ;
@@ -5730,9 +5735,9 @@ fn register_fn_pair(@crate_ctxt cx, str ps, TypeRef llpairty, ValueRef llfn,
5730
5735
5731
5736
llvm. LLVMSetInitializer ( gvar, pair) ;
5732
5737
llvm. LLVMSetGlobalConstant ( gvar, True ) ;
5733
- llvm. LLVMSetLinkage ( gvar,
5734
- lib. llvm . LLVMPrivateLinkage
5735
- as llvm . Linkage ) ;
5738
+ llvm. LLVMSetVisibility ( gvar,
5739
+ lib. llvm . LLVMProtectedVisibility
5740
+ as llvm . Visibility ) ;
5736
5741
5737
5742
cx. item_ids . insert ( id, llfn) ;
5738
5743
cx. item_symbols . insert ( id, ps) ;
@@ -5776,9 +5781,8 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
5776
5781
// Declare the wrapper.
5777
5782
auto wrapper_type = native_fn_wrapper_type ( cx, num_ty_param, ann) ;
5778
5783
let str s = mangle_name_by_seq ( cx, "wrapper" ) ;
5779
- let ValueRef wrapper_fn = decl_fastcall_fn ( cx. llmod , s, wrapper_type) ;
5780
- llvm. LLVMSetLinkage ( wrapper_fn, lib. llvm . LLVMPrivateLinkage
5781
- as llvm . Linkage ) ;
5784
+ let ValueRef wrapper_fn = decl_private_fastcall_fn ( cx. llmod , s,
5785
+ wrapper_type) ;
5782
5786
5783
5787
// Declare the global constant pair that points to it.
5784
5788
auto wrapper_pair_type = T_fn_pair ( cx. tn , wrapper_type) ;
@@ -6267,9 +6271,8 @@ fn decl_bzero_glue(ModuleRef llmod) -> ValueRef {
6267
6271
ret decl_fastcall_fn ( llmod, abi. bzero_glue_name ( ) , ty) ;
6268
6272
}
6269
6273
6270
- fn make_bzero_glue ( ModuleRef llmod ) -> ValueRef {
6274
+ fn make_bzero_glue ( ValueRef fun ) -> ValueRef {
6271
6275
// We're not using the LLVM memset intrinsic. Same as with memcpy.
6272
- auto fun = decl_bzero_glue ( llmod) ;
6273
6276
auto initbb = llvm. LLVMAppendBasicBlock ( fun, _str. buf ( "init" ) ) ;
6274
6277
auto hdrbb = llvm. LLVMAppendBasicBlock ( fun, _str. buf ( "hdr" ) ) ;
6275
6278
auto loopbb = llvm. LLVMAppendBasicBlock ( fun, _str. buf ( "loop" ) ) ;
@@ -6548,6 +6551,7 @@ fn make_common_glue(str output) {
6548
6551
auto glues = make_glues ( llmod, tn) ;
6549
6552
create_crate_constant ( crate_ptr, glues) ;
6550
6553
make_memcpy_glue ( glues. memcpy_glue ) ;
6554
+ make_bzero_glue ( glues. bzero_glue ) ;
6551
6555
6552
6556
trans_exit_task_glue ( glues, new_str_hash[ ValueRef ] ( ) , tn, llmod) ;
6553
6557
0 commit comments