From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7300 invoked by alias); 2 Jan 2003 13:53:27 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 7272 invoked from network); 2 Jan 2003 13:53:21 -0000 Received: from unknown (HELO Cantor.suse.de) (213.95.15.193) by 209.249.29.67 with SMTP; 2 Jan 2003 13:53:21 -0000 Received: from Hermes.suse.de (Hermes.suse.de [213.95.15.136]) by Cantor.suse.de (Postfix) with ESMTP id 8272B14BC9; Thu, 2 Jan 2003 14:53:07 +0100 (MET) Received: from aj by arthur.inka.de with local (Exim 3.34 #1) id 18U5mU-0006ni-00; Thu, 02 Jan 2003 14:53:06 +0100 Mail-Copies-To: never To: Jakub Jelinek Cc: John David Anglin , gcc@gcc.gnu.org, libc-alpha@sources.redhat.com Subject: Re: Miscompilation of glibc with CVS mainline References: <200301011743.h01HhVlX008971@hiauly1.hia.nrc.ca> <20030102142706.D1218@sunsite.ms.mff.cuni.cz> From: Andreas Jaeger Date: Thu, 02 Jan 2003 13:53:00 -0000 In-Reply-To: <20030102142706.D1218@sunsite.ms.mff.cuni.cz> (Jakub Jelinek's message of "Thu, 2 Jan 2003 14:27:06 +0100") Message-ID: User-Agent: Gnus/5.090008 (Oort Gnus v0.08) XEmacs/21.4 (Artificial Intelligence, i386-suse-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00032.txt.bz2 Jakub Jelinek 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