diff --git a/llvm/tools/llvm-objcopy/ELF/Object.h b/llvm/tools/llvm-objcopy/ELF/Object.h --- a/llvm/tools/llvm-objcopy/ELF/Object.h +++ b/llvm/tools/llvm-objcopy/ELF/Object.h @@ -310,10 +310,6 @@ uint32_t Index; uint64_t OriginalOffset; Segment *ParentSegment = nullptr; - ArrayRef Contents; - - explicit Segment(ArrayRef Data) : Contents(Data) {} - Segment() {} const SectionBase *firstSection() const { if (!Sections.empty()) @@ -823,8 +819,8 @@ Ptr->Index = Sections.size(); return *Ptr; } - Segment &addSegment(ArrayRef Data) { - Segments.emplace_back(llvm::make_unique(Data)); + Segment &addSegment() { + Segments.emplace_back(llvm::make_unique()); return *Segments.back(); } }; diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -886,9 +886,7 @@ template void ELFBuilder::readProgramHeaders() { uint32_t Index = 0; for (const auto &Phdr : unwrapOrError(ElfFile.program_headers())) { - ArrayRef Data{ElfFile.base() + Phdr.p_offset, - (size_t)Phdr.p_filesz}; - Segment &Seg = Obj.addSegment(Data); + Segment &Seg = Obj.addSegment(); Seg.Type = Phdr.p_type; Seg.Flags = Phdr.p_flags; Seg.OriginalOffset = Phdr.p_offset;