public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [committed, PATCH] Remove Disp16|Disp32 from 64-bit direct branches
Date: Tue, 12 May 2015 13:37:00 -0000	[thread overview]
Message-ID: <CAMe9rOpOx=SSUZnCFimn4fBzFqNRDch8QYLn3Os_y7EfQH65Qw@mail.gmail.com> (raw)
In-Reply-To: <555216370200007800079773@mail.emea.novell.com>

On Tue, May 12, 2015 at 6:03 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 12.05.15 at 14:37, <hjl.tools@gmail.com> wrote:
>> On Tue, May 12, 2015 at 5:20 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>> On 12.05.15 at 13:54, <hjl.tools@gmail.com> wrote:
>>>> On Tue, May 12, 2015 at 3:41 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>>>> On 11.05.15 at 23:23, <hongjiu.lu@intel.com> wrote:
>>>>>> Disp16 and Disp32 aren't supported by direct branches in 64-bit mode.
>>>>>> This patch removes them from 64-bit direct branches.
>>>>>
>>>>> See the recent discussion regarding callw - these can certainly have
>>>>> 16-bit displacements on AMD CPUs. And while disassembly may just
>>>>> get "disturbed" by getting this wrong, assembly will produce bad
>>>>> code if you don't account for both cases (or refuse to assemble
>>>>> such mnemonics if they would require size overrides to be added).
>>>>>
>>>>> Apart from that I wonder why you do this for CALL and JMP, but not
>>>>> for Jcc, JCXZ, JRCXZ, LOOP, and LOOPcc.
>>>>>
>>>>> But first of all - please don't bias x86 binutils towards only supporting
>>>>> Intel hardware.
>>>>
>>>> Can you generate call/jmp with 16-bit displacement in 64-bit mode?
>>>
>>> Didn't check whether there is a mechanism currently; of course I
>>> would expect "data16 jmp <label>" to do precisely that.
>>
>> Does my change generate different binary now?
>
> I suppose so (but I don't have the time to check right now). What
> I did check is that what I suggested above indeed works with 2.25,
> including the creation of 16-bit PC-relative relocations.
>
> Jan
>

This is what I got now:

[hjl@gnu-6 tmp]$  cat x.s
.text
data16 jmp foo
bar:
mov %eax,%edx
[hjl@gnu-6 tmp]$ gcc -c x.s
[hjl@gnu-6 tmp]$ objdump -dwr x.o

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <bar-0x4>:
   0: 66 e9 00 00 89 c2     data16 jmpq ffffffffc2890006
<bar+0xffffffffc2890002> 2: R_X86_64_PC16 foo-0x2

0000000000000004 <bar>:
   4: 89 c2                 mov    %eax,%edx
[hjl@gnu-6 tmp]$

Is that the same as what you got with binutils 2.25?

-- 
H.J.

  reply	other threads:[~2015-05-12 13:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 21:23 H.J. Lu
2015-05-12 10:41 ` Jan Beulich
2015-05-12 11:54   ` H.J. Lu
2015-05-12 12:20     ` Jan Beulich
2015-05-12 12:37       ` H.J. Lu
2015-05-12 13:03         ` Jan Beulich
2015-05-12 13:37           ` H.J. Lu [this message]
2015-05-12 13:49             ` Michael Matz
2015-05-12 13:57               ` H.J. Lu
2015-05-12 14:31                 ` Michael Matz
2015-05-12 14:49                   ` H.J. Lu
2015-05-12 15:14                     ` Michael Matz
2015-05-12 15:21                       ` H.J. Lu
2015-05-12 15:32                         ` Michael Matz
2015-05-12 14:59             ` Jan Beulich
2015-05-12 15:03               ` H.J. Lu
2015-05-12 15:09                 ` Jan Beulich
2015-05-12 15:11                   ` H.J. Lu
2015-05-12 15:17                     ` Jan Beulich
2015-05-12 15:37                       ` Michael Matz
2015-05-12 15:43                         ` H.J. Lu
2015-05-12 15:47                           ` Michael Matz
2015-05-12 16:00                             ` H.J. Lu
2015-05-12 16:03                               ` Michael Matz
2015-05-12 16:08                                 ` H.J. Lu
2015-05-13  6:18                                   ` Jan Beulich
2015-05-13 11:35                                     ` H.J. Lu
2015-05-13 12:27                                       ` Jan Beulich
2015-05-13 13:15                                         ` H.J. Lu
2015-05-13 12:34                                   ` Michael Matz
2015-05-13 13:32                                     ` H.J. Lu
2015-05-13 16:50                                       ` Maciej W. Rozycki
2015-05-13 16:53                                         ` H.J. Lu
2015-05-15  6:39                                           ` Jan Beulich
2015-05-15 16:52                                             ` H.J. Lu
2015-05-18  7:05                                               ` Jan Beulich
2015-05-18 11:22                                                 ` H.J. Lu
2015-05-18 11:48                                                   ` Jan Beulich
2015-05-18 12:18                                                     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOpOx=SSUZnCFimn4fBzFqNRDch8QYLn3Os_y7EfQH65Qw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).