X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMC%2FMCELFObjectWriter.h;h=01f694d3b75639b3ae575a07dc677f3c694e8860;hb=00552e3875ee5f382db6c98286a241a7d0efe1b8;hp=421e7a0b2c194b55afa03e74e8b5cd89fb3e8591;hpb=76fcace66e918791d00c898d38fea0b44d972aa0;p=oota-llvm.git diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h index 421e7a0b2c1..01f694d3b75 100644 --- a/include/llvm/MC/MCELFObjectWriter.h +++ b/include/llvm/MC/MCELFObjectWriter.h @@ -20,10 +20,21 @@ class MCAssembler; class MCFixup; class MCFragment; class MCObjectWriter; -class MCSectionData; class MCSymbol; -class MCSymbolData; +class MCSymbolELF; class MCValue; +class raw_pwrite_stream; + +struct ELFRelocationEntry { + uint64_t Offset; // Where is the relocation. + const MCSymbolELF *Symbol; // The symbol to relocate with. + unsigned Type; // The type of the relocation. + uint64_t Addend; // The addend to use. + + ELFRelocationEntry(uint64_t Offset, const MCSymbolELF *Symbol, unsigned Type, + uint64_t Addend) + : Offset(Offset), Symbol(Symbol), Type(Type), Addend(Addend) {} +}; class MCELFObjectTargetWriter { const uint8_t OSABI; @@ -41,6 +52,9 @@ protected: public: static uint8_t getOSABI(Triple::OSType OSType) { switch (OSType) { + case Triple::CloudABI: + return ELF::ELFOSABI_CLOUDABI; + case Triple::PS4: case Triple::FreeBSD: return ELF::ELFOSABI_FREEBSD; case Triple::Linux: @@ -55,10 +69,13 @@ public: virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup, bool IsPCRel) const = 0; - virtual bool needsRelocateWithSymbol(const MCSymbolData &SD, + virtual bool needsRelocateWithSymbol(const MCSymbol &Sym, unsigned Type) const; - /// @name Accessors + virtual void sortRelocs(const MCAssembler &Asm, + std::vector &Relocs); + + /// \name Accessors /// @{ uint8_t getOSABI() const { return OSABI; } uint16_t getEMachine() const { return EMachine; } @@ -113,7 +130,8 @@ public: /// \param OS - The stream to write to. /// \returns The constructed object writer. MCObjectWriter *createELFObjectWriter(MCELFObjectTargetWriter *MOTW, - raw_ostream &OS, bool IsLittleEndian); + raw_pwrite_stream &OS, + bool IsLittleEndian); } // End llvm namespace #endif