From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 1/5] or1k: Implement profile hook calling _mcount
Date: Wed, 20 May 2020 05:37:46 +0900 [thread overview]
Message-ID: <20200519203750.401593-2-shorne@gmail.com> (raw)
In-Reply-To: <20200519203750.401593-1-shorne@gmail.com>
Defining this to not abort as found when working on running tests in
the glibc test suite.
We implement this with a call to _mcount with no arguments. The required
return address's will be pulled from the stack. Passing the LR (r9) as
an argument had problems as sometimes r9 is clobbered by the GOT logic
in the prologue before the call to _mcount.
gcc/ChangeLog:
* config/or1k/or1k.h (NO_PROFILE_COUNTERS): Define as 1.
(PROFILE_HOOK): Define to call _mcount.
(FUNCTION_PROFILER): Change from abort to no-op.
---
gcc/config/or1k/or1k.h | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
index 23db771d8fb..be089900fd4 100644
--- a/gcc/config/or1k/or1k.h
+++ b/gcc/config/or1k/or1k.h
@@ -379,8 +379,19 @@ do { \
/* Always pass the SYMBOL_REF for direct calls to the expanders. */
#define NO_FUNCTION_CSE 1
-/* Profiling */
-#define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0)
+#define NO_PROFILE_COUNTERS 1
+
+/* Emit rtl for profiling. Output assembler code to call "_mcount" for
+ profiling a function entry. */
+#define PROFILE_HOOK(LABEL) \
+ { \
+ rtx fun; \
+ fun = gen_rtx_SYMBOL_REF (Pmode, "_mcount"); \
+ emit_library_call (fun, LCT_NORMAL, VOIDmode); \
+ }
+
+/* All the work is done in PROFILE_HOOK, but this is still required. */
+#define FUNCTION_PROFILER(STREAM, LABELNO) do { } while (0)
/* Dwarf 2 Support */
#define DWARF2_DEBUGGING_INFO 1
--
2.26.2
next prev parent reply other threads:[~2020-05-19 20:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 20:37 [OpenRISC] [PATCH 0/5] OpenRISC GCC Fixes for Glibc Support Stafford Horne
2020-05-19 20:37 ` Stafford Horne [this message]
2020-05-19 20:37 ` [OpenRISC] [PATCH 2/5] or1k: Add builtin define to detect hard float Stafford Horne
2020-05-19 20:37 ` [OpenRISC] [PATCH 3/5] or1k: Support for softfloat to emulate hw exceptions Stafford Horne
2020-05-19 20:37 ` [OpenRISC] [PATCH 4/5] or1k: Add note to indicate execstack Stafford Horne
2020-05-19 20:37 ` [OpenRISC] [PATCH 5/5] or1k: Fixup exception header data encodings Stafford Horne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200519203750.401593-2-shorne@gmail.com \
--to=shorne@gmail.com \
--cc=openrisc@lists.librecores.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.