Module Name: src
Committed By: ryo
Date: Wed Feb 10 12:31:34 UTC 2021
Modified Files:
src/sys/arch/aarch64/include: profile.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/profile.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/aarch64/include/profile.h
diff -u src/sys/arch/aarch64/include/profile.h:1.3 src/sys/arch/aarch64/include/profile.h:1.4
--- src/sys/arch/aarch64/include/profile.h:1.3 Wed Feb 10 08:25:01 2021
+++ src/sys/arch/aarch64/include/profile.h Wed Feb 10 12:31:34 2021
@@ -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 \
*/ \