public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "i at maskray dot me" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/99836] New: aarch64: -fpatchable-function-entry=N[,0] should place .cfi_startproc before NOPs
Date: Tue, 30 Mar 2021 18:20:56 +0000	[thread overview]
Message-ID: <bug-99836-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 99836
           Summary: aarch64: -fpatchable-function-entry=N[,0] should place
                    .cfi_startproc before NOPs
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

Extracted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92424#c8

% echo 'int main() {}' > a.c
% clang --target=aarch64 -fpatchable-function-entry=2
-mbranch-protection=standard -S a.c -o -
...
main:                                   // @main
.Lfunc_begin0:
        .cfi_startproc
// %bb.0:                               // %entry
        hint    #34
.Lpatch0:
        nop
        nop

%
/tmp/glibc-many/install/compilers/aarch64-linux-gnu/bin/aarch64-glibc-linux-gnu-g++
-fpatchable-function-entry=2 -mbranch-protection=standard -S a.c -o -
        .arch armv8-a
        .file   "a.c"
        .text
        .align  2
        .global main
        .type   main, %function
main:
        hint    34 // bti c
        .section        __patchable_function_entries,"aw",@progbits
        .align  3
        .8byte  .LPFE1
        .text
.LPFE1:
        nop
        nop
.LFB0:
        .cfi_startproc


For -fpatchable-function-entry=N[,0], placing .cfi_startproc before NOPs makes
more sense and can make unwinding work in that region.

For N[,M] where M>0, that is a very narrow use case by the Linux kernel. I
prefer not to place .cfi_startproc above the function label.

             reply	other threads:[~2021-03-30 18:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 18:20 i at maskray dot me [this message]
2021-03-31 10:21 ` [Bug target/99836] " rearnsha 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-99836-4@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).