diff options
Diffstat (limited to 'tools/llvm-objcopy/Object.cpp')
| -rw-r--r-- | tools/llvm-objcopy/Object.cpp | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/tools/llvm-objcopy/Object.cpp b/tools/llvm-objcopy/Object.cpp index bd5bcd7fc188..d5dfcac40e4e 100644 --- a/tools/llvm-objcopy/Object.cpp +++ b/tools/llvm-objcopy/Object.cpp @@ -81,6 +81,11 @@ void Section::writeSection(FileOutputBuffer &Out) const {    std::copy(std::begin(Contents), std::end(Contents), Buf);  } +void OwnedDataSection::writeSection(FileOutputBuffer &Out) const { +  uint8_t *Buf = Out.getBufferStart() + Offset; +  std::copy(std::begin(Data), std::end(Data), Buf); +} +  void StringTableSection::addString(StringRef Name) {    StrTabBuilder.add(Name);    Size = StrTabBuilder.getSize(); @@ -676,6 +681,13 @@ void Object<ELFT>::removeSections(    Sections.erase(Iter, std::end(Sections));  } +template <class ELFT> +void Object<ELFT>::addSection(StringRef SecName, ArrayRef<uint8_t> Data) { +  auto Sec = llvm::make_unique<OwnedDataSection>(SecName, Data); +  Sec->OriginalOffset = ~0ULL; +  Sections.push_back(std::move(Sec)); +} +  template <class ELFT> void ELFObject<ELFT>::sortSections() {    // Put all sections in offset order. Maintain the ordering as closely as    // possible while meeting that demand however. | 
