Move PPC bits to lib/Target/PowerPC.
[oota-llvm.git] / lib / MC / ELFObjectWriter.h
index ca6cdfc5ce1544c4eb181bed16a7dcf91072f545..6516fb587c89e0b29b1d831dd892a36d7e17dafa 100644 (file)
@@ -152,7 +152,7 @@ class ELFObjectWriter : public MCObjectWriter {
                                            const MCFragment &F,
                                            const MCFixup &Fixup,
                                            bool IsPCRel) const {
-      return NULL;
+      return TargetObjectWriter->ExplicitRelSym(Asm, Target, F, Fixup, IsPCRel);
     }
 
     bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
@@ -243,8 +243,9 @@ class ELFObjectWriter : public MCObjectWriter {
     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,
@@ -351,71 +352,7 @@ class ELFObjectWriter : public MCObjectWriter {
   protected:
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend) = 0;
-    virtual void adjustFixupOffset(const MCFixup &Fixup,
-                                   uint64_t &RelocOffset) {}
-  };
-
-  //===- X86ELFObjectWriter -------------------------------------------===//
-
-  class X86ELFObjectWriter : public ELFObjectWriter {
-  public:
-    X86ELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                       raw_ostream &_OS,
-                       bool IsLittleEndian);
-
-    virtual ~X86ELFObjectWriter();
-  protected:
-    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
-                                  bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
-  };
-
-
-  //===- ARMELFObjectWriter -------------------------------------------===//
-
-  class ARMELFObjectWriter : public ELFObjectWriter {
-  public:
-    // FIXME: MCAssembler can't yet return the Subtarget,
-    enum { DefaultEABIVersion = 0x05000000U };
-
-    ARMELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                       raw_ostream &_OS,
-                       bool IsLittleEndian);
-
-    virtual ~ARMELFObjectWriter();
-
-    virtual void WriteEFlags();
-  protected:
-    virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
-                                           const MCValue &Target,
-                                           const MCFragment &F,
-                                           const MCFixup &Fixup,
-                                           bool IsPCRel) const;
-
-    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
-                                  bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
-  private:
-    unsigned GetRelocTypeInner(const MCValue &Target,
-                               const MCFixup &Fixup, bool IsPCRel) const;
-    
-  };
-
-  //===- PPCELFObjectWriter -------------------------------------------===//
-
-  class PPCELFObjectWriter : public ELFObjectWriter {
-  public:
-    PPCELFObjectWriter(MCELFObjectTargetWriter *MOTW,
-                          raw_ostream &_OS,
-                          bool IsLittleEndian);
-
-    virtual ~PPCELFObjectWriter();
-  protected:
-    virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
-                                  bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
-    virtual void adjustFixupOffset(const MCFixup &Fixup, uint64_t &RelocOffset);
+                                  int64_t Addend) const;
   };
 
   //===- MBlazeELFObjectWriter -------------------------------------------===//
@@ -430,7 +367,7 @@ class ELFObjectWriter : public MCObjectWriter {
   protected:
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
+                                  int64_t Addend) const;
   };
 
   //===- MipsELFObjectWriter -------------------------------------------===//
@@ -442,10 +379,18 @@ class ELFObjectWriter : public MCObjectWriter {
                         bool IsLittleEndian);
 
     virtual ~MipsELFObjectWriter();
+    virtual unsigned getEFlags() const;
+
   protected:
+    virtual const MCSymbol *ExplicitRelSym(const MCAssembler &Asm,
+                                           const MCValue &Target,
+                                           const MCFragment &F,
+                                           const MCFixup &Fixup,
+                                           bool IsPCRel) const;
+
     virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
                                   bool IsPCRel, bool IsRelocWithSymbol,
-                                  int64_t Addend);
+                                  int64_t Addend) const;
   };
 }