================
@@ -910,6 +910,19 @@ void Verifier::visitGlobalVariable(const GlobalVariable 
&GV) {
       Check(ETy->isPointerTy(), "wrong type for intrinsic global variable",
             &GV);
     }
+
+    auto *Init = GV.hasInitializer()
+                     ? dyn_cast<ConstantArray>(GV.getInitializer())
+                     : nullptr;
+    if (Init) {
+      for (const Use &U : Init->operands()) {
+        auto *Structor = dyn_cast<ConstantStruct>(U);
+        if (!Structor || Structor->getNumOperands() != 3)
+          continue;
+        Check(!isa<ConstantPtrAuth>(Structor->getOperand(1)),
+              "signing of ctors/dtors should be requested via module flags");
+      }
----------------
atrosinenko wrote:

"Structor" is either a "**con**structor" or "**de**strcutor" function :) Or 
maybe better to say these are init/fini functions that correspond to static 
objects' constructors and destructors, as well as to other functions, such as

```c
__attribute__((constructor))
void some_function(void) {
  // some initialization code
}

__attribute__((constructor))
void some_other_function(void) {
  // ...
}

__attribute__((destructor))
void some_function(void) {
  // some finalization code
}
```

https://github.com/llvm/llvm-project/pull/193087
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to