1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Fix bugs in llvm-objdump printing the last word for -section in non i386 and x86 files.

Two problems, 1) for the last 4 bytes it would print them as separate bytes not a word
and 2) it would print the same last byte for those bytes less than a word.

rdar://25938224

llvm-svn: 267819
This commit is contained in:
Kevin Enderby 2016-04-27 23:43:00 +00:00
parent 7ccba4f0bc
commit b798753bdb
3 changed files with 7 additions and 3 deletions

View File

@ -4,4 +4,8 @@
# RUN: llvm-objdump -macho -section=__data %p/Inputs/section.macho-armv7 | FileCheck -check-prefix CHECK-ADDR %s
# CHECK-ADDR: 00000004 00000001
# CHECK-ADDR: 00000004 00000001 00000002
# RUN: llvm-objdump -macho -section=__const %p/Inputs/section.macho-armv7 | FileCheck -check-prefix CHECK-BYTES %s
# CHECK-BYTES: 0000000c 00000003 04 05 06

View File

@ -1004,7 +1004,7 @@ static void DumpRawSectionContents(MachOObjectFile *O, const char *sect,
outs() << format("%08" PRIx64, addr) << "\t";
for (j = 0; j < 4 * sizeof(int32_t) && i + j < size;
j += sizeof(int32_t)) {
if (i + j + sizeof(int32_t) < size) {
if (i + j + sizeof(int32_t) <= size) {
uint32_t long_word;
memcpy(&long_word, sect + i + j, sizeof(int32_t));
if (O->isLittleEndian() != sys::IsLittleEndianHost)
@ -1012,7 +1012,7 @@ static void DumpRawSectionContents(MachOObjectFile *O, const char *sect,
outs() << format("%08" PRIx32, long_word) << " ";
} else {
for (uint32_t k = 0; i + j + k < size; k++) {
uint8_t byte_word = *(sect + i + j);
uint8_t byte_word = *(sect + i + j + k);
outs() << format("%02" PRIx32, (uint32_t)byte_word) << " ";
}
}