NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-alpha/10582: namespace pollution in profiled libc (symbol "mcount")



The following reply was made to PR port-alpha/10582; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-alpha/10582: namespace pollution in profiled libc (symbol
 "mcount")
Date: Fri, 21 May 2021 23:16:30 +0000

 The existing patch from 2000 won't work; on alpha the function named
 by _MCOUNT_DECL needs to be global (it is called from
 common/lib/libc/arch/alpha/gmon/_mcount.S, but lives in
 common/lib/libc/gmon/mcount.c) so the correct change is:
 
 Index: arch/alpha/include/profile.h
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/alpha/include/profile.h,v
 retrieving revision 1.11
 diff -u -r1.11 profile.h
 --- arch/alpha/include/profile.h	6 Feb 2012 02:14:13 -0000	1.11
 +++ arch/alpha/include/profile.h	21 May 2021 23:10:41 -0000
 @@ -41,5 +41,5 @@
  	(void)_alpha_pal_swpipl(s);
  #endif /* _KERNEL */
  
 -#define	_MCOUNT_DECL	void mcount
 -#define	_MCOUNT_FUNC	mcount
 +#define	_MCOUNT_DECL	void __mcount
 +#define	_MCOUNT_FUNC	__mcount
 
 
 Note that the compiler calls _mcount, which is the code in _mcount.S
 and is responsible for saving registers; that in turn calls
 _MCOUNT_FUNC, which is MI C code that does the real work. It is
 possible to make _MCOUNT_FUNC static if _mcount is provided in
 machine/profile.h (in the macro MCOUNT) so it gets inserted in
 mcount.c, but alpha doesn't do this and changing it is probably not
 worthwhile.
 
 Note that there are no libc compat issues because profiling
 executables are always statically linked.
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index