[lld] [LLD][COFF] Add support for CHPE code ranges metadata. (PR #105741)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 23 00:38:16 PDT 2024
================
@@ -1078,6 +1078,22 @@ void ECExportThunkChunk::writeTo(uint8_t *buf) const {
write32le(buf + 10, target->getRVA() - rva - 14);
}
+size_t CHPECodeRangesChunk::getSize() const {
+ return exportThunks.size() * sizeof(chpe_code_range_entry);
+}
+
+void CHPECodeRangesChunk::writeTo(uint8_t *buf) const {
+ auto ranges = reinterpret_cast<chpe_code_range_entry *>(buf);
+
+ for (uint32_t i = 0; i < exportThunks.size(); i++) {
+ Chunk *thunk = exportThunks[i].first;
+ uint32_t start = thunk->getRVA();
+ ranges[i].StartRva = start;
+ ranges[i].EndRva = start + thunk->getSize();
+ ranges[i].EntryPoint = start;
----------------
mstorsjo wrote:
So this is a similar list as #105739, with the same start RVAs, but containing the size and not the destination? And the `EntryPoint` value seems pointless at this point, I presume it will seem more useful after some more future patches.
(I.e. I'm not questioning this patch, I'm questioning the usefulness of this data structure - but I guess it makes more sense when more complete.)
https://github.com/llvm/llvm-project/pull/105741
More information about the llvm-commits
mailing list