On Mon, Feb 3, 2020 at 4:02 PM H.J. Lu <hjl.to...@gmail.com> wrote: > > On Mon, Feb 3, 2020 at 10:35 AM H.J. Lu <hjl.to...@gmail.com> wrote: > > > > Define TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY to make sure that the > > ENDBR are emitted before the patch area. When -mfentry -pg is also used > > together, there should be no ENDBR before "call __fentry__". > > > > OK for master if there is no regression? > > > > Thanks. > > > > H.J. > > -- > > gcc/ > > > > PR target/93492 > > * config/i386/i386.c (ix86_asm_output_function_label): Set > > function_label_emitted to true. > > (ix86_print_patchable_function_entry): New function. > > > > gcc/testsuite/ > > > > PR target/93492 > > * gcc.target/i386/pr93492-1.c: New test. > > * gcc.target/i386/pr93492-2.c: Likewise. > > * gcc.target/i386/pr93492-3.c: Likewise. > > > > This version works with both .cfi_startproc and DWARF debug info. >
-g -fpatchable-function-entry=1 doesn't work together: [hjl@gnu-cfl-1 pr93492]$ cat y.i void f(){} [hjl@gnu-cfl-1 pr93492]$ make y.s /export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -g -fpatchable-function-entry=1 -S y.i [hjl@gnu-cfl-1 pr93492]$ cat y.s .file "y.i" .text .Ltext0: .globl f .type f, @function f: .section __patchable_function_entries,"aw",@progbits .align 8 .quad .LPFE1 .text .LPFE1: nop .LFB0: .file 1 "y.i" .loc 1 1 9 .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 .loc 1 1 1 nop popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE0: .size f, .-f I will update my patch to handle it. -- H.J.