From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3558 invoked by alias); 18 Apr 2002 01:06:03 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3522 invoked by uid 71); 18 Apr 2002 01:06:01 -0000 Resent-Date: 18 Apr 2002 01:06:01 -0000 Resent-Message-ID: <20020418010601.3520.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, harinath@cs.umn.edu Received:(qmail 28209 invoked by uid 61); 18 Apr 2002 01:02:42 -0000 Message-Id:<20020418010242.28208.qmail@sources.redhat.com> Date: Wed, 17 Apr 2002 18:06:00 -0000 From: harinath@cs.umn.edu Reply-To: harinath@cs.umn.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/6343: attribute((weak)) not working on second declaration X-SW-Source: 2002-04/txt/msg00904.txt.bz2 List-Id: >Number: 6343 >Category: c >Synopsis: attribute((weak)) not working on second declaration >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Apr 17 18:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: harinath@cs.umn.edu >Release: gcc version 3.2 20020416 (experimental) >Organization: >Environment: i686-pc-linux-gnu >Description: gcc/crtstuff.c depends on being able to do int foo(void); int foo(void) attribute((weak)); and have the symbol 'foo' being marked weak. This doesn't seem to be working. Here are two compiles of the attached file, and the output of nm. $ gcc -shared -o foo.so foo.c $ nm --dynamic foo.so 00001838 A _DYNAMIC 00001914 A _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00001944 A __bss_start w __cxa_finalize U __deregister_frame_info_bases w __gmon_start__ U __register_frame_info_bases 00001944 A _edata 00001960 A _end 00000810 T _fini 000005cc T _init 00000790 T bar w foo $ gcc -DNONWEAK -shared -o foo.so foo.c $ nm --dynamic foo.so 00001838 A _DYNAMIC 00001914 A _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00001944 A __bss_start w __cxa_finalize U __deregister_frame_info_bases w __gmon_start__ U __register_frame_info_bases 00001944 A _edata 00001960 A _end 00000810 T _fini 000005cc T _init 00000790 T bar U foo Notice 'foo' is not marked weak in the second case. This is exactly the way this attribute is used in gcc/crtstuff.c (which is also reflected above, see the non-weak references to __register_frame_info_bases, and the weak reference to __cxa_finalize). >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-csrc; name="foo.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="foo.c" I2lmIGRlZmluZWQgTk9OV0VBSwppbnQgZm9vKHZvaWQpOwojZW5kaWYKaW50IGZvbyh2b2lkKSBf X2F0dHJpYnV0ZV9fKChfX3dlYWtfXykpOwoKaW50IGJhcih2b2lkKQp7CiAgaWYgKGZvbykgcmV0 dXJuIGZvbygpOwogIHJldHVybiAtMTsKfQoK