Enable assembly output of local commons for AIX
Summary:
This patch enable assembly output of local commons for AIX using .lcomm
directives. Adds a EmitXCOFFLocalCommonSymbol to MCStreamer so we can emit the
AIX version of .lcomm assembly directives which include a csect name. Handle the
case of BSS locals in PPCAIXAsmPrinter by using EmitXCOFFLocalCommonSymbol. Adds
a test for generating .lcomm on AIX Targets.
Reviewers: cebowleratibm, hubert.reinterpretcast, Xiangling_L, jasonliu, sfertile
Reviewed By: sfertile
Subscribers: wuzish, nemanjai, hiraditya, kbarton, MaskRay, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64825
llvm-svn: 368306
diff --git a/llvm/lib/MC/MCSectionXCOFF.cpp b/llvm/lib/MC/MCSectionXCOFF.cpp
index 9cee1cc..a3f79c3 100644
--- a/llvm/lib/MC/MCSectionXCOFF.cpp
+++ b/llvm/lib/MC/MCSectionXCOFF.cpp
@@ -28,9 +28,11 @@
return;
}
- if (getKind().isCommon()) {
- if (getMappingClass() != XCOFF::XMC_RW)
- llvm_unreachable("Unsupported storage-mapping class for common csect");
+ if (getKind().isBSSLocal() || getKind().isCommon()) {
+ if (getMappingClass() != XCOFF::XMC_RW &&
+ getMappingClass() != XCOFF::XMC_BS)
+ llvm_unreachable("Generated a storage-mapping class for a common/bss "
+ "csect we don't understand how to switch to.");
if (getCSectType() != XCOFF::XTY_CM)
llvm_unreachable("wrong csect type for .bss csect");
// Don't have to print a directive for switching to section for commons.