[PATCH] D21743: Convenience function for MCStreamer to get named sections when lowering.
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 26 20:56:23 PDT 2016
dberris created this revision.
dberris added reviewers: echristo, grosbach.
dberris added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.
This change allows us to create uniquely identified "COMDAT" or "ELF
Group" sections while lowering. In particular, for ELF sections this is
useful for creating function-specific groups that get merged into the
same named section.
http://reviews.llvm.org/D21743
Files:
include/llvm/MC/MCELFStreamer.h
include/llvm/MC/MCStreamer.h
lib/MC/MCELFStreamer.cpp
lib/MC/MCStreamer.cpp
Index: lib/MC/MCStreamer.cpp
===================================================================
--- lib/MC/MCStreamer.cpp
+++ lib/MC/MCStreamer.cpp
@@ -806,3 +806,8 @@
EmitLabel(Sym);
return Sym;
}
+
+MCSection *MCStreamer::getNamedGroupSection(StringRef, StringRef, unsigned) {
+ llvm_unreachable("Unimplemented.");
+ return nullptr;
+}
Index: lib/MC/MCELFStreamer.cpp
===================================================================
--- lib/MC/MCELFStreamer.cpp
+++ lib/MC/MCELFStreamer.cpp
@@ -672,3 +672,11 @@
uint64_t Size, unsigned ByteAlignment) {
llvm_unreachable("ELF doesn't support this directive");
}
+
+MCSection *MCELFStreamer::getNamedGroupSection(StringRef Section,
+ StringRef Identifier,
+ unsigned EntSize) {
+ return getContext().getELFSection(Section, ELF::SHT_PROGBITS,
+ ELF::SHF_ALLOC | ELF::SHF_GROUP, EntSize,
+ Identifier);
+}
Index: include/llvm/MC/MCStreamer.h
===================================================================
--- include/llvm/MC/MCStreamer.h
+++ include/llvm/MC/MCStreamer.h
@@ -760,6 +760,12 @@
/// Get the .xdata section used for the given section.
MCSection *getAssociatedXDataSection(const MCSection *TextSec);
+ /// Get a group section with provided group identifier. This is in ELF, for
+ /// instance, named by concatenating \p Section with '.' then \p Identifier.
+ virtual MCSection *getNamedGroupSection(StringRef Section,
+ StringRef Identifier,
+ unsigned EntSize);
+
virtual void EmitSyntaxDirective();
/// \brief Emit a .reloc directive.
Index: include/llvm/MC/MCELFStreamer.h
===================================================================
--- include/llvm/MC/MCELFStreamer.h
+++ include/llvm/MC/MCELFStreamer.h
@@ -81,6 +81,9 @@
void EmitBundleLock(bool AlignToEnd) override;
void EmitBundleUnlock() override;
+ MCSection *getNamedGroupSection(StringRef Section, StringRef Identifer,
+ unsigned EntSize) override;
+
private:
bool isBundleLocked() const;
void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &) override;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21743.61928.patch
Type: text/x-patch
Size: 2368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160627/a93b1da8/attachment.bin>
More information about the llvm-commits
mailing list