From 35fdbd56b7765e2329ca1edfe48ded65029e53bf Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Tue, 1 Aug 2017 05:31:50 +0000 Subject: Revert "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy" The change seems to be failing on bots which are using gcc and bfd.ld as a host compiler and linker. This reverts commit r309658. llvm-svn: 309660 --- llvm/tools/llvm-objcopy/Object.h | 55 +++++++--------------------------------- 1 file changed, 9 insertions(+), 46 deletions(-) (limited to 'llvm/tools/llvm-objcopy/Object.h') diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h index b505e60b382..d743efbde65 100644 --- a/llvm/tools/llvm-objcopy/Object.h +++ b/llvm/tools/llvm-objcopy/Object.h @@ -58,7 +58,6 @@ private: }; std::set Sections; - llvm::ArrayRef Contents; public: uint64_t Align; @@ -71,7 +70,6 @@ public: uint64_t Type; uint64_t VAddr; - Segment(llvm::ArrayRef Data) : Contents(Data) {} void finalize(); const SectionBase *firstSection() const { if (!Sections.empty()) @@ -80,7 +78,6 @@ public: } void addSection(const SectionBase *sec) { Sections.insert(sec); } template void writeHeader(llvm::FileOutputBuffer &Out) const; - void writeSegment(llvm::FileOutputBuffer &Out) const; }; class Section : public SectionBase { @@ -120,16 +117,16 @@ private: typedef typename ELFT::Ehdr Elf_Ehdr; typedef typename ELFT::Phdr Elf_Phdr; - SecPtr makeSection(const llvm::object::ELFFile &ElfFile, - const Elf_Shdr &Shdr); - void readProgramHeaders(const llvm::object::ELFFile &ElfFile); - void readSectionHeaders(const llvm::object::ELFFile &ElfFile); - -protected: StringTableSection *SectionNames; std::vector Sections; std::vector Segments; + void sortSections(); + void assignOffsets(); + SecPtr makeSection(const llvm::object::ELFFile &ElfFile, + const Elf_Shdr &Shdr); + void readProgramHeaders(const llvm::object::ELFFile &ElfFile); + void readSectionHeaders(const llvm::object::ELFFile &ElfFile); void writeHeader(llvm::FileOutputBuffer &Out) const; void writeProgramHeaders(llvm::FileOutputBuffer &Out) const; void writeSectionData(llvm::FileOutputBuffer &Out) const; @@ -145,43 +142,9 @@ public: uint32_t Flags; Object(const llvm::object::ELFObjectFile &Obj); - virtual size_t totalSize() const = 0; - virtual void finalize() = 0; - virtual void write(llvm::FileOutputBuffer &Out) const = 0; - virtual ~Object() = default; -}; - -template class ELFObject : public Object { -private: - typedef std::unique_ptr SecPtr; - typedef std::unique_ptr SegPtr; - - typedef typename ELFT::Shdr Elf_Shdr; - typedef typename ELFT::Ehdr Elf_Ehdr; - typedef typename ELFT::Phdr Elf_Phdr; - - void sortSections(); - void assignOffsets(); - -public: - ELFObject(const llvm::object::ELFObjectFile &Obj) : Object(Obj) {} - void finalize() override; - size_t totalSize() const override; - void write(llvm::FileOutputBuffer &Out) const override; + size_t totalSize() const; + void finalize(); + void write(llvm::FileOutputBuffer &Out); }; -template class BinaryObject : public Object { -private: - typedef std::unique_ptr SecPtr; - typedef std::unique_ptr SegPtr; - - uint64_t TotalSize; - -public: - BinaryObject(const llvm::object::ELFObjectFile &Obj) - : Object(Obj) {} - void finalize() override; - size_t totalSize() const override; - void write(llvm::FileOutputBuffer &Out) const override; -}; #endif -- cgit v1.2.3