mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 20:00:11 +08:00
Compact SectionPiece.
It is pretty easy to get the data from the InputSection, so we don't have to store it. This opens the way for storing the hash instead. llvm-svn: 283357
This commit is contained in:
@@ -28,6 +28,10 @@ using namespace llvm::support::endian;
|
||||
using namespace lld;
|
||||
using namespace lld::elf;
|
||||
|
||||
ArrayRef<uint8_t> InputSectionData::getData(const SectionPiece &P) const {
|
||||
return Data.slice(P.InputOff, P.size());
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
static ArrayRef<uint8_t> getSectionContents(elf::ObjectFile<ELFT> *File,
|
||||
const typename ELFT::Shdr *Hdr) {
|
||||
@@ -638,7 +642,7 @@ template <class ELFT> void MergeInputSection<ELFT>::finalizePieces() {
|
||||
if (Piece.OutputOff == size_t(-1)) {
|
||||
// Offsets of tail-merged strings are computed lazily.
|
||||
auto *OutSec = static_cast<MergeOutputSection<ELFT> *>(this->OutSec);
|
||||
ArrayRef<uint8_t> D = Piece.data();
|
||||
ArrayRef<uint8_t> D = this->getData(Piece);
|
||||
StringRef S((const char *)D.data(), D.size());
|
||||
Piece.OutputOff = OutSec->getOffset(S);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user