aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2018-07-16 14:36:21 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2018-07-16 14:36:21 +0000
commit605090dc791ab2495f021908edc4dc03851e06a6 (patch)
tree724d9d00c9dace40c1244e0aceab8613d42bb52b /gcc
parent6902799c8d1470fd8a55754cc1caf0bb442472e9 (diff)
downloadgcc-605090dc791ab2495f021908edc4dc03851e06a6.zip
gcc-605090dc791ab2495f021908edc4dc03851e06a6.tar.gz
gcc-605090dc791ab2495f021908edc4dc03851e06a6.tar.bz2
S/390: Implement -mrecord-mcount
This is the counterpart of the i386 feature introduced by 39a5a6a4: Add direct support for Linux kernel __fentry__ patching. 2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com> * config/s390/s390.c (s390_function_profiler): Generate __mcount_loc section. * config/s390/s390.opt: Add the new option. 2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com> * testsuite/gcc.target/s390/mrecord-mcount.c: New testcase. From-SVN: r262733
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/s390/s390.c10
-rw-r--r--gcc/config/s390/s390.opt4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/s390/mrecord-mcount.c10
5 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index de108a5..808a237 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
+ * gcc/config/s390/s390.c (s390_function_profiler): Generate
+ __mcount_loc section.
+ * gcc/config/s390/s390.opt: Add the new option.
+
+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.
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 3a406b9..600501c 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -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
diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt
index 59e97d0..9a3ed65 100644
--- a/gcc/config/s390/s390.opt
+++ b/gcc/config/s390/s390.opt
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e0503f2..07c87a6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
+ * testsuite/gcc.target/s390/mrecord-mcount.c: New testcase.
+
+2018-07-16 Ilya Leoshkevich <iii@linux.ibm.com>
+
* gcc.target/s390/mfentry-m64.c: New testcase.
2018-07-16 Hristian Kirtchev <kirtchev@adacore.com>
diff --git a/gcc/testsuite/gcc.target/s390/mrecord-mcount.c b/gcc/testsuite/gcc.target/s390/mrecord-mcount.c
new file mode 100644
index 0000000..d8a23ff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/mrecord-mcount.c
@@ -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" } } */
+}