diff options
| author | Jake Ehrlich <jakehehrlich@google.com> | 2017-12-19 00:47:30 +0000 | 
|---|---|---|
| committer | Jake Ehrlich <jakehehrlich@google.com> | 2017-12-19 00:47:30 +0000 | 
| commit | e8437de727ed208cc4a8b7b36b6165dca89fafcb (patch) | |
| tree | 49925acbe0c18e22f600ec664772aa06bc11615f /llvm/tools/llvm-objcopy/Object.h | |
| parent | e29c0b88628c0f353d2fa1423525fe4acbd7ad67 (diff) | |
| download | bcm5719-llvm-e8437de727ed208cc4a8b7b36b6165dca89fafcb.tar.gz bcm5719-llvm-e8437de727ed208cc4a8b7b36b6165dca89fafcb.zip  | |
[llvm-objcopy] Add option to add a progbits section from a file
This change adds support for adding progbits sections with contents from a file
Differential Revision: https://reviews.llvm.org/D41212
llvm-svn: 321047
Diffstat (limited to 'llvm/tools/llvm-objcopy/Object.h')
| -rw-r--r-- | llvm/tools/llvm-objcopy/Object.h | 15 | 
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/Object.h b/llvm/tools/llvm-objcopy/Object.h index 9f98c04ad9b..b04b0c1a641 100644 --- a/llvm/tools/llvm-objcopy/Object.h +++ b/llvm/tools/llvm-objcopy/Object.h @@ -126,6 +126,20 @@ public:    void writeSection(FileOutputBuffer &Out) const override;  }; +class OwnedDataSection : public SectionBase { +private: +  std::vector<uint8_t> Data; + +public: +  OwnedDataSection(StringRef SecName, ArrayRef<uint8_t> Data) +      : Data(std::begin(Data), std::end(Data)) { +    Name = SecName; +    Type = ELF::SHT_PROGBITS; +    Size = Data.size(); +  } +  void writeSection(FileOutputBuffer &Out) const override; +}; +  // There are two types of string tables that can exist, dynamic and not dynamic.  // In the dynamic case the string table is allocated. Changing a dynamic string  // table would mean altering virtual addresses and thus the memory image. So @@ -372,6 +386,7 @@ public:    const SymbolTableSection *getSymTab() const { return SymbolTable; }    const SectionBase *getSectionHeaderStrTab() const { return SectionNames; }    void removeSections(std::function<bool(const SectionBase &)> ToRemove); +  void addSection(StringRef SecName, ArrayRef<uint8_t> Data);    virtual size_t totalSize() const = 0;    virtual void finalize() = 0;    virtual void write(FileOutputBuffer &Out) const = 0;  | 

