+2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ * common.opt: Add the new warning.
+ * config/s390/s390.c (s390_function_profiler): Emit "brasl
+ %r0,__fentry__" when -mfentry is specified.
+ (s390_option_override_internal): Disallow -mfentry for 31-bit
+ CPUs.
+ * config/s390/s390.opt: Add the new option.
+
2018-07-16 Richard Biener <rguenther@suse.de>
PR lto/86523
Common Var(warn_attributes) Init(1) Warning
Warn about type safety and similar errors in attribute alias and related.
+Wcannot-profile
+Common Var(warn_cannot_profile) Init(1) Warning
+Warn when profiling instrumentation was requested, but could not be applied to
+a certain function.
+
Wcast-align
Common Var(warn_cast_align) Warning
Warn about pointer casts which increase alignment.
op[3] = gen_rtx_SYMBOL_REF (Pmode, label);
SYMBOL_REF_FLAGS (op[3]) = SYMBOL_FLAG_LOCAL;
- op[4] = gen_rtx_SYMBOL_REF (Pmode, "_mcount");
+ op[4] = gen_rtx_SYMBOL_REF (Pmode, flag_fentry ? "__fentry__" : "_mcount");
if (flag_pic)
{
op[4] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op[4]), UNSPEC_PLT);
op[4] = gen_rtx_CONST (Pmode, op[4]);
}
- if (TARGET_64BIT)
+ if (flag_fentry)
+ {
+ if (cfun->static_chain_decl)
+ warning (OPT_Wcannot_profile, "nested functions cannot be profiled "
+ "with -mfentry on s390");
+ else
+ output_asm_insn ("brasl\t0,%4", op);
+ }
+ else if (TARGET_64BIT)
{
output_asm_insn ("stg\t%0,%1", op);
output_asm_insn ("larl\t%2,%3", op);
/* Call target specific restore function to do post-init work. At the moment,
this just sets opts->x_s390_cost_pointer. */
s390_function_specific_restore (opts, NULL);
+
+ /* Check whether -mfentry is supported. It cannot be used in 31-bit mode,
+ because 31-bit PLT stubs assume that %r12 contains GOT address, which is
+ not the case when the code runs before the prolog. */
+ if (opts->x_flag_fentry && !TARGET_64BIT)
+ error ("-mfentry is supported only for 64-bit CPUs");
}
static void
-mindirect-branch* or -mfunction-return* options. The sections
consist of an array of 32 bit elements. Each entry holds the offset
from the entry to the patched location.
+
+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.