aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELF.cpp
diff options
context:
space:
mode:
authorRahman Lavaee <rahmanl@google.com>2025-07-02 10:31:52 -0700
committerGitHub <noreply@github.com>2025-07-02 10:31:52 -0700
commit6b623a6622707ea47d84ab0069f766215a6fec44 (patch)
tree46f36c2080a22c6d2d30d0990b8b8acf8124c68c /llvm/lib/Object/ELF.cpp
parentcbfc10260cfeab7ede763bffad4c71d9ae20abd2 (diff)
downloadllvm-6b623a6622707ea47d84ab0069f766215a6fec44.zip
llvm-6b623a6622707ea47d84ab0069f766215a6fec44.tar.gz
llvm-6b623a6622707ea47d84ab0069f766215a6fec44.tar.bz2
[SHT_LLVM_BB_ADDR_MAP] Remove support for versions 1 and 0 (SHT_LLVM_BB_ADDR_MAP_V0). (#146186)
Version 2 was added more than two years ago (https://github.com/llvm/llvm-project/commit/6015a045d768feab3bae9ad9c0c81e118df8b04a). So it should be safe to deprecate older versions.
Diffstat (limited to 'llvm/lib/Object/ELF.cpp')
-rw-r--r--llvm/lib/Object/ELF.cpp46
1 files changed, 18 insertions, 28 deletions
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index 6ee33d9..1d9fd6b 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -317,7 +317,6 @@ StringRef llvm::object::getELFSectionTypeName(uint32_t Machine, unsigned Type) {
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_SYMPART);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_PART_EHDR);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_PART_PHDR);
- STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_BB_ADDR_MAP_V0);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_BB_ADDR_MAP);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_OFFLOADING);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_LTO);
@@ -833,33 +832,24 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
BBAddrMap::Features FeatEnable{};
while (!ULEBSizeErr && !MetadataDecodeErr && Cur &&
Cur.tell() < Content.size()) {
- if (Sec.sh_type == ELF::SHT_LLVM_BB_ADDR_MAP) {
- Version = Data.getU8(Cur);
- if (!Cur)
- break;
- if (Version > 3)
- return createError("unsupported SHT_LLVM_BB_ADDR_MAP version: " +
- Twine(static_cast<int>(Version)));
- Feature = Data.getU8(Cur); // Feature byte
- if (!Cur)
- break;
- auto FeatEnableOrErr = BBAddrMap::Features::decode(Feature);
- if (!FeatEnableOrErr)
- return FeatEnableOrErr.takeError();
- FeatEnable = *FeatEnableOrErr;
- if (FeatEnable.hasPGOAnalysis() && Version < 2)
- return createError(
- "version should be >= 2 for SHT_LLVM_BB_ADDR_MAP when "
- "PGO features are enabled: version = " +
- Twine(static_cast<int>(Version)) +
- " feature = " + Twine(static_cast<int>(Feature)));
- if (FeatEnable.CallsiteOffsets && Version < 3)
- return createError(
- "version should be >= 3 for SHT_LLVM_BB_ADDR_MAP when "
- "callsite offsets feature is enabled: version = " +
- Twine(static_cast<int>(Version)) +
- " feature = " + Twine(static_cast<int>(Feature)));
- }
+ Version = Data.getU8(Cur);
+ if (!Cur)
+ break;
+ if (Version < 2 || Version > 3)
+ return createError("unsupported SHT_LLVM_BB_ADDR_MAP version: " +
+ Twine(static_cast<int>(Version)));
+ Feature = Data.getU8(Cur); // Feature byte
+ if (!Cur)
+ break;
+ auto FeatEnableOrErr = BBAddrMap::Features::decode(Feature);
+ if (!FeatEnableOrErr)
+ return FeatEnableOrErr.takeError();
+ FeatEnable = *FeatEnableOrErr;
+ if (FeatEnable.CallsiteOffsets && Version < 3)
+ return createError("version should be >= 3 for SHT_LLVM_BB_ADDR_MAP when "
+ "callsite offsets feature is enabled: version = " +
+ Twine(static_cast<int>(Version)) +
+ " feature = " + Twine(static_cast<int>(Feature)));
uint32_t NumBlocksInBBRange = 0;
uint32_t NumBBRanges = 1;
typename ELFFile<ELFT>::uintX_t RangeBaseAddress = 0;