Date: Sun, 10 Jan 1999 05:16:37 +0100 (CET) From: assar@sics.se To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/9413: profiling does not work on elf kernels Message-ID: <199901100416.FAA65913@assaris2.pdc.kth.se>
next in thread | raw e-mail | index | archive | help
>Number: 9413 >Category: kern >Synopsis: profiling does not work with elf kernels >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jan 9 20:20:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Assar Westerlund >Release: FreeBSD 3.0-CURRENT i386 >Organization: none >Environment: >Description: When configuring a kernel with profiling (`config -p'), it fails to build due to duplicate and unresolved symbols. In the aout-world it looks like this (where if_ex.o is a random object file): mcount.o 00000000 T _mcount prof_machdep.o 00000000 T __mcount U _mcount 00000010 T mcount if_ex.o U mcount But in the elf world there's some confusion as to what the different functions should be called. mcount.o 00000000 T mcount prof_machdep.o 0000002c t Lmcount_exit 00000000 T __mcount U _mcount 00000010 T mcount if_ex.o U .mcount >How-To-Repeat: config -p GENERIC cd ../../GENERIC make depend all >Fix: Index: i386/i386/exception.s =================================================================== RCS file: /src/fbsd-repository/src/sys/i386/i386/exception.s,v retrieving revision 1.55 diff -u -w -r1.55 exception.s --- exception.s 1998/08/10 19:41:07 1.55 +++ exception.s 1999/01/10 04:09:57 @@ -204,7 +204,7 @@ movl %ax,%es FAKE_MCOUNT(12*4(%esp)) calltrap: - FAKE_MCOUNT(_btrap) /* init "from" _btrap -> calltrap */ + FAKE_MCOUNT(CNAME(btrap)) /* init "from" _btrap -> calltrap */ MPLOCKED incl _cnt+V_TRAP ALIGN_LOCK ECPL_LOCK Index: i386/isa/ipl.s =================================================================== RCS file: /src/fbsd-repository/src/sys/i386/isa/ipl.s,v retrieving revision 1.24 diff -u -w -r1.24 ipl.s --- ipl.s 1998/08/11 17:01:32 1.24 +++ ipl.s 1999/01/10 04:11:15 @@ -111,7 +111,7 @@ #ifdef SMP TEST_CIL #endif - FAKE_MCOUNT(_bintr) /* init "from" _bintr -> _doreti */ + FAKE_MCOUNT(CNAME(bintr)) /* init "from" _bintr -> _doreti */ addl $4,%esp /* discard unit number */ popl %eax /* cpl or cml to restore */ doreti_next: Index: i386/isa/prof_machdep.c =================================================================== RCS file: /src/fbsd-repository/src/sys/i386/isa/prof_machdep.c,v retrieving revision 1.11 diff -u -w -r1.11 prof_machdep.c --- prof_machdep.c 1998/12/14 18:21:34 1.11 +++ prof_machdep.c 1999/01/10 04:12:59 @@ -48,6 +48,8 @@ #endif #include <i386/isa/timerreg.h> +#include <machine/asmacros.h> + #ifdef GUPROF #define CPUTIME_CLOCK_UNINITIALIZED 0 #define CPUTIME_CLOCK_I8254 1 @@ -77,7 +79,7 @@ # \n\ # Check that we are profiling. Do it early for speed. \n\ # \n\ - cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\ + cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ je Lmcount_exit \n\ # \n\ # __mcount is the same as mcount except the caller \n\ @@ -88,9 +90,9 @@ jmp Lgot_frompc \n\ \n\ .align 4,0x90 \n\ - .globl mcount \n\ -mcount: \n\ - cmpl $GMON_PROF_OFF,__gmonparam+GM_STATE \n\ + .globl " __XSTRING(HIDENAME(mcount)) " \n\ +" __XSTRING(HIDENAME(mcount)) ": \n\ + cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ je Lmcount_exit \n\ # \n\ # The caller's stack frame has already been built, so \n\ @@ -109,7 +111,7 @@ pushl %eax \n\ pushl %edx \n\ cli \n\ - call _mcount \n\ + call " __XSTRING(CNAME(mcount)) " \n\ addl $8,%esp \n\ popfl \n\ Lmcount_exit: \n\ >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901100416.FAA65913>