@@ -5993,9 +5993,11 @@ fn new_block_ctxt(cx: &@fn_ctxt, parent: &block_parent, kind: block_kind,
5993
5993
name : & str ) -> @block_ctxt {
5994
5994
let cleanups: cleanup [ ] = ~[ ] ;
5995
5995
let s = str:: buf ( "" ) ;
5996
+ let held_name; //HACK for str::buf, which doesn't keep its value alive
5996
5997
if cx. lcx . ccx . sess . get_opts ( ) . save_temps ||
5997
5998
cx. lcx . ccx . sess . get_opts ( ) . debuginfo {
5998
- s = str:: buf ( cx. lcx . ccx . names . next ( name) ) ;
5999
+ held_name = cx. lcx . ccx . names . next ( name) ;
6000
+ s = str:: buf ( held_name) ;
5999
6001
}
6000
6002
let llbb: BasicBlockRef = llvm:: LLVMAppendBasicBlock ( cx. llfn , s) ;
6001
6003
ret @{ llbb : llbb,
@@ -8001,11 +8003,14 @@ fn make_common_glue(sess: &session::session, output: &str) {
8001
8003
let llmod =
8002
8004
llvm:: LLVMModuleCreateWithNameInContext ( str:: buf ( "rust_out" ) ,
8003
8005
llvm:: LLVMGetGlobalContext ( ) ) ;
8004
- llvm:: LLVMSetDataLayout ( llmod, str:: buf ( x86:: get_data_layout ( ) ) ) ;
8005
- llvm:: LLVMSetTarget ( llmod, str:: buf ( x86:: get_target_triple ( ) ) ) ;
8006
+ let dat_layt = x86:: get_data_layout ( ) ; //HACK (buf lifetime issue)
8007
+ llvm:: LLVMSetDataLayout ( llmod, str:: buf ( dat_layt) ) ;
8008
+ let targ_trip = x86:: get_target_triple ( ) ; //HACK (buf lifetime issue)
8009
+ llvm:: LLVMSetTarget ( llmod, str:: buf ( targ_trip) ) ;
8006
8010
mk_target_data ( x86:: get_data_layout ( ) ) ;
8007
8011
declare_intrinsics ( llmod) ;
8008
- llvm:: LLVMSetModuleInlineAsm ( llmod, str:: buf ( x86:: get_module_asm ( ) ) ) ;
8012
+ let modl_asm = x86:: get_module_asm ( ) ; //HACK (buf lifetime issue)
8013
+ llvm:: LLVMSetModuleInlineAsm ( llmod, str:: buf ( modl_asm) ) ;
8009
8014
make_glues ( llmod, taskptr_type) ;
8010
8015
link:: write:: run_passes ( sess, llmod, output) ;
8011
8016
}
@@ -8035,10 +8040,9 @@ fn create_crate_map(ccx: &@crate_ctxt) -> ValueRef {
8035
8040
let i = 1 ;
8036
8041
let cstore = ccx. sess . get_cstore ( ) ;
8037
8042
while cstore:: have_crate_data ( cstore, i) {
8038
- let name = cstore:: get_crate_data ( cstore, i) . name ;
8043
+ let nm = "_rust_crate_map_" + cstore:: get_crate_data ( cstore, i) . name ;
8039
8044
let cr =
8040
- llvm:: LLVMAddGlobal ( ccx. llmod , T_int ( ) ,
8041
- str:: buf ( "_rust_crate_map_" + name) ) ;
8045
+ llvm:: LLVMAddGlobal ( ccx. llmod , T_int ( ) , str:: buf ( nm) ) ;
8042
8046
subcrates += ~[ p2i ( cr) ] ;
8043
8047
i += 1 ;
8044
8048
}
@@ -8067,7 +8071,8 @@ fn write_metadata(cx: &@crate_ctxt, crate: &@ast::crate) {
8067
8071
llvm:: LLVMAddGlobal ( cx. llmod , val_ty ( llconst) ,
8068
8072
str:: buf ( "rust_metadata" ) ) ;
8069
8073
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
8070
- llvm:: LLVMSetSection ( llglobal, str:: buf ( x86:: get_meta_sect_name ( ) ) ) ;
8074
+ let met_sct_nm = x86:: get_meta_sect_name ( ) ; //HACK (buf lifetime issue)
8075
+ llvm:: LLVMSetSection ( llglobal, str:: buf ( met_sct_nm) ) ;
8071
8076
llvm:: LLVMSetLinkage ( llglobal,
8072
8077
lib:: llvm:: LLVMInternalLinkage as llvm:: Linkage ) ;
8073
8078
@@ -8086,9 +8091,11 @@ fn trans_crate(sess: &session::session, crate: &@ast::crate, tcx: &ty::ctxt,
8086
8091
let llmod =
8087
8092
llvm:: LLVMModuleCreateWithNameInContext ( str:: buf ( "rust_out" ) ,
8088
8093
llvm:: LLVMGetGlobalContext ( ) ) ;
8089
- llvm:: LLVMSetDataLayout ( llmod, str:: buf ( x86:: get_data_layout ( ) ) ) ;
8090
- llvm:: LLVMSetTarget ( llmod, str:: buf ( x86:: get_target_triple ( ) ) ) ;
8091
- let td = mk_target_data ( x86:: get_data_layout ( ) ) ;
8094
+ let dat_layt = x86:: get_data_layout ( ) ; //HACK (buf lifetime issue)
8095
+ llvm:: LLVMSetDataLayout ( llmod, str:: buf ( dat_layt) ) ;
8096
+ let targ_trip = x86:: get_target_triple ( ) ; //HACK (buf lifetime issue)
8097
+ llvm:: LLVMSetTarget ( llmod, str:: buf ( targ_trip) ) ;
8098
+ let td = mk_target_data ( dat_layt) ;
8092
8099
let tn = mk_type_names ( ) ;
8093
8100
let intrinsics = declare_intrinsics ( llmod) ;
8094
8101
let task_type = T_task ( ) ;
0 commit comments