Implement unique sections with an unique ID.
[oota-llvm.git] / include / llvm / MC / MCSectionELF.h
index 2bbc81fd79b7c5143421c2a1f20c532375fce7d2..cd15741fe20ee3a4d167a23d43a07543e19690f0 100644 (file)
@@ -39,6 +39,8 @@ class MCSectionELF : public MCSection {
   /// below.
   unsigned Flags;
 
+  unsigned UniqueID;
+
   /// EntrySize - The size of each entry in this section. This size only
   /// makes sense for sections that contain fixed-sized entries. If a
   /// section does not contain fixed-sized entries 'EntrySize' will be 0.
@@ -49,10 +51,10 @@ class MCSectionELF : public MCSection {
 private:
   friend class MCContext;
   MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K,
-               unsigned entrySize, const MCSymbol *group, bool Unique,
+               unsigned entrySize, const MCSymbol *group, unsigned UniqueID,
                MCSymbol *Begin)
-      : MCSection(SV_ELF, K, Begin, Unique), SectionName(Section), Type(type),
-        Flags(flags), EntrySize(entrySize), Group(group) {}
+      : MCSection(SV_ELF, K, Begin), SectionName(Section), Type(type),
+        Flags(flags), UniqueID(UniqueID), EntrySize(entrySize), Group(group) {}
   ~MCSectionELF();
 
   void setSectionName(StringRef Name) { SectionName = Name; }
@@ -74,6 +76,9 @@ public:
   bool UseCodeAlign() const override;
   bool isVirtualSection() const override;
 
+  bool isUnique() const { return UniqueID != ~0U; }
+  unsigned getUniqueID() const { return UniqueID; }
+
   static bool classof(const MCSection *S) {
     return S->getVariant() == SV_ELF;
   }