@@ -945,23 +945,10 @@ fn create_section_with_flags_asm(section_name: &str, section_flags: &str, data:
945945 asm
946946}
947947
948- fn target_is_apple ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> bool {
949- let triple = cgcx. opts . target_triple . tuple ( ) ;
950- triple. contains ( "-ios" )
951- || triple. contains ( "-darwin" )
952- || triple. contains ( "-tvos" )
953- || triple. contains ( "-watchos" )
954- || triple. contains ( "-visionos" )
955- }
956-
957- fn target_is_aix ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> bool {
958- cgcx. opts . target_triple . tuple ( ) . contains ( "-aix" )
959- }
960-
961948pub ( crate ) fn bitcode_section_name ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> & ' static CStr {
962- if target_is_apple ( cgcx) {
949+ if cgcx. target_is_like_osx {
963950 c"__LLVM,__bitcode"
964- } else if target_is_aix ( cgcx) {
951+ } else if cgcx. target_is_like_aix {
965952 c".ipa"
966953 } else {
967954 c".llvmbc"
@@ -1028,10 +1015,12 @@ unsafe fn embed_bitcode(
10281015 // Unfortunately, LLVM provides no way to set custom section flags. For ELF
10291016 // and COFF we emit the sections using module level inline assembly for that
10301017 // reason (see issue #90326 for historical background).
1031- let is_aix = target_is_aix ( cgcx) ;
1032- let is_apple = target_is_apple ( cgcx) ;
10331018 unsafe {
1034- if is_apple || is_aix || cgcx. opts . target_triple . tuple ( ) . starts_with ( "wasm" ) {
1019+ if cgcx. target_is_like_osx
1020+ || cgcx. target_is_like_aix
1021+ || cgcx. target_arch == "wasm32"
1022+ || cgcx. target_arch == "wasm64"
1023+ {
10351024 // We don't need custom section flags, create LLVM globals.
10361025 let llconst = common:: bytes_in_context ( llcx, bitcode) ;
10371026 let llglobal = llvm:: LLVMAddGlobal (
@@ -1052,9 +1041,9 @@ unsafe fn embed_bitcode(
10521041 c"rustc.embedded.cmdline" . as_ptr ( ) ,
10531042 ) ;
10541043 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
1055- let section = if is_apple {
1044+ let section = if cgcx . target_is_like_osx {
10561045 c"__LLVM,__cmdline"
1057- } else if is_aix {
1046+ } else if cgcx . target_is_like_aix {
10581047 c".info"
10591048 } else {
10601049 c".llvmcmd"
0 commit comments