Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/include Oh...the name of the mcount call wa...
details: https://anonhg.NetBSD.org/src/rev/fc06da101f05
branches: trunk
changeset: 959370:fc06da101f05
user: ryo <ryo%NetBSD.org@localhost>
date: Wed Feb 10 12:31:34 2021 +0000
description:
Oh...the name of the mcount call was different between gcc and llvm.
gcc calls it as "_mconut", llvm calls as "__mcount".
Change the main name of mcount to "mcount()", and created "_mcount" and "__mcount" entries
to work regardless of which compiler the object was created with.
diffstat:
sys/arch/aarch64/include/profile.h | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (47 lines):
diff -r 3131730a92ce -r fc06da101f05 sys/arch/aarch64/include/profile.h
--- a/sys/arch/aarch64/include/profile.h Wed Feb 10 08:25:01 2021 +0000
+++ b/sys/arch/aarch64/include/profile.h Wed Feb 10 12:31:34 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: profile.h,v 1.3 2021/02/10 08:25:01 ryo Exp $ */
+/* $NetBSD: profile.h,v 1.4 2021/02/10 12:31:34 ryo Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#ifdef __aarch64__
-#define _MCOUNT_DECL void _mcount
+#define _MCOUNT_DECL void mcount
/*
* Cannot implement mcount in C as GCC will trash the ip register when it
@@ -39,7 +39,8 @@
* prologue.
*/
-#define MCOUNT_ASM_NAME "__mcount"
+#define MCOUNT_ASM_NAME "_mcount" /* gcc */
+#define MCOUNT_ASM_NAME_ALIAS "__mcount" /* llvm */
#define PLTSYM
#define MCOUNT \
@@ -47,7 +48,9 @@
__asm(".align 6"); \
__asm(".type " MCOUNT_ASM_NAME ",@function"); \
__asm(".global " MCOUNT_ASM_NAME); \
+ __asm(".global " MCOUNT_ASM_NAME_ALIAS); \
__asm(MCOUNT_ASM_NAME ":"); \
+ __asm(MCOUNT_ASM_NAME_ALIAS ":"); \
/* \
* Preserve registers that are trashed during mcount \
*/ \
@@ -70,7 +73,7 @@
/* \
* Call the real mcount code \
*/ \
- __asm("bl " ___STRING(_C_LABEL(_mcount))); \
+ __asm("bl " ___STRING(_C_LABEL(mcount))); \
/* \
* Restore registers that were trashed during mcount \
*/ \
Home |
Main Index |
Thread Index |
Old Index