@@ -1734,8 +1734,29 @@ void Verifier::visitModuleFlags() {
1734
1734
// Scan each flag, and track the flags and requirements.
1735
1735
DenseMap<const MDString*, const MDNode*> SeenIDs;
1736
1736
SmallVector<const MDNode*, 16 > Requirements;
1737
- for (const MDNode *MDN : Flags->operands ())
1737
+ uint64_t PAuthABIPlatform = -1 ;
1738
+ uint64_t PAuthABIVersion = -1 ;
1739
+ for (const MDNode *MDN : Flags->operands ()) {
1738
1740
visitModuleFlag (MDN, SeenIDs, Requirements);
1741
+ if (MDN->getNumOperands () != 3 )
1742
+ continue ;
1743
+ if (const auto *FlagName = dyn_cast_or_null<MDString>(MDN->getOperand (1 ))) {
1744
+ if (FlagName->getString () == " aarch64-elf-pauthabi-platform" ) {
1745
+ if (const auto *PAP =
1746
+ mdconst::dyn_extract_or_null<ConstantInt>(MDN->getOperand (2 )))
1747
+ PAuthABIPlatform = PAP->getZExtValue ();
1748
+ } else if (FlagName->getString () == " aarch64-elf-pauthabi-version" ) {
1749
+ if (const auto *PAV =
1750
+ mdconst::dyn_extract_or_null<ConstantInt>(MDN->getOperand (2 )))
1751
+ PAuthABIVersion = PAV->getZExtValue ();
1752
+ }
1753
+ }
1754
+ }
1755
+
1756
+ if ((PAuthABIPlatform == uint64_t (-1 )) != (PAuthABIVersion == uint64_t (-1 )))
1757
+ report_fatal_error (
1758
+ " either both or no 'aarch64-elf-pauthabi-platform' and "
1759
+ " 'aarch64-elf-pauthabi-version' module flags must be present" );
1739
1760
1740
1761
// Validate that the requirements in the module are valid.
1741
1762
for (const MDNode *Requirement : Requirements) {
0 commit comments