1
- use std:: ffi:: CString ;
1
+ use std:: ffi:: { CStr , CString } ;
2
2
use std:: io:: { self , Write } ;
3
3
use std:: path:: { Path , PathBuf } ;
4
4
use std:: sync:: Arc ;
@@ -958,14 +958,13 @@ fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
958
958
cgcx. opts . target_triple . triple ( ) . contains ( "-aix" )
959
959
}
960
960
961
- //FIXME use c string literals here too
962
- pub ( crate ) fn bitcode_section_name ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> & ' static str {
961
+ pub ( crate ) fn bitcode_section_name ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> & ' static CStr {
963
962
if target_is_apple ( cgcx) {
964
- "__LLVM,__bitcode\0 "
963
+ c "__LLVM,__bitcode"
965
964
} else if target_is_aix ( cgcx) {
966
- ".ipa\0 "
965
+ c ".ipa"
967
966
} else {
968
- ".llvmbc\0 "
967
+ c ".llvmbc"
969
968
}
970
969
}
971
970
@@ -1042,8 +1041,7 @@ unsafe fn embed_bitcode(
1042
1041
) ;
1043
1042
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
1044
1043
1045
- let section = bitcode_section_name ( cgcx) ;
1046
- llvm:: LLVMSetSection ( llglobal, section. as_c_char_ptr ( ) ) ;
1044
+ llvm:: set_section ( llglobal, bitcode_section_name ( cgcx) ) ;
1047
1045
llvm:: set_linkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
1048
1046
llvm:: LLVMSetGlobalConstant ( llglobal, llvm:: True ) ;
1049
1047
@@ -1061,7 +1059,7 @@ unsafe fn embed_bitcode(
1061
1059
} else {
1062
1060
c".llvmcmd"
1063
1061
} ;
1064
- llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) ) ;
1062
+ llvm:: set_section ( llglobal, section) ;
1065
1063
llvm:: set_linkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
1066
1064
} else {
1067
1065
// We need custom section flags, so emit module-level inline assembly.
0 commit comments