From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12805 invoked by alias); 4 Mar 2004 01:56:23 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12791 invoked by uid 48); 4 Mar 2004 01:56:21 -0000 Date: Thu, 04 Mar 2004 01:56:00 -0000 Message-ID: <20040304015621.12790.qmail@sources.redhat.com> From: "ajd at gentrack dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031212191310.13391.greed@pobox.com> References: <20031212191310.13391.greed@pobox.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/13391] AIX: collect2 emits bad code with duplicated symbols X-Bugzilla-Reason: CC X-SW-Source: 2004-03/txt/msg00534.txt.bz2 List-Id: ------- Additional Comments From ajd at gentrack dot com 2004-03-04 01:56 ------- (In reply to comment #17) > > Can you try the appended patch that disables exporting _GLOBAL_* > > symbols in AIX shared libraries? > > Thanks, David I still have not managed a full bootstrap with your patch (ETA 12hours -- but that is a separate issue). However I applied the following patch (in all it's glory) to collect2 and used this version with a previously complied gcc. I did not relink libstdc++.a. After relinking my libraries with this new collect, my exceptions are working perfectly. Thanks, Andrew *** gcc-3.3.2/gcc/collect2.c Thu Oct 2 02:08:34 2003 --- ../gcc-3.3.2/gcc/collect2.c Fri Mar 5 04:20:56 2004 *************** *** 1435,1444 **** --- 1435,1446 ---- if (! exports.first) *ld2++ = concat ("-bE:", export_file, NULL); + #ifndef LD_INIT_SWITCH add_to_list (&exports, initname); add_to_list (&exports, fininame); add_to_list (&exports, "_GLOBAL__DI"); add_to_list (&exports, "_GLOBAL__DD"); + #endif exportf = fopen (export_file, "w"); if (exportf == (FILE *) 0) fatal_perror ("fopen %s", export_file); *************** *** 2733,2743 **** --- 2735,2755 ---- #ifdef COLLECT_EXPORT_LIST /* Is current archive member a shared object? */ is_shared = HEADER (ldptr).f_flags & F_SHROBJ; + /* On aix we get a second object in libstdc++.a which is + in the shared library, but not marked with F_SHROBJ. + + Should we only set is_shared the first time through + this loop? + */ + if (!is_shared && strstr(prog_name, "libstdc++")) { + is_shared = 1; + } #endif while (sym_index < sym_count) { GCC_SYMENT symbol; + int t; if (ldtbread (ldptr, sym_index, &symbol) <= 0) break; *************** *** 2757,2769 **** ++name; #endif ! switch (is_ctor_dtor (name)) { case 1: if (! is_shared) add_to_list (&constructors, name); #ifdef COLLECT_EXPORT_LIST ! if (which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; --- 2769,2784 ---- ++name; #endif ! t = (is_ctor_dtor (name)); ! if (debug) printf("symbol:%s type:%i is_shared:%i prog_name:%s\n", name, t, is_shared, prog_name); ! ! switch (t) { case 1: if (! is_shared) add_to_list (&constructors, name); #ifdef COLLECT_EXPORT_LIST ! if ((!is_shared) && which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; *************** *** 2772,2778 **** if (! is_shared) add_to_list (&destructors, name); #ifdef COLLECT_EXPORT_LIST ! if (which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; --- 2787,2793 ---- if (! is_shared) add_to_list (&destructors, name); #ifdef COLLECT_EXPORT_LIST ! if ((!is_shared) && which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; *************** *** 2797,2803 **** if (! is_shared) add_to_list (&frame_tables, name); #ifdef COLLECT_EXPORT_LIST ! if (which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; --- 2812,2818 ---- if (! is_shared) add_to_list (&frame_tables, name); #ifdef COLLECT_EXPORT_LIST ! if ((!is_shared) && which_pass == PASS_OBJ) add_to_list (&exports, name); #endif break; *************** *** 2806,2812 **** #ifdef COLLECT_EXPORT_LIST /* If we are building a shared object on AIX we need to explicitly export all global symbols. */ ! if (shared_obj) { if (which_pass == PASS_OBJ && (! export_flag)) add_to_list (&exports, name); --- 2821,2827 ---- #ifdef COLLECT_EXPORT_LIST /* If we are building a shared object on AIX we need to explicitly export all global symbols. */ ! if (shared_obj && !is_shared) { if (which_pass == PASS_OBJ && (! export_flag)) add_to_list (&exports, name); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13391