Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
[oota-llvm.git] / include / llvm / MC / MCELFObjectWriter.h
index 9763635b11e92c98c877eeacbb712f28d55c63d2..01f694d3b75639b3ae575a07dc677f3c694e8860 100644 (file)
@@ -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,8 @@ 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;
@@ -56,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<ELFRelocationEntry> &Relocs);
+
+  /// \name Accessors
   /// @{
   uint8_t getOSABI() const { return OSABI; }
   uint16_t getEMachine() const { return EMachine; }
@@ -114,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