[llvm] [MC][ELF] Have an assert catching creating group sections without signatures. (PR #113553)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 04:54:29 PDT 2024


https://github.com/kosarev created https://github.com/llvm/llvm-project/pull/113553

None

>From 7cfcbb23e6ed51970ef98375f080aa02261bcaa2 Mon Sep 17 00:00:00 2001
From: Ivan Kosarev <ivan.kosarev at amd.com>
Date: Thu, 24 Oct 2024 12:48:54 +0100
Subject: [PATCH] [MC][ELF] Have an assert catching creating group sections
 without signatures.

---
 llvm/include/llvm/MC/MCSectionELF.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/include/llvm/MC/MCSectionELF.h b/llvm/include/llvm/MC/MCSectionELF.h
index d43ffbd885c961..f09d30591a3cf6 100644
--- a/llvm/include/llvm/MC/MCSectionELF.h
+++ b/llvm/include/llvm/MC/MCSectionELF.h
@@ -62,6 +62,8 @@ class MCSectionELF final : public MCSection {
                   type == ELF::SHT_NOBITS, Begin),
         Type(type), Flags(flags), UniqueID(UniqueID), EntrySize(entrySize),
         Group(group, IsComdat), LinkedToSym(LinkedToSym) {
+    assert((!(Flags & ELF::SHF_GROUP) || Group.getPointer()) &&
+           "Group section without signature!");
     if (Group.getPointer())
       Group.getPointer()->setIsSignature();
   }



More information about the llvm-commits mailing list