Move PPC bits to lib/Target/PowerPC.
[oota-llvm.git] / lib / MC / ELFObjectWriter.h
index f1d514a899880aa7231dbdedf24c7204d6fd9ff4..6516fb587c89e0b29b1d831dd892a36d7e17dafa 100644 (file)
@@ -140,16 +140,19 @@ class ELFObjectWriter : public MCObjectWriter {
     unsigned ShstrtabIndex;
 
 
-    const MCSymbol *SymbolToReloc(const MCAssembler &Asm,
-                                  const MCValue &Target,
-                                  const MCFragment &F) const;
+    virtual const MCSymbol *SymbolToReloc(const MCAssembler &Asm,
+                                          const MCValue &Target,
+                                          const MCFragment &F,
+                                          const MCFixup &Fixup,
+                                          bool IsPCRel) const;
 
     // For arch-specific emission of explicit reloc symbol
     virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
                                            const MCValue &Target,
                                            const MCFragment &F,
-                                           bool IsBSS) const {
-      return NULL;
+                                           const MCFixup &Fixup,
+                                           bool IsPCRel) const {
+      return TargetObjectWriter->ExplicitRelSym(Asm, Target, F, Fixup, IsPCRel);
     }
 
     bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
@@ -237,33 +240,39 @@ class ELFObjectWriter : public MCObjectWriter {
       F.getContents() += StringRef(buf, 8);
     }
 
-    virtual void WriteHeader(uint64_t SectionDataSize, unsigned NumberOfSections);
+    virtual void WriteHeader(uint64_t SectionDataSize,
+                             unsigned NumberOfSections);
 
-    /// Default e_flags = 0
-    virtual void WriteEFlags() { Write32(0); }
+    virtual unsigned getEFlags() const {
+      return TargetObjectWriter->getEFlags();
+    }
 
-    virtual void WriteSymbolEntry(MCDataFragment *SymtabF, MCDataFragment *ShndxF,
-                          uint64_t name, uint8_t info,
-                          uint64_t value, uint64_t size,
-                          uint8_t other, uint32_t shndx,
-                          bool Reserved);
+    virtual void WriteSymbolEntry(MCDataFragment *SymtabF,
+                                  MCDataFragment *ShndxF,
+                                  uint64_t name, uint8_t info,
+                                  uint64_t value, uint64_t size,
+                                  uint8_t other, uint32_t shndx,
+                                  bool Reserved);
 
     virtual void WriteSymbol(MCDataFragment *SymtabF,  MCDataFragment *ShndxF,
                      ELFSymbolData &MSD,
                      const MCAsmLayout &Layout);
 
     typedef DenseMap<const MCSectionELF*, uint32_t> SectionIndexMapTy;
-    virtual void WriteSymbolTable(MCDataFragment *SymtabF, MCDataFragment *ShndxF,
-                          const MCAssembler &Asm,
-                          const MCAsmLayout &Layout,
-                          const SectionIndexMapTy &SectionIndexMap);
-
-    virtual void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
-                                  const MCFragment *Fragment, const MCFixup &Fixup,
+    virtual void WriteSymbolTable(MCDataFragment *SymtabF,
+                                  MCDataFragment *ShndxF,
+                                  const MCAssembler &Asm,
+                                  const MCAsmLayout &Layout,
+                                  const SectionIndexMapTy &SectionIndexMap);
+
+    virtual void RecordRelocation(const MCAssembler &Asm,
+                                  const MCAsmLayout &Layout,
+                                  const MCFragment *Fragment,
+                                  const MCFixup &Fixup,
                                   MCValue Target, uint64_t &FixedValue);
 
     virtual uint64_t getSymbolIndexInSymbolTable(const MCAssembler &Asm,
-                                         const MCSymbol *S);
+                                                 const MCSymbol *S);
 
     // Map from a group section to the signature symbol
     typedef DenseMap<const MCSectionELF*, const MCSymbol*> GroupMapTy;
@@ -343,63 +352,45 @@ class ELFObjectWriter : public MCObjectWriter {
   protected:
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend) = 0;
+                                  int64_t Addend) const;
   };
 
-  //===- X86ELFObjectWriter -------------------------------------------===//
+  //===- MBlazeELFObjectWriter -------------------------------------------===//
 
-  class X86ELFObjectWriter : public ELFObjectWriter {
+  class MBlazeELFObjectWriter : public ELFObjectWriter {
   public:
-    X86ELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                       raw_ostream &_OS,
-                       bool IsLittleEndian);
+    MBlazeELFObjectWriter(MCELFObjectTargetWriter *MOTW,
+                          raw_ostream &_OS,
+                          bool IsLittleEndian);
 
-    virtual ~X86ELFObjectWriter();
+    virtual ~MBlazeELFObjectWriter();
   protected:
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
+                                  int64_t Addend) const;
   };
 
+  //===- MipsELFObjectWriter -------------------------------------------===//
 
-  //===- ARMELFObjectWriter -------------------------------------------===//
-
-  class ARMELFObjectWriter : public ELFObjectWriter {
+  class MipsELFObjectWriter : public ELFObjectWriter {
   public:
-    // FIXME: MCAssembler can't yet return the Subtarget,
-    enum { DefaultEABIVersion = 0x05000000U };
-
-    ARMELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                       raw_ostream &_OS,
-                       bool IsLittleEndian);
+    MipsELFObjectWriter(MCELFObjectTargetWriter *MOTW,
+                        raw_ostream &_OS,
+                        bool IsLittleEndian);
 
-    virtual ~ARMELFObjectWriter();
+    virtual ~MipsELFObjectWriter();
+    virtual unsigned getEFlags() const;
 
-    virtual void WriteEFlags();
   protected:
     virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
                                            const MCValue &Target,
                                            const MCFragment &F,
-                                           bool IsBSS) const;
-
-    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
-                                  bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
-  };
-
-  //===- MBlazeELFObjectWriter -------------------------------------------===//
-
-  class MBlazeELFObjectWriter : public ELFObjectWriter {
-  public:
-    MBlazeELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                          raw_ostream &_OS,
-                          bool IsLittleEndian);
+                                           const MCFixup &Fixup,
+                                           bool IsPCRel) const;
 
-    virtual ~MBlazeELFObjectWriter();
-  protected:
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
+                                  int64_t Addend) const;
   };
 }