#ifndef LLVM_MC_MCSECTIONELF_H
#define LLVM_MC_MCSECTIONELF_H
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/SectionKind.h"
namespace llvm {
class MCSectionELF final : public MCSection {
unsigned Type;
unsigned Flags;
unsigned UniqueID;
unsigned EntrySize;
const PointerIntPair<const MCSymbolELF *, 1, bool> Group;
const MCSymbol *LinkedToSym;
private:
friend class MCContext;
MCSectionELF(StringRef Name, unsigned type, unsigned flags, SectionKind K,
unsigned entrySize, const MCSymbolELF *group, bool IsComdat,
unsigned UniqueID, MCSymbol *Begin,
const MCSymbolELF *LinkedToSym)
: MCSection(SV_ELF, Name, K, Begin), Type(type), Flags(flags),
UniqueID(UniqueID), EntrySize(entrySize), Group(group, IsComdat),
LinkedToSym(LinkedToSym) {
if (Group.getPointer())
Group.getPointer()->setIsSignature();
}
void setSectionName(StringRef Name) { this->Name = Name; }
public:
bool shouldOmitSectionDirective(StringRef Name, const MCAsmInfo &MAI) const;
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
unsigned getEntrySize() const { return EntrySize; }
void setFlags(unsigned F) { Flags = F; }
const MCSymbolELF *getGroup() const { return Group.getPointer(); }
bool isComdat() const { return Group.getInt(); }
void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
raw_ostream &OS,
const MCExpr *Subsection) const override;
bool useCodeAlign() const override;
bool isVirtualSection() const override;
StringRef getVirtualSectionKind() const override;
bool isUnique() const { return UniqueID != NonUniqueID; }
unsigned getUniqueID() const { return UniqueID; }
const MCSection *getLinkedToSection() const {
return &LinkedToSym->getSection();
}
const MCSymbol *getLinkedToSymbol() const { return LinkedToSym; }
static bool classof(const MCSection *S) {
return S->getVariant() == SV_ELF;
}
};
}
#endif