From: Simon Tatham Date: Mon, 25 Jul 2022 13:55:31 +0000 (+0100) Subject: [llvm-objdump,ARM] Fix .byte directives dumping the wrong byte. X-Git-Tag: upstream/15.0.7~566 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e35fec2c0277c27f13d06e4a3a8a3e676286daab;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test index 9b628d7..0ef05f3 100644 --- a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test +++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test @@ -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: : # CHECK: 4: 62 6c 61 68 .word -# CHECK: 8: 00 .byte 0x01 +# CHECK: 8: 9a .byte 0x9a diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 9e4fa7c..c486088 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -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; }