Changes from Martin Husemann and myself:

- Make the 32-bit SPARC profile support work with the GCC 2.95.3
  SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
  SPARC header (no functional change -- 64-bit SPARC already used the
  correct mcount name).
This commit is contained in:
thorpej 2001-11-03 20:24:42 +00:00
parent 1b197161d4
commit 88ff68974a
4 changed files with 36 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.h,v 1.11 2000/06/23 12:18:49 kleink Exp $ */
/* $NetBSD: asm.h,v 1.12 2001/11/03 20:24:42 thorpej Exp $ */
/*
* Copyright (c) 1994 Allen Briggs
@ -88,10 +88,18 @@
.align 4; .globl name; .proc 1; FTYPE(name); name:
#ifdef GPROF
/* see _MCOUNT_ENTRY in profile.h */
#ifdef __ELF__
#define _PROF_PROLOGUE \
.data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \
or %o0,%lo(1b),%o0; restore
#else
#define _PROF_PROLOGUE \
.data; .align 4; 1: .long 0; \
.text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \
or %o0,%lo(1b),%o0; restore
#endif
#else
#define _PROF_PROLOGUE
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: profile.h,v 1.10 1999/02/07 20:21:09 christos Exp $ */
/* $NetBSD: profile.h,v 1.11 2001/11/03 20:24:42 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,16 +45,18 @@
*/
#ifdef __ELF__
#define _MCOUNT_SYM "_mcount"
#else
#define _MCOUNT_SYM "__mcount"
#define _MCOUNT_ENTRY "_mcount"
#else
#define _MCOUNT_SYM "___mcount"
#define _MCOUNT_ENTRY "mcount"
#endif
#ifdef PIC
/* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
#define MCOUNT \
__asm__(".global mcount");\
__asm__("mcount:");\
__asm__(".global " _MCOUNT_ENTRY);\
__asm__(_MCOUNT_ENTRY ":");\
__asm__("add %o7, 8, %o1");\
__asm__("1: call 2f; nop; 2:");\
__asm__("add %o7," _MCOUNT_SYM "-1b, %o2");\
@ -63,15 +65,15 @@
__asm__("add %i7, 8, %o0");
#else
#define MCOUNT \
__asm__(".global mcount");\
__asm__("mcount:");\
__asm__(".global " _MCOUNT_ENTRY);\
__asm__(_MCOUNT_ENTRY ":");\
__asm__("add %i7, 8, %o0");\
__asm__("sethi %hi(" _MCOUNT_SYM "), %o2");\
__asm__("jmpl %o2 + %lo(" _MCOUNT_SYM "), %g0");\
__asm__("add %o7, 8, %o1");
#endif
#define _MCOUNT_DECL static void _mcount
#define _MCOUNT_DECL static void __mcount
#ifdef _KERNEL
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.h,v 1.15 2000/08/02 22:24:39 eeh Exp $ */
/* $NetBSD: asm.h,v 1.16 2001/11/03 20:24:43 thorpej Exp $ */
/*
* Copyright (c) 1994 Allen Briggs
@ -104,11 +104,19 @@
.align 4; .globl name; .proc 1; FTYPE(name); name:
#ifdef GPROF
/* see _MCOUNT_ENTRY in profile.h */
#ifdef __ELF__
#define _PROF_PROLOGUE \
.data; .align 8; 1: .uaword 0; .uaword 0; \
.text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \
or %o0,%lo(1b),%o0; restore
#else
#define _PROF_PROLOGUE \
.data; .align 8; 1: .uaword 0; .uaword 0; \
.text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \
or %o0,%lo(1b),%o0; restore
#endif
#else
#define _PROF_PROLOGUE
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: profile.h,v 1.4 2000/08/02 22:24:39 eeh Exp $ */
/* $NetBSD: profile.h,v 1.5 2001/11/03 20:24:43 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,17 +44,19 @@
* @(#)profile.h 8.1 (Berkeley) 6/11/93
*/
#if defined(ELF)||defined(__ELF__)
#ifdef __ELF__
#define _MCOUNT_SYM "__mcount"
#define _MCOUNT_ENTRY "_mcount"
#else
#define _MCOUNT_SYM "___mcount"
#define _MCOUNT_ENTRY "mcount"
#endif
#ifdef PIC
/* Inline expansion of PICCY_SET() (see <machine/asm.h>). */
#define MCOUNT \
__asm__(".global _mcount");\
__asm__("_mcount:");\
__asm__(".global " _MCOUNT_ENTRY);\
__asm__(_MCOUNT_ENTRY ":");\
__asm__("add %o7, 8, %o1");\
__asm__("1: rd %pc, %o2");\
__asm__("add %o2," _MCOUNT_SYM "-1b, %o2");\
@ -63,8 +65,8 @@
__asm__("add %i7, 8, %o0");
#else
#define MCOUNT \
__asm__(".global _mcount");\
__asm__("_mcount:");\
__asm__(".global " _MCOUNT_ENTRY);\
__asm__(_MCOUNT_ENTRY ":");\
__asm__("add %i7, 8, %o0");\
__asm__("sethi %hi(" _MCOUNT_SYM "), %o2");\
__asm__("jmpl %o2 + %lo(" _MCOUNT_SYM "), %g0");\