From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22058 invoked by alias); 7 Nov 2012 14:46:27 -0000 Received: (qmail 21919 invoked by uid 48); 7 Nov 2012 14:46:01 -0000 From: "adivilceanu at yahoo dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54791] AIX-only: Constructors are not called in main program. Date: Wed, 07 Nov 2012 14:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: adivilceanu at yahoo dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00605.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54791 --- Comment #17 from Adi 2012-11-07 14:45:59 UTC --- Finally I got it working. You are right, there are _GLOBAL* symbols generated for each constructor, but only when you specify the init_priority attr for that object. (otherwise there is just on _GLOBAL per file). Also init_priority did not work previously on my side because of how I put it in the code: "ClassName objName("some string") __attribute__ ((init_priority (NNNN))); I realized that I need to put the _attribute_ between the objName and ("some string"). So now my whole project works with static libs. Do you know what I can do for shared libs? Can I take advantage of the -binitfini option on the lib to somehow set a priority for the hole lib? I need a lib to initialize before the main exe gets initialized. Thanks !