[llvm] [SHT_LLVM_BB_ADDR_MAP] Deprecate SHT_LLVM_BB_ADDR_MAP versions 0 and 1. (PR #74107)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 13:10:26 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d605d9d7a153fb39eca2beac20f895f0407acabf e4b2447d6544ffe352fbddf0a2ffd6aafd3901f2 -- llvm/include/llvm/BinaryFormat/ELF.h llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/lib/MC/MCSectionELF.cpp llvm/lib/Object/ELF.cpp llvm/lib/Object/ELFObjectFile.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/lib/ObjectYAML/ELFYAML.cpp llvm/tools/llvm-readobj/ELFDumper.cpp llvm/tools/obj2yaml/elf2yaml.cpp llvm/unittests/Object/ELFObjectFileTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index bbd8e83469..69d0debc89 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -703,7 +703,8 @@ ELFFile<ELFT>::decodeBBAddrMap(const Elf_Shdr &Sec,
if (!Cur)
break;
if (Version != 2) {
- return createError(Twine((Version < 2 ? "deprecated" :"unsupported")) + " SHT_LLVM_BB_ADDR_MAP version: " +
+ return createError(Twine((Version < 2 ? "deprecated" : "unsupported")) +
+ " SHT_LLVM_BB_ADDR_MAP version: " +
Twine(static_cast<int>(Version)));
}
Data.getU8(Cur); // Feature byte
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp
index fffe989e71..ec11a40c7c 100644
--- a/llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -1398,29 +1398,28 @@ void ELFState<ELFT>::writeSectionContent(
bool UnsupportedVersion = E.Version > 2;
// Write version and feature values.
if (DeprecatedVersion || UnsupportedVersion) {
- WithColor::warning() << (DeprecatedVersion ? "deprecated" : "unsupported")
- << " SHT_LLVM_BB_ADDR_MAP version: "
- << static_cast<int>(E.Version)
- << "; encoding using the most recent version";
- }
+ WithColor::warning() << (DeprecatedVersion ? "deprecated" : "unsupported")
+ << " SHT_LLVM_BB_ADDR_MAP version: "
+ << static_cast<int>(E.Version)
+ << "; encoding using the most recent version";
+ }
CBA.write(E.Version);
CBA.write(E.Feature);
SHeader.sh_size += 2;
- // Write the address of the function.
- CBA.write<uintX_t>(E.Address, ELFT::TargetEndianness);
- // Write number of BBEntries (number of basic blocks in the function). This
- // is overridden by the 'NumBlocks' YAML field when specified.
- uint64_t NumBlocks =
- E.NumBlocks.value_or(E.BBEntries ? E.BBEntries->size() : 0);
- SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(NumBlocks);
- // Write all BBEntries.
- if (!E.BBEntries)
- continue;
- for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *E.BBEntries) {
- SHeader.sh_size += CBA.writeULEB128(BBE.ID) +
- CBA.writeULEB128(BBE.AddressOffset) +
- CBA.writeULEB128(BBE.Size) +
- CBA.writeULEB128(BBE.Metadata);
+ // Write the address of the function.
+ CBA.write<uintX_t>(E.Address, ELFT::TargetEndianness);
+ // Write number of BBEntries (number of basic blocks in the function).
+ // This is overridden by the 'NumBlocks' YAML field when specified.
+ uint64_t NumBlocks =
+ E.NumBlocks.value_or(E.BBEntries ? E.BBEntries->size() : 0);
+ SHeader.sh_size += sizeof(uintX_t) + CBA.writeULEB128(NumBlocks);
+ // Write all BBEntries.
+ if (!E.BBEntries)
+ continue;
+ for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *E.BBEntries) {
+ SHeader.sh_size +=
+ CBA.writeULEB128(BBE.ID) + CBA.writeULEB128(BBE.AddressOffset) +
+ CBA.writeULEB128(BBE.Size) + CBA.writeULEB128(BBE.Metadata);
}
}
}
diff --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp
index 355b1df7a4..ab1139a4ea 100644
--- a/llvm/unittests/Object/ELFObjectFileTest.cpp
+++ b/llvm/unittests/Object/ELFObjectFileTest.cpp
@@ -529,7 +529,6 @@ Sections:
DoCheck(DeprecatedVersionYamlString,
"deprecated SHT_LLVM_BB_ADDR_MAP version: 1");
-
SmallString<128> CommonVersionedYamlString(CommonYamlString);
CommonVersionedYamlString += R"(
Version: 2
``````````
</details>
https://github.com/llvm/llvm-project/pull/74107
More information about the llvm-commits
mailing list