From 4e6ad1ffa202dce5e7a8cc1c66b48f4d678d639c Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 28 Oct 2006 06:04:29 +0000 Subject: [PATCH] Removed all traces of HIDENAME() in amd64 and i386 kernel code. Using this used to be slightly cleaner than using ifdefs in a few places to support both a.out and elf, but using it now just causes messes and unportabilities. It seems to be impossible to implement the elf HIDENAME() portably in cpp (since token pasting of "." and is invalid). */prof_machdep.c: - Removed all uses of CNAME(). CNAME() is easy enough to use in pure asm code, but using it in inline asm requires messy quoting. The core pure asm code has been hacked on more and all uses of CNAME() in it have already gone away. Just assume the elf convention here too. - Removed now-uneeded include of . - Removed the workaround for a namespace conflict with this include. --- sys/amd64/amd64/prof_machdep.c | 20 +++++++++----------- sys/amd64/include/asmacros.h | 8 +++----- sys/i386/include/asmacros.h | 8 +++----- sys/i386/isa/prof_machdep.c | 27 +++++++++------------------ 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/sys/amd64/amd64/prof_machdep.c b/sys/amd64/amd64/prof_machdep.c index 4c57f34a8f4e..b0ef17c1322a 100644 --- a/sys/amd64/amd64/prof_machdep.c +++ b/sys/amd64/amd64/prof_machdep.c @@ -44,10 +44,8 @@ __FBSDID("$FreeBSD$"); #include #endif #include -#undef MCOUNT #endif -#include #include #ifdef GUPROF @@ -80,7 +78,7 @@ __mcount: \n\ # \n\ # Check that we are profiling. Do it early for speed. \n\ # \n\ - cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ je .mcount_exit \n\ # \n\ # __mcount is the same as [.]mcount except the caller \n\ @@ -98,11 +96,11 @@ __mcount: \n\ jmp .got_frompc \n\ \n\ .p2align 4,0x90 \n\ - .globl " __XSTRING(HIDENAME(mcount)) " \n\ -" __XSTRING(HIDENAME(mcount)) ": \n\ + .globl .mcount \n\ +.mcount: \n\ .globl __cyg_profile_func_enter \n\ __cyg_profile_func_enter: \n\ - cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ je .mcount_exit \n\ # \n\ # The caller's stack frame has already been built, so \n\ @@ -126,7 +124,7 @@ __cyg_profile_func_enter: \n\ \n\ pushfq \n\ cli \n\ - call " __XSTRING(CNAME(mcount)) " \n\ + call mcount \n\ popfq \n\ popq %r9 \n\ popq %r8 \n\ @@ -164,11 +162,11 @@ __mexitcount: \n\ GMON_PROF_HIRES = 4 \n\ \n\ .p2align 4,0x90 \n\ - .globl " __XSTRING(HIDENAME(mexitcount)) " \n\ -" __XSTRING(HIDENAME(mexitcount)) ": \n\ + .globl .mexitcount \n\ +.mexitcount: \n\ .globl __cyg_profile_func_exit \n\ __cyg_profile_func_exit: \n\ - cmpl $GMON_PROF_HIRES," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_HIRES,_gmonparam+GM_STATE \n\ jne .mexitcount_exit \n\ pushq %rax \n\ pushq %rdx \n\ @@ -180,7 +178,7 @@ __cyg_profile_func_exit: \n\ movq 7*8(%rsp),%rdi \n\ pushfq \n\ cli \n\ - call " __XSTRING(CNAME(mexitcount)) " \n\ + call mexitcount \n\ popfq \n\ popq %r9 \n\ popq %r8 \n\ diff --git a/sys/amd64/include/asmacros.h b/sys/amd64/include/asmacros.h index 81fed275ed3e..84b1d60c558c 100644 --- a/sys/amd64/include/asmacros.h +++ b/sys/amd64/include/asmacros.h @@ -37,14 +37,12 @@ /* XXX too much duplication in various asm*.h's. */ /* - * CNAME and HIDENAME manage the relationship between symbol names in C + * CNAME is used to manage the relationship between symbol names in C * and the equivalent assembly language names. CNAME is given a name as * it would be used in a C program. It expands to the equivalent assembly - * language name. HIDENAME is given an assembly-language name, and expands - * to a possibly-modified form that will be invisible to C programs. + * language name. */ #define CNAME(csym) csym -#define HIDENAME(asmsym) .asmsym #define ALIGN_DATA .p2align 3 /* 8 byte alignment, zero filled */ #ifdef GPROF @@ -109,7 +107,7 @@ #define MCOUNT call __mcount #define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT #ifdef GUPROF -#define MEXITCOUNT call HIDENAME(mexitcount) +#define MEXITCOUNT call .mexitcount #define ret MEXITCOUNT ; NON_GPROF_RET #else #define MEXITCOUNT diff --git a/sys/i386/include/asmacros.h b/sys/i386/include/asmacros.h index a95eff0e548a..2ea368d5cbb1 100644 --- a/sys/i386/include/asmacros.h +++ b/sys/i386/include/asmacros.h @@ -37,14 +37,12 @@ /* XXX too much duplication in various asm*.h's. */ /* - * CNAME and HIDENAME manage the relationship between symbol names in C + * CNAME is used to manage the relationship between symbol names in C * and the equivalent assembly language names. CNAME is given a name as * it would be used in a C program. It expands to the equivalent assembly - * language name. HIDENAME is given an assembly-language name, and expands - * to a possibly-modified form that will be invisible to C programs. + * language name. */ #define CNAME(csym) csym -#define HIDENAME(asmsym) .asmsym #define ALIGN_DATA .p2align 2 /* 4 byte alignment, zero filled */ #ifdef GPROF @@ -109,7 +107,7 @@ #define MCOUNT call __mcount #define MCOUNT_LABEL(name) GEN_ENTRY(name) ; nop ; ALIGN_TEXT #ifdef GUPROF -#define MEXITCOUNT call HIDENAME(mexitcount) +#define MEXITCOUNT call .mexitcount #define ret MEXITCOUNT ; NON_GPROF_RET #else #define MEXITCOUNT diff --git a/sys/i386/isa/prof_machdep.c b/sys/i386/isa/prof_machdep.c index 0f399a3dde28..393c5ca91d5b 100644 --- a/sys/i386/isa/prof_machdep.c +++ b/sys/i386/isa/prof_machdep.c @@ -30,17 +30,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include -/* - * There are 2 definitions of MCOUNT to have a C version and an asm version - * with the same name and not have LOCORE #ifdefs to distinguish them. - * provides a C version, and - * provides an asm version. To avoid conflicts, #undef the asm version. - */ -#undef MCOUNT - #ifdef GUPROF #include "opt_i586_guprof.h" #include "opt_perfmon.h" @@ -82,7 +73,7 @@ __mcount: \n\ # \n\ # Check that we are profiling. Do it early for speed. \n\ # \n\ - cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ je .mcount_exit \n\ # \n\ # __mcount is the same as [.]mcount except the caller \n\ @@ -93,11 +84,11 @@ __mcount: \n\ jmp .got_frompc \n\ \n\ .p2align 4,0x90 \n\ - .globl " __XSTRING(HIDENAME(mcount)) " \n\ -" __XSTRING(HIDENAME(mcount)) ": \n\ + .globl .mcount \n\ +.mcount: \n\ .globl __cyg_profile_func_enter \n\ __cyg_profile_func_enter: \n\ - cmpl $GMON_PROF_OFF," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_OFF,_gmonparam+GM_STATE \n\ je .mcount_exit \n\ # \n\ # The caller's stack frame has already been built, so \n\ @@ -116,7 +107,7 @@ __cyg_profile_func_enter: \n\ pushl %eax \n\ pushl %edx \n\ cli \n\ - call " __XSTRING(CNAME(mcount)) " \n\ + call mcount \n\ addl $8,%esp \n\ popfl \n\ .mcount_exit: \n\ @@ -148,11 +139,11 @@ __mexitcount: \n\ GMON_PROF_HIRES = 4 \n\ \n\ .p2align 4,0x90 \n\ - .globl " __XSTRING(HIDENAME(mexitcount)) " \n\ -" __XSTRING(HIDENAME(mexitcount)) ": \n\ + .globl .mexitcount \n\ +.mexitcount: \n\ .globl __cyg_profile_func_exit \n\ __cyg_profile_func_exit: \n\ - cmpl $GMON_PROF_HIRES," __XSTRING(CNAME(_gmonparam)) "+GM_STATE \n\ + cmpl $GMON_PROF_HIRES,_gmonparam+GM_STATE \n\ jne .mexitcount_exit \n\ pushl %edx \n\ pushl %eax \n\ @@ -160,7 +151,7 @@ __cyg_profile_func_exit: \n\ pushfl \n\ pushl %eax \n\ cli \n\ - call " __XSTRING(CNAME(mexitcount)) " \n\ + call mexitcount \n\ addl $4,%esp \n\ popfl \n\ popl %eax \n\