[clang] [llvm] Support -mnop-mcount and -mrecord-mcount on x86 elf targets. (PR #184641)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 05:57:41 PDT 2026


================
@@ -51,10 +51,14 @@ PreservedAnalyses FEntryInserterPass::run(MachineFunction &MF,
 }
 
 bool FEntryInserter::run(MachineFunction &MF) {
-  const std::string FEntryName = std::string(
-      MF.getFunction().getFnAttribute("fentry-call").getValueAsString());
-  if (FEntryName != "true")
+  const Function &F = MF.getFunction();
+  if (F.getFnAttribute("fentry-call").getValueAsString() != "true") {
+    if (F.hasFnAttribute("mnop-mcount"))
+      report_fatal_error("mnop-mcount only supported with fentry-call");
----------------
nikic wrote:

Though I still think that checking these in `llvm/lib/IR/Verifier.cpp` would be better.

https://github.com/llvm/llvm-project/pull/184641


More information about the cfe-commits mailing list