public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: x32-abi@googlegroups.com
Cc: Mike Frysinger <vapier@gentoo.org>,
	autoconf@gnu.org, gcc@gcc.gnu.org, 	config-patches@gnu.org
Subject: Re: new triplet for x32 psABI?
Date: Tue, 04 Oct 2011 19:53:00 -0000	[thread overview]
Message-ID: <CAMe9rOqpUAFG1VZiRBz+bdD82DQYQSYuJbFd1CqAbo2k53KLWQ@mail.gmail.com> (raw)
In-Reply-To: <CAO-CJbgbYQLSbOkf4dD-6gLvdUqq_0UPdH8Dz7+O4m0Fe395bA@mail.gmail.com>

On Mon, Oct 3, 2011 at 8:44 PM, Michael LIAO <michael.hliao@gmail.com> wrote:
> On Mon, Oct 3, 2011 at 5:53 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Oct 3, 2011 at 4:47 PM, Michael LIAO <michael.hliao@gmail.com> wrote:
>>> On Mon, Oct 3, 2011 at 4:03 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>>>> On Monday, October 03, 2011 18:57:28 Michael LIAO wrote:
>>>>
>>>> please don't top post
>>>>
>>>
>>> sorry, it's my first post on mailing.
>>>
>>>>> Most examples would be related to tools generating code.
>>>>>
>>>>> Suppose you have a software package with several hard-coded fully
>>>>> optimized assembly file for different targets. Your build system need
>>>>> to know the current target as well as target ABI to select the correct
>>>>> assembly file to build it. It even desirable if it includes a simple
>>>>> script to help generate assembly code (like the one in OpenSSL), you'd
>>>>> better know the target ABI to prepare proper glue code without
>>>>> breaking ABI.
>>>>
>>>> hjlu posted examples to the x32 site as to handle this.  the only difference
>>>> between x86_64 and x32 is the size of the pointers.
>>>>
>>>
>>> Besides the pointer size, there are other differences like indirect
>>> branch which need different code sequence on x32 and x64. Indirect
>>> branch would be used in assembly code (yeah, concrete example would
>>> valuable here but indirect branch should be used potentially and
>>> possibly in assembly code.) If the assembly code use indirect branch,
>>> it needs to know the target ABI and generate/use difference code path.
>>>
>>
>> In assembly codes, most, if not all, of x86-64 indirect branch work fine for x32
>>
>
> that may cause the target IP out of the first 4G range if assembly
> code won't follow x32 abi, e.g. indirect target is stored in a memory
> location and assembly direct use 64-bit near absolute indirect call
> with m64 opernad since the branch target is 32 bits in memory but that
> call will read 64-bit value and result in garbage on high 32 bits of
> the final IP.
>

X32 assembler/linker should handle it properly by zero-extending address
to 64bit.

-- 
H.J.

  reply	other threads:[~2011-10-04 19:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 22:26 Michael LIAO
2011-10-03 22:30 ` Eric Blake
2011-10-03 22:35 ` Mike Frysinger
2011-10-03 22:57   ` Michael LIAO
2011-10-03 23:04     ` Mike Frysinger
2011-10-03 23:48       ` Michael LIAO
2011-10-04  0:47         ` Mike Frysinger
2011-10-04  3:26           ` Michael LIAO
2011-10-04  3:56             ` Mike Frysinger
2011-10-04  0:54         ` H.J. Lu
2011-10-04  3:44           ` Michael LIAO
2011-10-04 19:53             ` H.J. Lu [this message]
2011-10-03 23:06     ` H.J. Lu
2011-10-12  4:49   ` Michael LIAO
2011-10-12  7:13     ` Mike Frysinger
2011-10-12  7:27       ` Michael LIAO
2011-10-12 22:14         ` Mike Frysinger
2011-10-13  0:49         ` H.J. Lu
2011-10-13  7:26           ` Mike Frysinger

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=CAMe9rOqpUAFG1VZiRBz+bdD82DQYQSYuJbFd1CqAbo2k53KLWQ@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=autoconf@gnu.org \
    --cc=config-patches@gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=vapier@gentoo.org \
    --cc=x32-abi@googlegroups.com \
    /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).