Subject: Re: arm26 compiler fun
To: Ben Harris <bjh21@netbsd.org>
From: Klaus Klein <kleink@uni-trier.de>
List: tech-toolchain
Date: 05/15/2000 19:44:30
Ben Harris <bjh21@netbsd.org> writes:
> On Mon, 8 May 2000, Richard Earnshaw wrote:
>
> > #undef FUNCTION_PROFILER
> > #define FUNCTION_PROFILER(STREAM,LABELNO)
> > \
> > {
> > \
> > fprintf(STREAM, "\tmov\t%sip, %slr\n", REGISTER_PREFIX,
> > REGISTER_PREFIX); \
> > fprintf(STREAM, "\tbl\tmcount\n");
> > \
> > }
> >
> > In ELF the default is normally to not prefix user symbols with '_', so
> > this would put mcount in user space. You should look at other targets and
> > see what they do.
>
> There seem to be two approaches. Most ELF ports have an assembly _mcount
> which calls a C mcount. i386 ELF has an assembly __mcount which calls a C
> _mcount. The former seems wrong to me, as the C function is in the user's
> namespace, so unless people object, I shall follow i386.
Just FWIW, the reason I renamed it to __mcount on i386/ELF is that
while an identifier named _mcount is indeed `reserved' for the
implementation, it only is so for external linkage. For an identifier
name to be reserved within file scope, two underscores are necessary,
and I encourage maintainers of other ports to follow the i386 example
and adding a weakly aliased name for binary compatibility.
-kjk