@@ -13151,6 +13151,9 @@ s390_function_profiler (FILE *file, int labelno)
op[4] = gen_rtx_CONST (Pmode, op[4]);
}
+ if (flag_record_mcount)
+ fprintf (file, "1:\n");
+
if (flag_fentry)
{
if (cfun->static_chain_decl)
@@ -13204,6 +13207,13 @@ s390_function_profiler (FILE *file, int labelno)
output_asm_insn ("basr\t%0,%0", op);
output_asm_insn ("l\t%0,%1", op);
}
+
+ if (flag_record_mcount)
+ {
+ fprintf (file, "\t.section __mcount_loc, \"a\",@progbits\n");
+ fprintf (file, "\t.%s 1b\n", TARGET_64BIT ? "quad" : "long");
+ fprintf (file, "\t.previous\n");
+ }
}
/* Encode symbol attributes (local vs. global, tls model) of a SYMBOL_REF
@@ -298,3 +298,7 @@ mfentry
Target Report Var(flag_fentry)
Emit profiling counter call at function entry before prologue. The compiled
code will require a 64-bit CPU and glibc 2.29 or newer to run.
+
+mrecord-mcount
+Target Report Var(flag_record_mcount)
+Generate __mcount_loc section with all _mcount and __fentry__ calls.
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-pg -mrecord-mcount" } */
+
+void
+profileme (void)
+{
+ /* { dg-final { scan-assembler ".section __mcount_loc, \"a\",@progbits" } } */
+ /* { dg-final { scan-assembler ".quad 1b" } } */
+ /* { dg-final { scan-assembler ".previous" } } */
+}