This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Miscompilation of glibc with CVS mainline
- From: Andreas Jaeger <aj at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>, gcc at gcc dot gnu dot org,libc-alpha at sources dot redhat dot com
- Date: Thu, 02 Jan 2003 14:53:06 +0100
- Subject: Re: Miscompilation of glibc with CVS mainline
- References: <200301011743.h01HhVlX008971@hiauly1.hia.nrc.ca><u8d6nfvgj2.fsf@gromit.moeb><20030102142706.D1218@sunsite.ms.mff.cuni.cz>
Jakub Jelinek <jakub@redhat.com> writes:
> 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?
I'm playing now with:
# define __pragma_weak(expr) _Pragma(#expr)
# define _weak_extern(symbol) __pragma_weak("weak " #symbol)
And this works with my small testcase and I've just started
recompiling glibc with it.
I'll try your definition also and let you know about the results,
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj