[AIX][TLS] Add assert check of valid csect type for the storage mapping class XCOFF...
authorVictor Huang <wei.huang@ibm.com>
Mon, 8 Mar 2021 20:17:57 +0000 (14:17 -0600)
committerVictor Huang <wei.huang@ibm.com>
Mon, 8 Mar 2021 20:18:57 +0000 (14:18 -0600)
This patch adds the assert check inside the constructor for the csect (MCSectionXCOFF) to ensure
valid csect type used for the storage mappping class XCOFF:XMC_UL.

llvm/include/llvm/MC/MCSectionXCOFF.h

index 27c06a2..1dafdd3 100644 (file)
@@ -51,6 +51,9 @@ class MCSectionXCOFF final : public MCSection {
         (ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
         "Invalid or unhandled type for csect.");
     assert(QualName != nullptr && "QualName is needed.");
+    if (SMC == XCOFF::XMC_UL)
+      assert((ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
+             "Invalid csect type for storage mapping class XCOFF::XMC_UL");
 
     QualName->setRepresentedCsect(this);
     QualName->setStorageClass(XCOFF::C_HIDEXT);