//===- Chunks.cpp ---------------------------------------------------------===// // // The LLVM Linker // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #include "Chunks.h" #include "Error.h" #include "InputFiles.h" using namespace llvm; using namespace llvm::ELF; using namespace lld; using namespace lld::elf2; template SectionChunk::SectionChunk(ObjectFile *F, const Elf_Shdr *Header) : File(F), Header(Header) {} template void SectionChunk::writeTo(uint8_t *Buf) { if (Header->sh_type == SHT_NOBITS) return; // Copy section contents from source object file to output file. ArrayRef Data = *File->getObj()->getSectionContents(Header); memcpy(Buf + OutputSectionOff, Data.data(), Data.size()); } template StringRef SectionChunk::getSectionName() const { ErrorOr Name = File->getObj()->getSectionName(Header); error(Name); return *Name; } namespace lld { namespace elf2 { template class SectionChunk; template class SectionChunk; template class SectionChunk; template class SectionChunk; } }