aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCSectionELF.cpp
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2021-01-31 22:42:35 -0800
committerPetr Hosek <phosek@google.com>2021-02-16 14:23:40 -0800
commit16af97393346ad636298605930a8b503a55eb40a (patch)
tree335d13493c66fe7bf73914ec5707e29024fd3a8e /llvm/lib/MC/MCSectionELF.cpp
parent76609f17ced61f031a1fc77b2e0ed4aa9833917b (diff)
downloadllvm-16af97393346ad636298605930a8b503a55eb40a.zip
llvm-16af97393346ad636298605930a8b503a55eb40a.tar.gz
llvm-16af97393346ad636298605930a8b503a55eb40a.tar.bz2
[MC][ELF] Support for zero flag section groups
This change introduces support for zero flag ELF section groups to LLVM. LLVM already supports COMDAT sections, which in ELF are a special type of ELF section groups. These are generally useful to enable linker GC where you want a group of sections to always travel together, that is to be either retained or discarded as a whole, but without the COMDAT semantics. Other ELF assemblers already support zero flag ELF section groups and this change helps us reach feature parity. Differential Revision: https://reviews.llvm.org/D95851
Diffstat (limited to 'llvm/lib/MC/MCSectionELF.cpp')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 300f209..d188765 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -171,8 +171,9 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
if (Flags & ELF::SHF_GROUP) {
OS << ",";
- printName(OS, Group->getName());
- OS << ",comdat";
+ printName(OS, Group.getPointer()->getName());
+ if (isComdat())
+ OS << ",comdat";
}
if (Flags & ELF::SHF_LINK_ORDER) {