On 03 Jan 2007 10:07:57 -0800, Ian Lance Taylor <[EMAIL PROTECTED]> wrote:
Adam Sulmicki <[EMAIL PROTECTED]> writes:
> In spirit making OSS better, I took the extra effor to report
> findings back to both lists. In reward I got flamed on both list.
You got flamed on the gcc list? I don't see any flames there. All I
told you was to use the gcc-help mailing list, which was correct. We
have different mailing lists for a reason. Sending e-mail to the
wrong list simply wastes people's time.
I also did my best to answer your question. In your original message
you didn't mention that there was an mcount variable in your program,
so it's not surprising that I wasn't able to identify the problem.
> * Rename mcount in mplayer/libmenu/menu.c to something else.
>
> * document mcount in gcc man page
>
> * gcc prints warning.
>
> * do nothing.
>
> I can immagine that gcc developers might have intentionally left
> mcount() visible to user space so that user can replace gcc's mcount()
> with their own implementation.
gcc does not provide the function which in this case is called
mcount(). That function comes from the C library.
The C library used on GNU/Linux systems, glibc, actually provides the
function _mcount, with a weak alias named mcount. So this seems to be
a bug in gcc: it should be calling _mcount.
In fact, by default, gcc for the i386 targets will call _mcount. gcc
for i386 GNU/Linux targets was changed to call mcount instead of
_mcount with this patch:
Thu Mar 30 06:20:36 1995 H.J. Lu ([EMAIL PROTECTED])
* configure (i[345]86-*-linux*): Set xmake_file=x-linux,
tm_file=i386/linux.h, and don't set extra_parts.
(i[345]86-*-linux*aout*): New configuration.
(i[345]86-*-linuxelf): Deleted.
* config/linux{,-aout}.h, config/x-linux, config/xm-linux.h: New files.
* config/i386/linux-aout.h: New file.
* config/i386/linux.h: Extensive modifications to use ELF format
as default.
(LIB_SPEC): Don't use libc_p.a for -p. don't use libg.a
unless for -ggdb.
(LINUX_DEFAULT_ELF): Defined.
* config/i386/linuxelf.h,config/i386/x-linux: Files deleted.
* config/i386/xm-linux.h: Just include xm-i386.h and xm-linux.h.
I believe that was during the time H.J. was maintaining a separate
branch of glibc for GNU/Linux systems. Presumably his version
provided mcount but not _mcount. I haven't tried to investigate
further.
In any case clearly gcc for i386 GNU/Linux systems today should call
_mcount rather than mcount. I will make that change.
I remember someone wanting to provide his own mcount().
Presumably, mcount() is weak in libc to cover such a use case ?
--
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"