@@ -945,23 +945,10 @@ fn create_section_with_flags_asm(section_name: &str, section_flags: &str, data:
945
945
asm
946
946
}
947
947
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
-
961
948
pub ( crate ) fn bitcode_section_name ( cgcx : & CodegenContext < LlvmCodegenBackend > ) -> & ' static CStr {
962
- if target_is_apple ( cgcx) {
949
+ if cgcx. target_is_like_osx {
963
950
c"__LLVM,__bitcode"
964
- } else if target_is_aix ( cgcx) {
951
+ } else if cgcx. target_is_like_aix {
965
952
c".ipa"
966
953
} else {
967
954
c".llvmbc"
@@ -1028,10 +1015,12 @@ unsafe fn embed_bitcode(
1028
1015
// Unfortunately, LLVM provides no way to set custom section flags. For ELF
1029
1016
// and COFF we emit the sections using module level inline assembly for that
1030
1017
// reason (see issue #90326 for historical background).
1031
- let is_aix = target_is_aix ( cgcx) ;
1032
- let is_apple = target_is_apple ( cgcx) ;
1033
1018
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
+ {
1035
1024
// We don't need custom section flags, create LLVM globals.
1036
1025
let llconst = common:: bytes_in_context ( llcx, bitcode) ;
1037
1026
let llglobal = llvm:: LLVMAddGlobal (
@@ -1052,9 +1041,9 @@ unsafe fn embed_bitcode(
1052
1041
c"rustc.embedded.cmdline" . as_ptr ( ) ,
1053
1042
) ;
1054
1043
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
1055
- let section = if is_apple {
1044
+ let section = if cgcx . target_is_like_osx {
1056
1045
c"__LLVM,__cmdline"
1057
- } else if is_aix {
1046
+ } else if cgcx . target_is_like_aix {
1058
1047
c".info"
1059
1048
} else {
1060
1049
c".llvmcmd"
0 commit comments