[llvm] [MC][ELF] Fix printing group signature symbols. (PR #112543)

Ivan Kosarev via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 06:36:27 PDT 2024


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

They may be not known.

Change-Id: I66543240af2d10d77b4f7f23c06553356b3ec767

>From 3bd56e319549e45b9f23386ae14b1393d5cb1a9c Mon Sep 17 00:00:00 2001
From: Ivan Kosarev <ivan.kosarev at amd.com>
Date: Wed, 16 Oct 2024 14:27:18 +0100
Subject: [PATCH] [MC][ELF] Fix printing group signature symbols.

They may be not known.

Change-Id: I66543240af2d10d77b4f7f23c06553356b3ec767
---
 llvm/lib/MC/MCSectionELF.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 25e62b70b5e2a0..3dc9a67e63939a 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -191,8 +191,10 @@ void MCSectionELF::printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
   }
 
   if (Flags & ELF::SHF_GROUP) {
-    OS << ",";
-    printName(OS, Group.getPointer()->getName());
+    if (const MCSymbolELF *Signature = Group.getPointer()) {
+      OS << ",";
+      printName(OS, Signature->getName());
+    }
     if (isComdat())
       OS << ",comdat";
   }



More information about the llvm-commits mailing list