[llvm-dev] [llvm-objdump] pc-relative branches output immediate value instead of target address

James Henderson via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 16 02:00:06 PST 2019

Hi Sergio,

Thank you for your patch. You'll see that I already reviewed it before
seeing this email and have just added a couple of others to the patch as
reviewers who I know work in this area.

Functional changes that improve compatibility with the GNU equivalent
binutil are always welcome. The general opinion is that we should aim for
compatibility except for extreme cases where what GNU does is clearly a bug
or it doesn't matter (e.g. in llvm-objcopy, our output is sometimes
slightly different, but we aim for the same semantic behaviour).

I'm not really familiar with how InstPrinter is used outside llvm-objdump.
You should make sure to run the `check-all` build target to ensure there is
no other testing that relies on the behaviour you have changed.

I don't think we want to be in a place where the behaviour is different
across different targets. Consequently, I'd make sure you check and change
the behaviour for the other targets too, and add testing for those changes.

Let us know if you have any more questions!


On Fri, 13 Dec 2019 at 17:22, Sergio PĂ©rez via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello All,
> While using llvm-objdump I noticed that for the pc-rel branching
> instructions (jmp/br/call) it prints the immediate value encoded in the
> instruction, as opposed to the target address like binutils does.
> I've created a patch (https://reviews.llvm.org/D71453) that tries to
> match the output of those instructions with binutils, my first attempt to
> contribute. Since I modify the target specific 'InstPrinter's I only did it
> (initially) for the targets that have llvm-objdump tests, and also I assume
> InstPrinter might be used in more components other than objdump, therefore
> I would like to kindly ask for you feedback.
> E.g.
> Binutils:
> 4005af: 0f 8f 35 00 00 00     jg     4005ea <main+0x8a>
> llvm-objdump (currently):
> 4005af: 0f 8f 35 00 00 00             jg 0x35 <main+0x8a>
> Best regards,
> Sergio
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191216/35cf0cde/attachment.html>

More information about the llvm-dev mailing list