1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[obj2yaml, yaml2obj] Use Hex64 for BBAddressMap fields.

This patch let the yaml encoding use Hex64 values for NumBlocks, BB AddressOffset, BB Size, and BB Metadata.
Additionally, it changes the decoded values in elf2yaml to uint64_t to match DataExtractor::getULEB128 return type.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D95767
This commit is contained in:
Rahman Lavaee 2021-01-31 15:29:37 -08:00
parent dfa3b662c8
commit 3beeb7f456
3 changed files with 16 additions and 16 deletions

View File

@ -155,9 +155,9 @@ struct DynamicEntry {
struct BBAddrMapEntry {
struct BBEntry {
llvm::yaml::Hex32 AddressOffset;
llvm::yaml::Hex32 Size;
llvm::yaml::Hex32 Metadata;
llvm::yaml::Hex64 AddressOffset;
llvm::yaml::Hex64 Size;
llvm::yaml::Hex64 Metadata;
};
llvm::yaml::Hex64 Address;
Optional<std::vector<BBEntry>> BBEntries;

View File

@ -22,10 +22,10 @@
# VALID-NEXT: - AddressOffset: 0x4
# VALID-NEXT: Size: 0x5
# VALID-NEXT: Metadata: 0x6
# VALID-NEXT: - AddressOffset: 0x7
# VALID-NEXT: Size: 0x8
# VALID-NEXT: Metadata: 0x9
# VALID-NEXT: - Address: 0x20
# VALID-NEXT: - AddressOffset: 0xFFFFFFFFFFFFFFF7
# VALID-NEXT: Size: 0xFFFFFFFFFFFFFFF8
# VALID-NEXT: Metadata: 0xFFFFFFFFFFFFFFF9
# VALID-NEXT: - Address: 0xFFFFFFFFFFFFFF20
# VALID-NEXT: BBEntries:
# VALID-NEXT: - AddressOffset: 0xA
# VALID-NEXT: Size: 0xB
@ -48,10 +48,10 @@ Sections:
- AddressOffset: 0x4
Size: 0x5
Metadata: 0x6
- AddressOffset: 0x7
Size: 0x8
Metadata: 0x9
- Address: 0x20
- AddressOffset: 0xFFFFFFFFFFFFFFF7
Size: 0xFFFFFFFFFFFFFFF8
Metadata: 0xFFFFFFFFFFFFFFF9
- Address: 0xFFFFFFFFFFFFFF20
BBEntries:
- AddressOffset: 0xA
Size: 0xB

View File

@ -852,13 +852,13 @@ ELFDumper<ELFT>::dumpBBAddrMapSection(const Elf_Shdr *Shdr) {
DataExtractor::Cursor Cur(0);
while (Cur && Cur.tell() < Content.size()) {
uint64_t Address = Data.getAddress(Cur);
uint32_t NumBlocks = Data.getULEB128(Cur);
uint64_t NumBlocks = Data.getULEB128(Cur);
std::vector<ELFYAML::BBAddrMapEntry::BBEntry> BBEntries;
// Read the specified number of BB entries, or until decoding fails.
for (uint32_t BlockID = 0; Cur && BlockID < NumBlocks; ++BlockID) {
uint32_t Offset = Data.getULEB128(Cur);
uint32_t Size = Data.getULEB128(Cur);
uint32_t Metadata = Data.getULEB128(Cur);
for (uint64_t BlockID = 0; Cur && BlockID < NumBlocks; ++BlockID) {
uint64_t Offset = Data.getULEB128(Cur);
uint64_t Size = Data.getULEB128(Cur);
uint64_t Metadata = Data.getULEB128(Cur);
BBEntries.push_back({Offset, Size, Metadata});
}
Entries.push_back({Address, BBEntries});