X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FELFObjectWriter.h;h=6516fb587c89e0b29b1d831dd892a36d7e17dafa;hb=f3a86fb03d196994dc7923351f15d8ed9343013e;hp=862b085c76bf2b34ef932bb706c1c08535211575;hpb=291512f96fe807da7c1a3a6e001feb1017b56e26;p=oota-llvm.git diff --git a/lib/MC/ELFObjectWriter.h b/lib/MC/ELFObjectWriter.h index 862b085c76b..6516fb587c8 100644 --- a/lib/MC/ELFObjectWriter.h +++ b/lib/MC/ELFObjectWriter.h @@ -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(); } @@ -240,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 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 GroupMapTy; @@ -346,70 +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 -------------------------------------------===// @@ -424,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 -------------------------------------------===// @@ -436,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; }; }