Index: lib/libc/aarch64/Symbol.map =================================================================== --- lib/libc/aarch64/Symbol.map +++ lib/libc/aarch64/Symbol.map @@ -11,6 +11,7 @@ /* PSEUDO syscalls */ _exit; + .mcount; _setjmp; _longjmp; fabs; Index: sys/arm64/include/profile.h =================================================================== --- sys/arm64/include/profile.h +++ sys/arm64/include/profile.h @@ -44,8 +44,29 @@ typedef __uintfptr_t uintfptr_t; -#define _MCOUNT_DECL void mcount +#define _MCOUNT_DECL \ +static void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \ +static void _mcount + +#ifdef __GNUCLIKE_ASM +#define MCOUNT __asm( \ +" .text \n" \ +" .align 6 \n" \ +" .type .mcount,#function \n" \ +" .globl .mcount \n" \ +" .mcount: \n" \ +" .cfi_startproc \n" \ + /* Load the caller return address as frompc */ \ +" ldr x0, [x29, #8] \n" \ + /* Use our return address as selfpc */ \ +" mov x1, lr \n" \ +" b _mcount \n" \ +" .cfi_endproc \n" \ +" .size .mcount, . - .mcount \n" \ + ); +#else #define MCOUNT +#endif #endif /* !_KERNEL */