Miscompilation of glibc with CVS mainline

Jakub Jelinek jakub@redhat.com
Thu Jan 2 13:27:00 GMT 2003


On Thu, Jan 02, 2003 at 02:16:01PM +0100, Andreas Jaeger wrote:
> I could reproduce this with a simple hello-world program and also with
> some smaller program, it is indeed a bug in handling of weak extern
> functions.
> 
> Here's a small testcase that has the same behaviour:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> extern void weak_func (void *arg);
> asm (".weak weak_func");
> 
> void
> test (void *arg)
> {
>   if (&weak_func != (void *)0)
>     weak_func (arg);
>   
> }

As GCC is not told in any way that weak_func is actually weak, I think
it is glibc's fault.
Does:
#define weak_extern(x) extern __typeof (x) x __attribute__((weak));
work ok?

	Jakub



More information about the Libc-alpha mailing list