Remove duplicated code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124054 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMTargetObjectFile.cpp b/lib/Target/ARM/ARMTargetObjectFile.cpp
index f967b4d..163971f 100644
--- a/lib/Target/ARM/ARMTargetObjectFile.cpp
+++ b/lib/Target/ARM/ARMTargetObjectFile.cpp
@@ -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());
 }
diff --git a/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp b/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
index 05c01ef..a9c152d 100644
--- a/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
+++ b/lib/Target/MBlaze/MBlazeTargetObjectFile.cpp
@@ -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());
 
diff --git a/lib/Target/Mips/MipsTargetObjectFile.cpp b/lib/Target/Mips/MipsTargetObjectFile.cpp
index c394d73..07a130b 100644
--- a/lib/Target/Mips/MipsTargetObjectFile.cpp
+++ b/lib/Target/Mips/MipsTargetObjectFile.cpp
@@ -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());
 
diff --git a/lib/Target/SystemZ/SystemZMCAsmInfo.cpp b/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
index e2ae79d..2dc7e7b 100644
--- a/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
+++ b/lib/Target/SystemZ/SystemZMCAsmInfo.cpp
@@ -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());
 }
diff --git a/lib/Target/X86/X86MCAsmInfo.cpp b/lib/Target/X86/X86MCAsmInfo.cpp
index e55edfe..6686214 100644
--- a/lib/Target/X86/X86MCAsmInfo.cpp
+++ b/lib/Target/X86/X86MCAsmInfo.cpp
@@ -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());
 }
 
diff --git a/lib/Target/XCore/XCoreTargetObjectFile.cpp b/lib/Target/XCore/XCoreTargetObjectFile.cpp
index f5f90ce..faf61c9 100644
--- a/lib/Target/XCore/XCoreTargetObjectFile.cpp
+++ b/lib/Target/XCore/XCoreTargetObjectFile.cpp
@@ -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());