mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-22 21:41:38 +00:00
[llvm-readobj] Fix COFF RVA table dumping bug
We would return an error in getVaPtr if the RVA table being dumped was the last data in the .rdata section. Avoid the issue by subtracting one from the offset and adding it back to get an open interval again. llvm-svn: 306171
This commit is contained in:
parent
66526dcfd5
commit
06075685d3
BIN
test/tools/llvm-readobj/Inputs/coff-load-config-data-end.exe
Normal file
BIN
test/tools/llvm-readobj/Inputs/coff-load-config-data-end.exe
Normal file
Binary file not shown.
@ -1,6 +1,8 @@
|
||||
RUN: llvm-readobj -coff-load-config %S/Inputs/coff-load-config-x86.dll | FileCheck %s --check-prefix=X86
|
||||
RUN: llvm-readobj -coff-load-config %S/Inputs/coff-load-config-x64.dll | FileCheck %s --check-prefix=X64
|
||||
|
||||
RUN: llvm-readobj -coff-load-config %S/Inputs/coff-load-config-data-end.exe | FileCheck %s --check-prefix=DATAEND
|
||||
|
||||
X86: LoadConfig [
|
||||
X86: Size: 0x5C
|
||||
X86: TimeDateStamp: 1970-01-01 00:00:00 (0x0)
|
||||
@ -85,3 +87,7 @@ X64: 0x180001970
|
||||
X64: 0x180001B50
|
||||
X64: 0x180001D90
|
||||
X64: ]
|
||||
|
||||
DATAEND: SEHTable [
|
||||
DATAEND-NEXT: 0x402006
|
||||
DATAEND-NEXT: ]
|
||||
|
@ -763,7 +763,8 @@ void COFFDumper::printRVATable(uint64_t TableVA, uint64_t Count,
|
||||
uint64_t EntrySize, PrintExtraCB PrintExtra) {
|
||||
uintptr_t TableStart, TableEnd;
|
||||
error(Obj->getVaPtr(TableVA, TableStart));
|
||||
error(Obj->getVaPtr(TableVA + Count * EntrySize, TableEnd));
|
||||
error(Obj->getVaPtr(TableVA + Count * EntrySize - 1, TableEnd));
|
||||
TableEnd++;
|
||||
for (uintptr_t I = TableStart; I < TableEnd; I += EntrySize) {
|
||||
uint32_t RVA = *reinterpret_cast<const ulittle32_t *>(I);
|
||||
raw_ostream &OS = W.startLine();
|
||||
@ -804,6 +805,9 @@ void COFFDumper::printCOFFLoadConfig() {
|
||||
|
||||
template <typename T>
|
||||
void COFFDumper::printCOFFLoadConfig(const T *Conf, LoadConfigTables &Tables) {
|
||||
if (!Conf)
|
||||
return;
|
||||
|
||||
ListScope LS(W, "LoadConfig");
|
||||
char FormattedTime[20] = {};
|
||||
time_t TDS = Conf->TimeDateStamp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user