From 1afa4907f59663d91e4734aaddfc2722a61913d5 Mon Sep 17 00:00:00 2001 From: Khomutov Nikita Date: Mon, 8 Apr 2024 14:45:27 +0300 Subject: [PATCH] [ADLT] write overall mapped size to .adlt Signed-off-by: Khomutov Nikita Change-Id: I193b751098295e45502b1e4a64b063361a52d58b Signed-off-by: Khomutov Nikita --- lld/ELF/ADLTSection.h | 1 + lld/ELF/SyntheticSections.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lld/ELF/ADLTSection.h b/lld/ELF/ADLTSection.h index b4ba5966741d..3441ddb8af29 100644 --- a/lld/ELF/ADLTSection.h +++ b/lld/ELF/ADLTSection.h @@ -102,6 +102,7 @@ typedef struct { adlt_hash_type_t stringHashType; // contains adlt_hash_type_enum_t value Elf64_Off blobStart; // offset of binary blob start relative to .adlt Elf64_Xword blobSize; + Elf64_Xword overallMappedSize; // bytes, required to map the whole ADLT image } adlt_section_header_t; static const char adltBlobStartMark[4] = { 0xA, 0xD, 0x1, 0x7 }; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 6ac5296c1530..8f51cc9600a6 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -4020,8 +4020,8 @@ static_assert(sizeof(adltBlobStartMark) == 4, "0xad17 consist of 4 bytes" ); -static_assert(sizeof(adlt_section_header_t) == 32, - "please udpate major version if header has been changed" +static_assert(sizeof(adlt_section_header_t) == 40, + "please udpate version if header has been changed" ); static_assert(sizeof(adlt_psod_t) == 128, @@ -4058,8 +4058,11 @@ void AdltSection::finalizeContents() { ADLT_HASH_TYPE_GNU_HASH, // .stringHashType getBlobStartOffset(), // .blobStart estimateBlobSize(), // .blobSize + 0, // .overallMappedSize }; + // TODO: estimate and fill overallMappedSize + buildSonameIndex(); linkInternalDtNeeded(); extractInitFiniArray(); -- Gitee