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: Fri, 08 Jan 2021 02:08:42 +0000	[thread overview]
Message-ID: <bug-98482-4-NgcjDXyODb@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 #7 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to H.J. Lu from comment #6)
> A patch is posted at
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2021-January/563033.html

Yes, %r10 is pushed before __fentry__

cat test.c

void func(int (*param)(int));

void outer(int x)
{
    int nested(int y)
    {
        // If x is not used somewhere in here,
        // then the function will be "lifted" into
        // a normal, non-nested function.
        return x + y;
    }
    func(nested);
}

with -O2 -pg -mfentry got

nested.0:
.LFB1:
        .cfi_startproc
        pushq   %r10
1:      call    __fentry__
        popq    %r10
        movl    (%r10), %eax
        addl    %edi, %eax
        ret
        .cfi_endproc
.LFE1:
        .size   nested.0, .-nested.0
        .p2align 4
        .globl  outer
        .type   outer, @function
outer:
.LFB0:
        .cfi_startproc
1:      call    __fentry__
        subq    $56, %rsp
        .cfi_def_cfa_offset 64
        leaq    64(%rsp), %rax
        movq    %rax, 32(%rsp)
        movl    $-17599, %eax
        movl    %edi, (%rsp)
        movw    %ax, 4(%rsp)
        movl    $-17847, %edx
        movl    $nested.0, %eax
        leaq    4(%rsp), %rdi
        movl    %eax, 6(%rsp)
        movw    %dx, 10(%rsp)
        movq    %rsp, 12(%rsp)
        movl    $-1864106167, 20(%rsp)
        call    func
        addq    $56, %rsp
        .cfi_def_cfa_offset 8

  parent reply	other threads:[~2021-01-08  2:08 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 ` [Bug target/98482] " crazylht at gmail dot com
2021-01-07 12:01 ` 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 [this message]
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-NgcjDXyODb@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).