[llvm-objdump,ARM] Fix .byte directives dumping the wrong byte.

The clause in `dumpARMELFData` that dumps a single byte as a `.byte`
directive was printing the operand of that directive as `Bytes[0]`,
not `Bytes[Index]`. In particular, this led to the `dumpBytes` output
to its left not matching it!

Reviewed By: DavidSpickett

Differential Revision: https://reviews.llvm.org/D130360
This commit is contained in:
Simon Tatham 2022-07-25 14:55:31 +01:00
parent 9c1d133c3a
commit e35fec2c02
2 changed files with 4 additions and 3 deletions

View File

@ -11,8 +11,9 @@ msgend:
.section .myothersection,"ax",@progbits
adrp x1,mystr
mystr:
.asciz "blah"
.ascii "blah"
.size mystr, 4
.byte 0x9a
# CHECK: Disassembly of section .mysection:
# CHECK: <_start>:
@ -27,4 +28,4 @@ mystr:
# CHECK: 0: 01 00 00 90 adrp x1, 0x0
# CHECK: <mystr>:
# CHECK: 4: 62 6c 61 68 .word
# CHECK: 8: 00 .byte 0x01
# CHECK: 8: 9a .byte 0x9a

View File

@ -914,7 +914,7 @@ static uint64_t dumpARMELFData(uint64_t SectionAddr, uint64_t Index,
return 2;
}
dumpBytes(Bytes.slice(Index, 1), OS);
OS << "\t\t.byte\t" << format_hex(Bytes[0], 4);
OS << "\t\t.byte\t" << format_hex(Bytes[Index], 4);
return 1;
}