@@ -875,14 +875,19 @@ unsafe fn embed_bitcode(
875
875
// passed though then these sections will show up in the final output.
876
876
// Additionally the flag that we need to set here is `SHF_EXCLUDE`.
877
877
//
878
+ // * XCOFF - AIX linker ignores content in .ipa and .info if no auxiliary
879
+ // symbol associated with these sections.
880
+ //
878
881
// Unfortunately, LLVM provides no way to set custom section flags. For ELF
879
882
// and COFF we emit the sections using module level inline assembly for that
880
883
// reason (see issue #90326 for historical background).
884
+ let is_aix = cgcx. opts . target_triple . triple ( ) . contains ( "-aix" ) ;
881
885
let is_apple = cgcx. opts . target_triple . triple ( ) . contains ( "-ios" )
882
886
|| cgcx. opts . target_triple . triple ( ) . contains ( "-darwin" )
883
887
|| cgcx. opts . target_triple . triple ( ) . contains ( "-tvos" )
884
888
|| cgcx. opts . target_triple . triple ( ) . contains ( "-watchos" ) ;
885
889
if is_apple
890
+ || is_aix
886
891
|| cgcx. opts . target_triple . triple ( ) . starts_with ( "wasm" )
887
892
|| cgcx. opts . target_triple . triple ( ) . starts_with ( "asmjs" )
888
893
{
@@ -895,7 +900,13 @@ unsafe fn embed_bitcode(
895
900
) ;
896
901
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
897
902
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
+ } ;
899
910
llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) . cast ( ) ) ;
900
911
llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
901
912
llvm:: LLVMSetGlobalConstant ( llglobal, llvm:: True ) ;
@@ -907,7 +918,13 @@ unsafe fn embed_bitcode(
907
918
c"rustc.embedded.cmdline" . as_ptr ( ) . cast ( ) ,
908
919
) ;
909
920
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
+ } ;
911
928
llvm:: LLVMSetSection ( llglobal, section. as_ptr ( ) . cast ( ) ) ;
912
929
llvm:: LLVMRustSetLinkage ( llglobal, llvm:: Linkage :: PrivateLinkage ) ;
913
930
} else {
0 commit comments