bsd.lib.mk adds -DPROF when pre-processing assembly sources in order to
generate objects suitable for profiling.

Diff below reflects that in asm.h and unbreak profiling of assembly
functions in userland.

ok?

Index: amd64/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/amd64/include/asm.h,v
retrieving revision 1.6
diff -u -p -r1.6 asm.h
--- amd64/include/asm.h 13 May 2015 05:29:57 -0000      1.6
+++ amd64/include/asm.h 21 Jun 2017 11:35:44 -0000
@@ -85,7 +85,7 @@
 #endif
 
 
-#ifdef GPROF
+#if defined(PROF) || defined(GPROF)
 # define _PROF_PROLOGUE        \
        pushq %rbp; leaq (%rsp),%rbp; call PIC_PLT(__mcount); popq %rbp
 #else
Index: arm/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/arm/include/asm.h,v
retrieving revision 1.7
diff -u -p -r1.7 asm.h
--- arm/include/asm.h   21 Sep 2016 11:33:05 -0000      1.7
+++ arm/include/asm.h   21 Jun 2017 11:35:50 -0000
@@ -64,7 +64,7 @@
 #define _ENTRY(x) \
        .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
 
-#ifdef GPROF
+#if defined(PROF) || defined(GPROF)
 # define _PROF_PROLOGUE        \
        mov ip, lr; bl __mcount
 #else
Index: arm64/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/arm64/include/asm.h,v
retrieving revision 1.1
diff -u -p -r1.1 asm.h
--- arm64/include/asm.h 17 Dec 2016 23:38:33 -0000      1.1
+++ arm64/include/asm.h 21 Jun 2017 11:35:59 -0000
@@ -72,7 +72,7 @@
 #define _ENTRY(x) \
        .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
 
-#ifdef GPROF
+#if defined(PROF) || defined(GPROF)
 #  define _PROF_PROLOGUE       \
        stp     x29, x30, [sp, #-16]!; \
        mov fp, sp;             \
Index: hppa/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/hppa/include/asm.h,v
retrieving revision 1.18
diff -u -p -r1.18 asm.h
--- hppa/include/asm.h  28 Mar 2013 17:41:04 -0000      1.18
+++ hppa/include/asm.h  21 Jun 2017 11:36:06 -0000
@@ -225,7 +225,7 @@ tf4 .reg    %fr8
 #define        __CONCAT(a,b)   a/**/b
 #endif
 
-#ifdef PROF
+#if defined(PROF) || defined(GPROF)
 #define        _PROF_PROLOGUE !\
 1:                                             !\
        stw     rp, HPPA_FRAME_CRP(sr0,sp)      !\
Index: powerpc/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/powerpc/include/asm.h,v
retrieving revision 1.12
diff -u -p -r1.12 asm.h
--- powerpc/include/asm.h       30 Aug 2015 10:19:49 -0000      1.12
+++ powerpc/include/asm.h       21 Jun 2017 11:36:15 -0000
@@ -72,7 +72,7 @@
 #define _ENTRY(x) \
        .text; .align 2; .globl x; .type x,@function; x:
 
-#ifdef PROF
+#if defined(PROF) || defined(GPROF)
 # define _PROF_PROLOGUE(y)     \
        .section ".data"; \
        .align 2; \
Index: sh/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/sh/include/asm.h,v
retrieving revision 1.5
diff -u -p -r1.5 asm.h
--- sh/include/asm.h    27 May 2016 16:32:38 -0000      1.5
+++ sh/include/asm.h    21 Jun 2017 11:36:20 -0000
@@ -61,7 +61,7 @@
        .type x,@function                                               ;\
        x:
 
-#ifdef GPROF
+#if defined(PROF) || defined(GPROF)
 #define        _PROF_PROLOGUE                            \
        mov.l   1f,r1                           ; \
        mova    2f,r0                           ; \
Index: sparc64/include/asm.h
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/include/asm.h,v
retrieving revision 1.11
diff -u -p -r1.11 asm.h
--- sparc64/include/asm.h       25 Sep 2016 14:58:00 -0000      1.11
+++ sparc64/include/asm.h       21 Jun 2017 11:36:40 -0000
@@ -81,7 +81,7 @@
 #define        _ENTRY(name) \
        .align 4; .globl name; .proc 1; FTYPE(name); name:
 
-#ifdef GPROF
+#if defined(PROF) || defined(GPROF)
 #define _PROF_PROLOGUE \
        .data; .align 8; 1: .uaword 0; .uaword 0; \
        .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \

Reply via email to