From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7569 invoked by alias); 4 Nov 2008 16:09:10 -0000 Received: (qmail 7312 invoked by alias); 4 Nov 2008 16:09:09 -0000 Date: Tue, 04 Nov 2008 16:09:00 -0000 Message-ID: <20081104160909.7311.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug java/37068] [4.4 Regression] libgcj linkage failure: Incorrect library ABI version detected In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: java-prs@gcc.gnu.org From: "aph at redhat dot com" Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org X-SW-Source: 2008-q4/txt/msg00043.txt.bz2 ------- Comment #24 from aph at redhat dot com 2008-11-04 16:09 ------- Subject: Re: [4.4 Regression] libgcj linkage failure: Incorrect library ABI version detected mark at codesourcery dot com wrote: > You shouldn't call that function. Instead, you should set > DECL_STATIC_{CONSTRUCTOR,DESTRUCTOR}. Then, cgraph will do the right > thing. If necessary, you can also call decl_init_priority_insert. This patch works on x86_64 GNU/Linux. Please HP/UX, AIX, and OSF users make sure it works for them as well. Thanks, Andrew. 2008-11-04 Andrew Haley * jcf-parse.c (java_emit_static_constructor): Don't call cgraph_build_static_cdtor. Rewrite. Index: jcf-parse.c =================================================================== --- jcf-parse.c (revision 141575) +++ jcf-parse.c (working copy) @@ -1699,7 +1699,32 @@ write_resource_constructor (&body); if (body) - cgraph_build_static_cdtor ('I', body, DEFAULT_INIT_PRIORITY); + { + tree name = get_identifier ("_Jv_global_static_constructor"); + + tree decl = build_decl (FUNCTION_DECL, name, + build_function_type (void_type_node, void_list_node)); + + tree resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node); + DECL_ARTIFICIAL (resdecl) = 1; + DECL_RESULT (decl) = resdecl; + current_function_decl = decl; + allocate_struct_function (decl, false); + + TREE_STATIC (decl) = 1; + TREE_USED (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; + DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; + DECL_SAVED_TREE (decl) = body; + DECL_UNINLINABLE (decl) = 1; + + DECL_INITIAL (decl) = make_node (BLOCK); + TREE_USED (DECL_INITIAL (decl)) = 1; + + DECL_STATIC_CONSTRUCTOR (decl) = 1; + java_genericize (decl); + cgraph_finalize_function (decl, false); + } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37068