From 4aa688e9973ec7e80ef60ecbc024c57e769b8cbf Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Thu, 13 Aug 2009 21:08:56 +0000 Subject: [PATCH] Add a method to return if the ELF section contains only common symbols! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78937 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSectionELF.h | 3 +++ lib/MC/MCSectionELF.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h index 00369f7d2f6..31e1e6684f6 100644 --- a/include/llvm/MC/MCSectionELF.h +++ b/include/llvm/MC/MCSectionELF.h @@ -55,6 +55,9 @@ public: /// ShouldPrintSectionType - Only prints the section type if supported bool ShouldPrintSectionType(unsigned Ty) const; + + /// IsCommon - True if this section contains only common symbols + bool IsCommon() const; /// These are the section type and flags fields. An ELF section can have /// only one Type, but can have more than one of the flags specified. diff --git a/lib/MC/MCSectionELF.cpp b/lib/MC/MCSectionELF.cpp index d172a9c9230..56f803496ac 100644 --- a/lib/MC/MCSectionELF.cpp +++ b/lib/MC/MCSectionELF.cpp @@ -121,3 +121,13 @@ void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI, OS << '\n'; } +// IsCommon - True if this section contains only common symbols +bool MCSectionELF::IsCommon() const { + + if (strncmp(SectionName.c_str(), ".gnu.linkonce.", 14) == 0) + return true; + + return false; +} + + -- 2.34.1