public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/98482] -mfentry creates invalid call for -mcmodel=large
Date: Thu, 07 Jan 2021 10:44:52 +0000	[thread overview]
Message-ID: <bug-98482-4-mQ34w3glEj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98482-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98482

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Topi Miettinen from comment #0)
> GCC on x86_64 with `-mfentry` generates invalid code for `-mcmodel=large`.
> The call to `__fentry__` uses plain `call` instruction, but this can only
> address locations within 32 bit range while the target may be anywhere in
> the 64 bit range due to `-mcmodel=large`.
> 
> The expected code would be something which loads a 64 bit value to a
> register and then uses register indirect call, so instead of
>         call    __fentry__
> there needs to be
>         movabsq $__fentry__, %rax
>         call    *%rax

according to PSabi, %rax is not safe.
%rax
temporary register; with variable arguments No
passes information about the number of vector
registers used; 1 st return register

and by the time of output __fentry__ in gcc, register is already accocated, is
there any regs supposed to be safe in the entry of function? or we need to
spill reg to stack and load it back after call, it looks inefficient.

  reply	other threads:[~2021-01-07 10:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 19:13 [Bug c/98482] New: " toiwoton at gmail dot com
2021-01-07 10:44 ` crazylht at gmail dot com [this message]
2021-01-07 12:01 ` [Bug target/98482] " ubizjak at gmail dot com
2021-01-07 12:24 ` ubizjak at gmail dot com
2021-01-07 13:30 ` toiwoton at gmail dot com
2021-01-07 13:37 ` ubizjak at gmail dot com
2021-01-07 23:50 ` hjl.tools at gmail dot com
2021-01-08  2:08 ` crazylht at gmail dot com
2021-01-08  8:58 ` toiwoton at gmail dot com
2021-01-08  9:29 ` ubizjak at gmail dot com
2021-01-08  9:34 ` jakub at gcc dot gnu.org
2021-01-08 12:54 ` cvs-commit at gcc dot gnu.org
2021-01-08 14:48 ` cvs-commit at gcc dot gnu.org
2021-01-08 14:49 ` hjl.tools at gmail dot com
2021-01-08 14:50 ` ubizjak at gmail dot com
2021-01-08 16:47 ` cvs-commit at gcc dot gnu.org

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=bug-98482-4-mQ34w3glEj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).