}
// Returns the location of the build-id hash value in the output.
-template <class ELFT>
-uint8_t *BuildIdSection<ELFT>::getOutputLoc(uint8_t *Start) {
- return Start + this->OutSec->Offset + this->OutSecOff + HeaderSize;
+template <class ELFT> size_t BuildIdSection<ELFT>::getOutputOffset() {
+ return this->OutSec->Offset + this->OutSecOff + HeaderSize;
}
template <class ELFT> size_t BuildIdSection<ELFT>::getHashSize() {
else
std::for_each(Chunks.begin(), Chunks.end(), Fn);
- HashFn(HashList, getOutputLoc(Data.begin()));
+ HashFn(HashList, Data.data() + getOutputOffset());
}
template <class ELFT>
});
break;
case BuildIdKind::Uuid:
- if (getRandomBytes(getOutputLoc(Buf.data()), HashSize))
+ if (getRandomBytes(Buf.data() + getOutputOffset(), HashSize))
error("entropy source failure");
break;
case BuildIdKind::Hexstring:
- memcpy(this->getOutputLoc(Buf.data()), Config->BuildIdVector.data(),
+ memcpy(Buf.data() + getOutputOffset(), Config->BuildIdVector.data(),
Config->BuildIdVector.size());
break;
default:
static const unsigned HeaderSize = 16;
size_t getHashSize();
- uint8_t *getOutputLoc(uint8_t *Start);
+ size_t getOutputOffset();
void
computeHash(llvm::MutableArrayRef<uint8_t> Buf,