@@ -875,14 +875,19 @@ unsafe fn embed_bitcode(
875875 // passed though then these sections will show up in the final output.
876876 // Additionally the flag that we need to set here is `SHF_EXCLUDE`.
877877 //
878+ // * XCOFF - AIX linker ignores content in .ipa and .info if no auxiliary
879+ // symbol associated with these sections.
880+ //
878881 // Unfortunately, LLVM provides no way to set custom section flags. For ELF
879882 // and COFF we emit the sections using module level inline assembly for that
880883 // reason (see issue #90326 for historical background).
884+ let is_aix = cgcx. opts . target_triple . triple ( ) . contains ( "-aix" ) ;
881885 let is_apple = cgcx. opts . target_triple . triple ( ) . contains ( "-ios" )
882886 || cgcx. opts . target_triple . triple ( ) . contains ( "-darwin" )
883887 || cgcx. opts . target_triple . triple ( ) . contains ( "-tvos" )
884888 || cgcx. opts . target_triple . triple ( ) . contains ( "-watchos" ) ;
885889 if is_apple
890+ || is_aix
886891 || cgcx. opts . target_triple . triple ( ) . starts_with ( "wasm" )
887892 || cgcx. opts . target_triple . triple ( ) . starts_with ( "asmjs" )
888893 {
@@ -895,7 +900,13 @@ unsafe fn embed_bitcode(
895900 ) ;
896901 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
897902
898- let section = if is_apple { c"__LLVM,__bitcode" } else { c".llvmbc" } ;
903+ let section = if is_apple {
904+ c"__LLVM,__bitcode"
905+ } else if is_aix {
906+ c".ipa"
907+ } else {
908+ c".llvmbc"
909+ } ;
899910 llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) . cast ( ) ) ;
900911 llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
901912 llvm:: LLVMSetGlobalConstant ( llglobal, llvm:: True ) ;
@@ -907,7 +918,13 @@ unsafe fn embed_bitcode(
907918 c"rustc.embedded.cmdline" . as_ptr ( ) . cast ( ) ,
908919 ) ;
909920 llvm:: LLVMSetInitializer ( llglobal, llconst) ;
910- let section = if is_apple { c"__LLVM,__cmdline" } else { c".llvmcmd" } ;
921+ let section = if is_apple {
922+ c"__LLVM,__cmdline"
923+ } else if is_aix {
924+ c".info"
925+ } else {
926+ c".llvmcmd"
927+ } ;
911928 llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) . cast ( ) ) ;
912929 llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
913930 } else {
0 commit comments