@@ -2544,6 +2544,10 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2544
2544
llvm:: LLVMAddGlobal ( ccx. llmod , llty, buf)
2545
2545
} ;
2546
2546
2547
+ if !* ccx. sess . building_library {
2548
+ lib:: llvm:: SetLinkage ( g, lib:: llvm:: InternalLinkage ) ;
2549
+ }
2550
+
2547
2551
// Apply the `unnamed_addr` attribute if
2548
2552
// requested
2549
2553
if attr:: contains_name ( i. attrs ,
@@ -3058,31 +3062,18 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::Crate) {
3058
3062
}
3059
3063
}
3060
3064
3061
- fn mk_global ( ccx : & CrateContext ,
3062
- name : & str ,
3063
- llval : ValueRef ,
3064
- internal : bool )
3065
- -> ValueRef {
3065
+ // Writes the current ABI version into the crate.
3066
+ pub fn write_abi_version ( ccx : & mut CrateContext ) {
3066
3067
unsafe {
3067
- let llglobal = do name. with_c_str |buf| {
3068
+ let llval = C_uint ( ccx, abi:: abi_version) ;
3069
+ let llglobal = do "rust_abi_version" . with_c_str |buf| {
3068
3070
llvm:: LLVMAddGlobal ( ccx. llmod , val_ty ( llval) . to_ref ( ) , buf)
3069
3071
} ;
3070
3072
llvm:: LLVMSetInitializer ( llglobal, llval) ;
3071
3073
llvm:: LLVMSetGlobalConstant ( llglobal, True ) ;
3072
-
3073
- if internal {
3074
- lib:: llvm:: SetLinkage ( llglobal, lib:: llvm:: InternalLinkage ) ;
3075
- }
3076
-
3077
- return llglobal;
3078
3074
}
3079
3075
}
3080
3076
3081
- // Writes the current ABI version into the crate.
3082
- pub fn write_abi_version ( ccx : & mut CrateContext ) {
3083
- mk_global ( ccx, "rust_abi_version" , C_uint ( ccx, abi:: abi_version) , false ) ;
3084
- }
3085
-
3086
3077
pub fn trans_crate ( sess : session:: Session ,
3087
3078
crate : & ast:: Crate ,
3088
3079
analysis : & CrateAnalysis ,
0 commit comments