------- 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 <[EMAIL PROTECTED]> * 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