[PATCH] D69997: [llvm-objdump] Print relocation addends in hexadecimal

Dave Bozier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 03:13:32 PST 2019


davidb added a comment.

In D69997#1738440 <https://reviews.llvm.org/D69997#1738440>, @jhenderson wrote:

> Thanks for the patch. I'm surprised this hasn't broken any LLD tests. Did you run those too?


Surprisingly this doesn't break clang/LLD tests... I couldn't find any tests that used `objdump -r`

> GNU objdump also pads with leading zeroes. As the general aim of the tools is to be more compatible, and whilst you're working on this bit, it would make sense to do the same.

So `getRelocationValueString` is used for the value string when using `-d -r` and `-r`

The former isn't padded with leading zeros, and the latter is.

Example:

  -d -r
  0000000000000000 <bar>:
     0:	55                   	push   %rbp
     1:	48 89 e5             	mov    %rsp,%rbp
     4:	b0 00                	mov    $0x0,%al
     6:	e8 00 00 00 00       	callq  b <bar+0xb>
  			7: R_X86_64_PC32	foo-0x4



  -r
  test.o:     file format elf64-x86-64
  
  RELOCATION RECORDS FOR [.text]:
  OFFSET           TYPE              VALUE
  0000000000000007 R_X86_64_PC32     foo-0x0000000000000004

So I'd like to update the diff where only zero pad in the case of `-r`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69997/new/

https://reviews.llvm.org/D69997





More information about the llvm-commits mailing list