1- use std:: ffi:: CString ;
1+ use std:: ffi:: { CStr , CString } ;
22use std:: io:: { self , Write } ;
33use std:: path:: { Path , PathBuf } ;
44use std:: sync:: Arc ;
@@ -958,14 +958,13 @@ fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
958958 cgcx. opts . target_triple . triple ( ) . contains ( "-aix" )
959959}
960960
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 {
963962 if target_is_apple ( cgcx) {
964- "__LLVM,__bitcode\0 "
963+ c "__LLVM,__bitcode"
965964 } else if target_is_aix ( cgcx) {
966- ".ipa\0 "
965+ c ".ipa"
967966 } else {
968- ".llvmbc\0 "
967+ c ".llvmbc"
969968 }
970969}
971970
@@ -1042,8 +1041,7 @@ unsafe fn embed_bitcode(
10421041 ) ;
10431042 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
10441043
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) ) ;
10471045 llvm:: set_linkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
10481046 llvm:: LLVMSetGlobalConstant ( llglobal, llvm:: True ) ;
10491047
@@ -1061,7 +1059,7 @@ unsafe fn embed_bitcode(
10611059 } else {
10621060 c".llvmcmd"
10631061 } ;
1064- llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) ) ;
1062+ llvm:: set_section ( llglobal, section) ;
10651063 llvm:: set_linkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
10661064 } else {
10671065 // We need custom section flags, so emit module-level inline assembly.
0 commit comments