On Thu, Jul 3, 2025 at 11:54 AM H.J. Lu <[email protected]> wrote:
>
> commit ecc81e33123d7ac9c11742161e128858d844b99d (HEAD)
> Author: Andi Kleen <[email protected]>
> Date: Fri Sep 26 04:06:40 2014 +0000
>
> Add direct support for Linux kernel __fentry__ patching
>
> emitted a label, 1, for __mcount_loc section:
>
> 1: call mcount
> .section __mcount_loc, "a",@progbits
> .quad 1b
> .previous
>
> If __mcount_loc wasn't used, we got an unused label. Update
> x86_function_profiler to emit label only when __mcount_loc section
> is used.
>
> gcc/
>
> PR target/120936
> * config/i386/i386.cc (x86_print_call_or_nop): Add a label
> argument and use it to print label.
> (x86_function_profiler): Emit label only when __mcount_loc
> section is used.
>
> gcc/testsuite/
>
> PR target/120936
> * gcc.target/i386/pr120936-1.c: New test
> * gcc.target/i386/pr120936-2.c: Likewise.
> * gcc.target/i386/pr120936-3.c: Likewise.
> * gcc.target/i386/pr120936-4.c: Likewise.
> * gcc.target/i386/pr120936-5.c: Likewise.
> * gcc.target/i386/pr120936-6.c: Likewise.
> * gcc.target/i386/pr120936-7.c: Likewise.
> * gcc.target/i386/pr120936-8.c: Likewise.
> * gcc.target/i386/pr120936-9.c: Likewise.
> * gcc.target/i386/pr120936-10.c: Likewise.
> * gcc.target/i386/pr120936-11.c: Likewise.
> * gcc.target/i386/pr120936-12.c: Likewise.
> * gcc.target/i386/pr93492-3.c: Updated.
> * gcc.target/i386/pr93492-5.c: Likewise.
>
> OK for master?
>
> Thanks.
+ bool fentry_section_p
+ = (flag_record_mcount
+ || lookup_attribute ("fentry_section",
+ DECL_ATTRIBUTES (current_function_decl)));
+ const char *label;
+ if (fentry_section_p)
+ label = "1:";
+ else
+ label = "";
Just write this part as:
const char *label = fentry_section_p ? "1:" : "";
and using one vertical space before declaration.
Otherwise OK.
Thanks,
Uros.