For ELF, rename the profiling entry from mcount to __mcount to avoid clashing

with the user's namespace, also within file scope; for binary compatibility,
define a weak alias for the previous name to cover our tracks.
This commit is contained in:
kleink 1999-09-27 09:47:44 +00:00
parent a4c71cd136
commit 0b9965d236
3 changed files with 20 additions and 6 deletions

View File

@ -642,11 +642,11 @@ do { \
{ \
if (flag_pic) \
{ \
fprintf (FILE, "\tcall mcount@PLT\n"); \
fprintf (FILE, "\tcall __mcount@PLT\n"); \
} \
else \
{ \
fprintf (FILE, "\tcall mcount\n"); \
fprintf (FILE, "\tcall __mcount\n"); \
} \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.h,v 1.14 1999/08/23 08:24:37 kleink Exp $ */
/* $NetBSD: asm.h,v 1.15 1999/09/27 09:47:45 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -89,8 +89,13 @@
.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
#ifdef GPROF
# define _PROF_PROLOGUE \
# ifdef __ELF__
# define _PROF_PROLOGUE \
pushl %ebp; movl %esp,%ebp; call PIC_PLT(__mcount); popl %ebp
# else
# define _PROF_PROLOGUE \
pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
# endif
#else
# define _PROF_PROLOGUE
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: profile.h,v 1.11 1998/11/13 13:50:52 christos Exp $ */
/* $NetBSD: profile.h,v 1.12 1999/09/27 09:47:45 kleink Exp $ */
/*
* Copyright (c) 1992, 1993
@ -37,8 +37,17 @@
#define _MCOUNT_DECL static __inline void _mcount
#ifdef __ELF__
#define MCOUNT_ENTRY "__mcount"
#define MCOUNT_COMPAT __weak_alias(mcount, __mcount);
#else
#define MCOUNT_ENTRY "mcount"
#define MCOUNT_COMPAT /* nothing */
#endif
#define MCOUNT \
extern void mcount __P((void)) __asm__("mcount"); \
MCOUNT_COMPAT
extern void mcount __P((void)) __asm__(MCOUNT_ENTRY); \
void \
mcount() \
{ \