[llvm-commits] [llvm] r124054 - in /llvm/trunk: 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

Rafael Espindola rafael.espindola at gmail.com
Sat Jan 22 20:28:49 PST 2011


Author: rafael
Date: Sat Jan 22 22:28:49 2011
New Revision: 124054

URL: http://llvm.org/viewvc/llvm-project?rev=124054&view=rev
Log:
Remove duplicated code.

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

Modified: llvm/trunk/include/llvm/MC/MCSectionELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionELF.h?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionELF.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionELF.h Sat Jan 22 22:28:49 2011
@@ -59,79 +59,6 @@
   /// 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.

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   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 @@
   // 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 @@
 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 @@
 
 
     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,

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
 
 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;
 }

Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Sat Jan 22 22:28:49 2011
@@ -155,19 +155,19 @@
   }
 
   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 @@
 
   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());

Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   // 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 @@
   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 @@
 
   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(),

Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   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::isVirtualSection() const {
-  return getType() == MCSectionELF::SHT_NOBITS;
+  return getType() == ELF::SHT_NOBITS;
 }
 
 // HasCommonSymbols - True if this section holds common symbols, this is

Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
 
   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 @@
   
   AttributesSection =
     getContext().getELFSection(".ARM.attributes",
-                               MCSectionELF::SHT_ARM_ATTRIBUTES,
+                               ELF::SHT_ARM_ATTRIBUTES,
                                0,
                                SectionKind::getMetadata());
 }

Modified: llvm/trunk/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   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());
 

Modified: llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   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());
 

Modified: llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZMCAsmInfo.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
 
 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());
 }

Modified: llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCAsmInfo.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
 
 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());
 }
 

Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=124054&r1=124053&r2=124054&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Sat Jan 22 22:28:49 2011
@@ -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 @@
   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 @@
   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());





More information about the llvm-commits mailing list