From owner-freebsd-bugs Tue Jul 18 1:50: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2EE4137B83A for ; Tue, 18 Jul 2000 01:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA55127; Tue, 18 Jul 2000 01:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id C023937BCA3; Tue, 18 Jul 2000 01:43:26 -0700 (PDT) Message-Id: <20000718084326.C023937BCA3@hub.freebsd.org> Date: Tue, 18 Jul 2000 01:43:26 -0700 (PDT) From: xyf@stocke.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: gnu/20004: FBSD4 gcc __attribute__(constructor) not work Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20004 >Category: gnu >Synopsis: FBSD4 gcc __attribute__(constructor) not work >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 18 01:50:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: xuyifeng >Release: FreeBSD 4.0-stable >Organization: stocke.com >Environment: FreeBSD xyf.websoft.com.cn 4.0-RELEASE FreeBSD 4.0-RELEASE #1:Mon Jul 17 13:22:57 CST 2000 root@xyf.websoft.com.cn:/usr/src/sys/compile/TEST i386 >Description: the GNU C++ compiler in FreeBSD doesn't correctly handles "__attribute__((constructor))", but it works if I use C compiler instead. >How-To-Repeat: this is the demo program: #include int g_int = 0; void init() __attribute__((constructor)); void init() { g_int = 1; } int main(int argc, char** argv) { if (g_int == 1) printf("__attribute__((constructor)) work!\n"); else printf("__attribute__((constructor)) not work!\n"); return 0; } if the source program name is test.cpp and use command "c++ test.cpp" to compile it, "__attribute__((constructor))" hasn't effect, but if the source program name is test.c, then use command "cc test.c" the compile it, it works! >Fix: I think some utilities in FreeBSD are inconsistent, it has different version of utilities for C and C++, need update these utilities. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message