From 08906bf8a2a9d9aa0263e7f183be7315d985b00d Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Wed, 5 Nov 2008 10:05:03 +0000 Subject: [PATCH] re PR java/37068 (libgcj linkage failure: Incorrect library ABI version detected) 2008-11-04 Andrew Haley PR java/37068 * jcf-parse.c (java_emit_static_constructor): Don't call cgraph_build_static_cdtor. Rewrite. From-SVN: r141604 --- gcc/java/ChangeLog | 6 ++++++ gcc/java/jcf-parse.c | 28 +++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 094ca08..1b76491 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2008-11-04 Andrew Haley + + PR java/37068 + * jcf-parse.c (java_emit_static_constructor): Don't call + cgraph_build_static_cdtor. Rewrite. + 2008-10-24 Jakub Jelinek * Make-lang.in (check-java-subtargets): New target. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 8757c5b..42b53c8 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1699,7 +1699,33 @@ java_emit_static_constructor (void) 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); + } } -- 2.7.4