Remove duplicated code.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 23 Jan 2011 04:28:49 +0000 (04:28 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 23 Jan 2011 04:28:49 +0000 (04:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124054 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/MC/MCSectionELF.h
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/MC/MCContext.cpp
lib/MC/MCELFStreamer.cpp
lib/MC/MCParser/ELFAsmParser.cpp
lib/MC/MCSectionELF.cpp
lib/Target/ARM/ARMTargetObjectFile.cpp
lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
lib/Target/Mips/MipsTargetObjectFile.cpp
lib/Target/SystemZ/SystemZMCAsmInfo.cpp
lib/Target/X86/X86MCAsmInfo.cpp
lib/Target/XCore/XCoreTargetObjectFile.cpp

index 9463356db2bf955a16f863347b3851d211c069a8..bf03fd45eb3ef9f4dccfbd77a68671bf5c28c2e7 100644 (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.
index abc01a28776f26124458dc0544b3f3ea9dd33b62..a6ef893b87b2c437c5898367d2799e7c69f8679e 100644 (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,
index 839c08d8a26875ada0889a18094433c4625ce778..018f00c08f6f9eae24d263ebc356bc691e25a25f 100644 (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;
 }
index 23698212044615dd831a3dc7dd307687f71221d1..1c89b5655e3ce28580b943c35c416dced811de80 100644 (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());
index 0456b4bac4c33dd0ad27d3bf7ad189594856ff11..a3bd1d7dfb487e6004d250da61b1e0139644946f 100644 (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(),
index a53489790d28c3143149c4292803fbe30b7b3a4d..4a44f5a9067fb7bea251702db2ce96de88e6beeb 100644 (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
index f967b4d21ead235a975ee3c943868ed9d659c9de..163971f96fefa5b0d8f60e0d4dd74d72cd8fef83 100644 (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());
 }
index 05c01ef7a5d9b40bce059421bff5d0df46da2930..a9c152dc95c468e0f1cee6218162da58200355c5 100644 (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());
 
index c394d738defbc849a5bef2d25a094715f3eac6bc..07a130ba055429e78e1b48fb1677223e603bf12a 100644 (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());
 
index e2ae79d59ea72f4fa250b2a53e04207b98816c78..2dc7e7bd29bb577cf0269d1f65c63ff1851f3da8 100644 (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());
 }
index e55edfebf7800835cdbdf1cc4bccbc0d8b3f59ea..6686214e06f57f134b8e3e269ab09d832be5bbdb 100644 (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());
 }
 
index f5f90ce5a9fd19a2480a7cdaa0e6e4db837328d5..faf61c95256b68d2b3f206a3e7708befd46e5e0f 100644 (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());