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

Simon Tatham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 07:18:56 PDT 2022


simon_tatham created this revision.
simon_tatham added reviewers: MaskRay, ostannard, DavidSpickett.
Herald added subscribers: StephenFan, rupprecht, kristof.beyls, emaste.
Herald added a reviewer: jhenderson.
Herald added a project: All.
simon_tatham requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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!


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130360

Files:
  llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
  llvm/tools/llvm-objdump/llvm-objdump.cpp


Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1016,7 +1016,7 @@
   }
   dumpBytes(Bytes.slice(Index, 1), OS);
   AlignToInstStartColumn(Start, STI, OS);
-  OS << "\t.byte\t" << format_hex(Bytes[0], 4);
+  OS << "\t.byte\t" << format_hex(Bytes[Index], 4);
   return 1;
 }
 
Index: llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
===================================================================
--- llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
+++ llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
@@ -27,4 +27,4 @@
 # CHECK:        0:       90000001        adrp    x1, 0x0
 # CHECK: <mystr>:
 # CHECK:        4:       62 6c 61 68     .word
-# CHECK:        8:       00              .byte   0x01
+# CHECK:        8:       00              .byte   0x00


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130360.446826.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220722/f3d9832d/attachment.bin>


More information about the llvm-commits mailing list