From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1944) id 870563857364; Fri, 5 Aug 2022 19:38:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 870563857364 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Szabolcs Nagy To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] TODO(gprof): aarch64: morello: add gprof profiling support to asm X-Act-Checkin: glibc X-Git-Author: Szabolcs Nagy X-Git-Refname: refs/heads/arm/morello/main X-Git-Oldrev: 5ef98a99001f411448fef8cdf87a9f1d40b3db32 X-Git-Newrev: ccce788403ca63581a3ab08b619368223ed2502e Message-Id: <20220805193817.870563857364@sourceware.org> Date: Fri, 5 Aug 2022 19:38:17 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2022 19:38:17 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ccce788403ca63581a3ab08b619368223ed2502e commit ccce788403ca63581a3ab08b619368223ed2502e Author: Szabolcs Nagy Date: Wed Jul 13 15:22:10 2022 +0100 TODO(gprof): aarch64: morello: add gprof profiling support to asm Assembly prologue code with mcount call for gprof instrumentation. TODO: untested, likely needs further runtime updates too. Diff: --- sysdeps/aarch64/sysdep.h | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 6575503c8b..eb58ee340d 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -151,10 +151,44 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) ASM_SIZE_DIRECTIVE(name) /* If compiled for profiling, call `mcount' at the start of each function. */ -#ifdef PROF -# ifdef __CHERI_PURE_CAPABILITY__ -# error mcount profiling is not supported with purecap ABI -# endif +#if defined PROF && defined __CHERI_PURE_CAPABILITY__ +/* Note: c9 must be preserved in var arg functions. */ +# define CALL_MCOUNT \ + stp c30, c9, [csp, #-160]!; \ + cfi_adjust_cfa_offset (160); \ + cfi_rel_offset (c30, 0); \ + cfi_rel_offset (c9, 16); \ + stp c0, c1, [csp, #32]; \ + cfi_rel_offset (c0, 32); \ + cfi_rel_offset (c1, 48); \ + stp c2, c3, [csp, #64]; \ + cfi_rel_offset (c2, 64); \ + cfi_rel_offset (c3, 80); \ + stp c4, c5, [csp, #96]; \ + cfi_rel_offset (c4, 96); \ + cfi_rel_offset (c5, 112); \ + stp c6, c7, [csp, #128]; \ + cfi_rel_offset (c6, 128); \ + cfi_rel_offset (c7, 144); \ + mov c0, c30; \ + bl mcount; \ + ldp c0, c1, [csp, #32]; \ + cfi_restore (c0); \ + cfi_restore (c1); \ + ldp c2, c3, [csp, #64]; \ + cfi_restore (c2); \ + cfi_restore (c3); \ + ldp c4, c5, [csp, #96]; \ + cfi_restore (c4); \ + cfi_restore (c5); \ + ldp c6, c7, [csp, #128]; \ + cfi_restore (c6); \ + cfi_restore (c7); \ + ldp c30, c9, [csp, #160]; \ + cfi_adjust_cfa_offset (-160); \ + cfi_restore (c30); \ + cfi_restore (c9); +#elif defined PROF && !defined __CHERI_PURE_CAPAILITY__ # define CALL_MCOUNT \ str x30, [sp, #-80]!; \ cfi_adjust_cfa_offset (80); \