Remove duplicated code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124054 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2011-01-23 04:28:49 +00:00
parent 5c96c69161
commit c85dca66e6
12 changed files with 90 additions and 152 deletions

View File

@ -59,79 +59,6 @@ public:
/// header index.
bool HasCommonSymbols() 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.
///
/// Valid section types.
enum {
// This value marks the section header as inactive.
SHT_NULL = 0x00U,
// Holds information defined by the program, with custom format and meaning.
SHT_PROGBITS = 0x01U,
// This section holds a symbol table.
SHT_SYMTAB = 0x02U,
// The section holds a string table.
SHT_STRTAB = 0x03U,
// The section holds relocation entries with explicit addends.
SHT_RELA = 0x04U,
// The section holds a symbol hash table.
SHT_HASH = 0x05U,
// Information for dynamic linking.
SHT_DYNAMIC = 0x06U,
// The section holds information that marks the file in some way.
SHT_NOTE = 0x07U,
// A section of this type occupies no space in the file.
SHT_NOBITS = 0x08U,
// The section holds relocation entries without explicit addends.
SHT_REL = 0x09U,
// This section type is reserved but has unspecified semantics.
SHT_SHLIB = 0x0AU,
// This section holds a symbol table.
SHT_DYNSYM = 0x0BU,
// This section contains an array of pointers to initialization functions.
SHT_INIT_ARRAY = 0x0EU,
// This section contains an array of pointers to termination functions.
SHT_FINI_ARRAY = 0x0FU,
// This section contains an array of pointers to functions that are invoked
// before all other initialization functions.
SHT_PREINIT_ARRAY = 0x10U,
// A section group is a set of sections that are related and that must be
// treated specially by the linker.
SHT_GROUP = 0x11U,
// This section is associated with a section of type SHT_SYMTAB, when the
// referenced symbol table contain the escape value SHN_XINDEX
SHT_SYMTAB_SHNDX = 0x12U,
// Start of target-specific flags.
// Exception Index table
SHT_ARM_EXIDX = 0x70000001U,
// BPABI DLL dynamic linking pre-emption map
SHT_ARM_PREEMPTMAP = 0x70000002U,
// Object file compatibility attributes
SHT_ARM_ATTRIBUTES = 0x70000003U,
SHT_ARM_DEBUGOVERLAY = 0x70000004U,
SHT_ARM_OVERLAYSECTION = 0x70000005U,
LAST_KNOWN_SECTION_TYPE = SHT_ARM_OVERLAYSECTION
};
/// Valid section flags.
enum {
// The section contains data that should be writable.

View File

@ -29,6 +29,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallString.h"
@ -46,80 +47,80 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
TargetLoweringObjectFile::Initialize(Ctx, TM);
BSSSection =
getContext().getELFSection(".bss", MCSectionELF::SHT_NOBITS,
getContext().getELFSection(".bss", ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getBSS());
TextSection =
getContext().getELFSection(".text", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".text", ELF::SHT_PROGBITS,
MCSectionELF::SHF_EXECINSTR |
MCSectionELF::SHF_ALLOC,
SectionKind::getText());
DataSection =
getContext().getELFSection(".data", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".data", ELF::SHT_PROGBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
ReadOnlySection =
getContext().getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".rodata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC,
SectionKind::getReadOnly());
TLSDataSection =
getContext().getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".tdata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
MCSectionELF::SHF_WRITE,
SectionKind::getThreadData());
TLSBSSSection =
getContext().getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
getContext().getELFSection(".tbss", ELF::SHT_NOBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
MCSectionELF::SHF_WRITE,
SectionKind::getThreadBSS());
DataRelSection =
getContext().getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".data.rel", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getDataRel());
DataRelLocalSection =
getContext().getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".data.rel.local", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getDataRelLocal());
DataRelROSection =
getContext().getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getReadOnlyWithRel());
DataRelROLocalSection =
getContext().getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".data.rel.ro.local", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getReadOnlyWithRelLocal());
MergeableConst4Section =
getContext().getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
SectionKind::getMergeableConst4());
MergeableConst8Section =
getContext().getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
SectionKind::getMergeableConst8());
MergeableConst16Section =
getContext().getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
SectionKind::getMergeableConst16());
StaticCtorSection =
getContext().getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".ctors", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getDataRel());
StaticDtorSection =
getContext().getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".dtors", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
SectionKind::getDataRel());
@ -130,47 +131,47 @@ void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
// runtime hit for C++ apps. Either the contents of the LSDA need to be
// adjusted or this should be a data section.
LSDASection =
getContext().getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC,
SectionKind::getReadOnly());
EHFrameSection =
getContext().getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".eh_frame", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
// Debug Info Sections.
DwarfAbbrevSection =
getContext().getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_abbrev", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfInfoSection =
getContext().getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_info", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfLineSection =
getContext().getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_line", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfFrameSection =
getContext().getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_frame", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfPubNamesSection =
getContext().getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_pubnames", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfPubTypesSection =
getContext().getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_pubtypes", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfStrSection =
getContext().getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_str", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfLocSection =
getContext().getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_loc", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfARangesSection =
getContext().getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfRangesSection =
getContext().getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
DwarfMacroInfoSection =
getContext().getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
getContext().getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0,
SectionKind::getMetadata());
}
@ -209,18 +210,18 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) {
static unsigned getELFSectionType(StringRef Name, SectionKind K) {
if (Name == ".init_array")
return MCSectionELF::SHT_INIT_ARRAY;
return ELF::SHT_INIT_ARRAY;
if (Name == ".fini_array")
return MCSectionELF::SHT_FINI_ARRAY;
return ELF::SHT_FINI_ARRAY;
if (Name == ".preinit_array")
return MCSectionELF::SHT_PREINIT_ARRAY;
return ELF::SHT_PREINIT_ARRAY;
if (K.isBSS() || K.isThreadBSS())
return MCSectionELF::SHT_NOBITS;
return ELF::SHT_NOBITS;
return MCSectionELF::SHT_PROGBITS;
return ELF::SHT_PROGBITS;
}
@ -353,7 +354,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
std::string Name = SizeSpec + utostr(Align);
return getContext().getELFSection(Name, MCSectionELF::SHT_PROGBITS,
return getContext().getELFSection(Name, ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_MERGE |
MCSectionELF::SHF_STRINGS,

View File

@ -18,6 +18,7 @@
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
typedef StringMap<const MCSectionMachO*> MachOUniqueMapTy;
@ -211,7 +212,7 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
const MCSectionELF *MCContext::CreateELFGroupSection() {
MCSectionELF *Result =
new (*this) MCSectionELF(".group", MCSectionELF::SHT_GROUP, 0,
new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
SectionKind::getReadOnly(), 4, NULL);
return Result;
}

View File

@ -155,19 +155,19 @@ private:
}
void SetSectionData() {
SetSection(".data", MCSectionELF::SHT_PROGBITS,
SetSection(".data", ELF::SHT_PROGBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
EmitCodeAlignment(4, 0);
}
void SetSectionText() {
SetSection(".text", MCSectionELF::SHT_PROGBITS,
SetSection(".text", ELF::SHT_PROGBITS,
MCSectionELF::SHF_EXECINSTR |
MCSectionELF::SHF_ALLOC, SectionKind::getText());
EmitCodeAlignment(4, 0);
}
void SetSectionBss() {
SetSection(".bss", MCSectionELF::SHT_NOBITS,
SetSection(".bss", ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |
MCSectionELF::SHF_ALLOC, SectionKind::getBSS());
EmitCodeAlignment(4, 0);
@ -346,7 +346,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
if (GetBinding(SD) == ELF_STB_Local) {
const MCSection *Section = getAssembler().getContext().getELFSection(".bss",
MCSectionELF::SHT_NOBITS,
ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |
MCSectionELF::SHF_ALLOC,
SectionKind::getBSS());

View File

@ -16,6 +16,7 @@
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
namespace {
@ -59,57 +60,57 @@ public:
// FIXME: Part of this logic is duplicated in the MCELFStreamer. What is
// the best way for us to get access to it?
bool ParseSectionDirectiveData(StringRef, SMLoc) {
return ParseSectionSwitch(".data", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".data", ELF::SHT_PROGBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
}
bool ParseSectionDirectiveText(StringRef, SMLoc) {
return ParseSectionSwitch(".text", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".text", ELF::SHT_PROGBITS,
MCSectionELF::SHF_EXECINSTR |
MCSectionELF::SHF_ALLOC, SectionKind::getText());
}
bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
return ParseSectionSwitch(".bss", MCSectionELF::SHT_NOBITS,
return ParseSectionSwitch(".bss", ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |
MCSectionELF::SHF_ALLOC, SectionKind::getBSS());
}
bool ParseSectionDirectiveRoData(StringRef, SMLoc) {
return ParseSectionSwitch(".rodata", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".rodata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC,
SectionKind::getReadOnly());
}
bool ParseSectionDirectiveTData(StringRef, SMLoc) {
return ParseSectionSwitch(".tdata", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".tdata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_TLS | MCSectionELF::SHF_WRITE,
SectionKind::getThreadData());
}
bool ParseSectionDirectiveTBSS(StringRef, SMLoc) {
return ParseSectionSwitch(".tbss", MCSectionELF::SHT_NOBITS,
return ParseSectionSwitch(".tbss", ELF::SHT_NOBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_TLS | MCSectionELF::SHF_WRITE,
SectionKind::getThreadBSS());
}
bool ParseSectionDirectiveDataRel(StringRef, SMLoc) {
return ParseSectionSwitch(".data.rel", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".data.rel", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_WRITE,
SectionKind::getDataRel());
}
bool ParseSectionDirectiveDataRelRo(StringRef, SMLoc) {
return ParseSectionSwitch(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".data.rel.ro", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_WRITE,
SectionKind::getReadOnlyWithRel());
}
bool ParseSectionDirectiveDataRelRoLocal(StringRef, SMLoc) {
return ParseSectionSwitch(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".data.rel.ro.local", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_WRITE,
SectionKind::getReadOnlyWithRelLocal());
}
bool ParseSectionDirectiveEhFrame(StringRef, SMLoc) {
return ParseSectionSwitch(".eh_frame", MCSectionELF::SHT_PROGBITS,
return ParseSectionSwitch(".eh_frame", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::SHF_WRITE,
SectionKind::getDataRel());
@ -322,21 +323,21 @@ bool ELFAsmParser::ParseDirectiveSection(StringRef, SMLoc) {
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in directive");
unsigned Type = MCSectionELF::SHT_PROGBITS;
unsigned Type = ELF::SHT_PROGBITS;
if (!TypeName.empty()) {
if (TypeName == "init_array")
Type = MCSectionELF::SHT_INIT_ARRAY;
Type = ELF::SHT_INIT_ARRAY;
else if (TypeName == "fini_array")
Type = MCSectionELF::SHT_FINI_ARRAY;
Type = ELF::SHT_FINI_ARRAY;
else if (TypeName == "preinit_array")
Type = MCSectionELF::SHT_PREINIT_ARRAY;
Type = ELF::SHT_PREINIT_ARRAY;
else if (TypeName == "nobits")
Type = MCSectionELF::SHT_NOBITS;
Type = ELF::SHT_NOBITS;
else if (TypeName == "progbits")
Type = MCSectionELF::SHT_PROGBITS;
Type = ELF::SHT_PROGBITS;
else if (TypeName == "note")
Type = MCSectionELF::SHT_NOTE;
Type = ELF::SHT_NOTE;
else
return TokError("unknown section type");
}
@ -415,7 +416,7 @@ bool ELFAsmParser::ParseDirectiveIdent(StringRef, SMLoc) {
const MCSection *OldSection = getStreamer().getCurrentSection();
const MCSection *Comment =
getContext().getELFSection(".comment", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".comment", ELF::SHT_PROGBITS,
MCSectionELF::SHF_MERGE |
MCSectionELF::SHF_STRINGS,
SectionKind::getReadOnly(),

View File

@ -11,7 +11,9 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
MCSectionELF::~MCSectionELF() {} // anchor.
@ -84,17 +86,17 @@ void MCSectionELF::PrintSwitchToSection(const MCAsmInfo &MAI,
else
OS << '@';
if (Type == MCSectionELF::SHT_INIT_ARRAY)
if (Type == ELF::SHT_INIT_ARRAY)
OS << "init_array";
else if (Type == MCSectionELF::SHT_FINI_ARRAY)
else if (Type == ELF::SHT_FINI_ARRAY)
OS << "fini_array";
else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
else if (Type == ELF::SHT_PREINIT_ARRAY)
OS << "preinit_array";
else if (Type == MCSectionELF::SHT_NOBITS)
else if (Type == ELF::SHT_NOBITS)
OS << "nobits";
else if (Type == MCSectionELF::SHT_NOTE)
else if (Type == ELF::SHT_NOTE)
OS << "note";
else if (Type == MCSectionELF::SHT_PROGBITS)
else if (Type == ELF::SHT_PROGBITS)
OS << "progbits";
if (EntrySize) {
@ -110,7 +112,7 @@ bool MCSectionELF::UseCodeAlign() const {
}
bool MCSectionELF::isVirtualSection() const {
return getType() == MCSectionELF::SHT_NOBITS;
return getType() == ELF::SHT_NOBITS;
}
// HasCommonSymbols - True if this section holds common symbols, this is

View File

@ -12,6 +12,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
using namespace dwarf;
@ -26,12 +27,12 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
StaticCtorSection =
getContext().getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY,
getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
MCSectionELF::SHF_WRITE |
MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
StaticDtorSection =
getContext().getELFSection(".fini_array", MCSectionELF::SHT_FINI_ARRAY,
getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
MCSectionELF::SHF_WRITE |
MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
@ -39,7 +40,7 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
AttributesSection =
getContext().getELFSection(".ARM.attributes",
MCSectionELF::SHT_ARM_ATTRIBUTES,
ELF::SHT_ARM_ATTRIBUTES,
0,
SectionKind::getMetadata());
}

View File

@ -16,6 +16,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
void MBlazeTargetObjectFile::
@ -23,12 +24,12 @@ Initialize(MCContext &Ctx, const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
SmallDataSection =
getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
SmallBSSSection =
getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getBSS());

View File

@ -16,6 +16,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
static cl::opt<unsigned>
@ -27,12 +28,12 @@ void MipsTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
SmallDataSection =
getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getDataRel());
SmallBSSSection =
getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
SectionKind::getBSS());

View File

@ -14,6 +14,7 @@
#include "SystemZMCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, StringRef TT) {
@ -24,6 +25,6 @@ SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, StringRef TT) {
const MCSection *SystemZMCAsmInfo::
getNonexecutableStackSection(MCContext &Ctx) const{
return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
0, SectionKind::getMetadata());
}

View File

@ -17,6 +17,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
enum AsmWriterFlavorTy {
@ -98,7 +99,7 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) {
const MCSection *X86ELFMCAsmInfo::
getNonexecutableStackSection(MCContext &Ctx) const {
return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
0, SectionKind::getMetadata());
}

View File

@ -12,6 +12,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/ELF.h"
using namespace llvm;
@ -19,28 +20,28 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
DataSection =
Ctx.getELFSection(".dp.data", MCSectionELF::SHT_PROGBITS,
Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionELF::XCORE_SHF_DP_SECTION,
SectionKind::getDataRel());
BSSSection =
Ctx.getELFSection(".dp.bss", MCSectionELF::SHT_NOBITS,
Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
MCSectionELF::XCORE_SHF_DP_SECTION,
SectionKind::getBSS());
MergeableConst4Section =
Ctx.getELFSection(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
Ctx.getELFSection(".cp.rodata.cst4", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst4());
MergeableConst8Section =
Ctx.getELFSection(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
Ctx.getELFSection(".cp.rodata.cst8", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst8());
MergeableConst16Section =
Ctx.getELFSection(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
Ctx.getELFSection(".cp.rodata.cst16", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getMergeableConst16());
@ -52,7 +53,7 @@ void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
TLSBSSSection = BSSSection;
ReadOnlySection =
Ctx.getELFSection(".cp.rodata", MCSectionELF::SHT_PROGBITS,
Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS,
MCSectionELF::SHF_ALLOC |
MCSectionELF::XCORE_SHF_CP_SECTION,
SectionKind::getReadOnlyWithRel());