diff options
Diffstat (limited to 'llvm/tools/llvm-readobj/COFFDumper.cpp')
| -rw-r--r-- | llvm/tools/llvm-readobj/COFFDumper.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index 0a5073d2d23f..79fef8bc123c 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -940,36 +940,34 @@ void COFFDumper::printCOFFLoadConfig() { OS << " flags " << utohexstr(Flags); }; + // The stride gives the number of extra bytes in addition to the 4-byte + // RVA of each entry in the table. As of writing only a 1-byte extra flag + // has been defined. + uint32_t Stride = Tables.GuardFlags >> 28; + PrintExtraCB PrintExtra = Stride == 1 ? +PrintGuardFlags : nullptr; + if (Tables.GuardFidTableVA) { ListScope LS(W, "GuardFidTable"); - if (uint32_t Size = - Tables.GuardFlags & - uint32_t(COFF::GuardFlags::CF_FUNCTION_TABLE_SIZE_MASK)) { - // The size mask gives the number of extra bytes in addition to the 4-byte - // RVA of each entry in the table. As of writing only a 1-byte extra flag - // has been defined. - Size = (Size >> 28) + 4; - printRVATable(Tables.GuardFidTableVA, Tables.GuardFidTableCount, Size, - PrintGuardFlags); - } else { - printRVATable(Tables.GuardFidTableVA, Tables.GuardFidTableCount, 4); - } + printRVATable(Tables.GuardFidTableVA, Tables.GuardFidTableCount, + 4 + Stride, PrintExtra); } if (Tables.GuardIatTableVA) { ListScope LS(W, "GuardIatTable"); - printRVATable(Tables.GuardIatTableVA, Tables.GuardIatTableCount, 4); + printRVATable(Tables.GuardIatTableVA, Tables.GuardIatTableCount, + 4 + Stride, PrintExtra); } if (Tables.GuardLJmpTableVA) { ListScope LS(W, "GuardLJmpTable"); - printRVATable(Tables.GuardLJmpTableVA, Tables.GuardLJmpTableCount, 4); + printRVATable(Tables.GuardLJmpTableVA, Tables.GuardLJmpTableCount, + 4 + Stride, PrintExtra); } if (Tables.GuardEHContTableVA) { ListScope LS(W, "GuardEHContTable"); - printRVATable(Tables.GuardEHContTableVA, Tables.GuardEHContTableCount, 5, - PrintGuardFlags); + printRVATable(Tables.GuardEHContTableVA, Tables.GuardEHContTableCount, + 4 + Stride, PrintExtra); } } |
