public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ajd at gentrack dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/13391] AIX: collect2 emits bad code with duplicated symbols
Date: Thu, 04 Mar 2004 01:56:00 -0000	[thread overview]
Message-ID: <20040304015621.12790.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031212191310.13391.greed@pobox.com>


------- 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


  parent reply	other threads:[~2004-03-04  1:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-12 19:13 [Bug target/13391] New: AIX: crash on throw/catch between shared objects greed at pobox dot com
2003-12-12 19:18 ` [Bug target/13391] " greed at pobox dot com
2003-12-12 19:19 ` greed at pobox dot com
2003-12-12 19:19 ` greed at pobox dot com
2003-12-12 19:20 ` greed at pobox dot com
2003-12-12 19:20 ` greed at pobox dot com
2003-12-12 19:20 ` greed at pobox dot com
2003-12-24  2:46 ` ddurham_gcc_bz at davyandbeth dot com
2003-12-26  3:20 ` dje at gcc dot gnu dot org
2003-12-29 16:24 ` ddurham_gcc_bz at davyandbeth dot com
2003-12-29 20:51 ` greed at pobox dot com
2004-01-18 17:58 ` dhazeghi at yahoo dot com
2004-01-19  4:32 ` dje at watson dot ibm dot com
2004-01-19 17:36 ` [Bug target/13391] AIX: collect2 emits bad code with duplicated symbols dhazeghi at yahoo dot com
2004-01-20 21:13 ` greed at pobox dot com
2004-03-03  1:11 ` ajd at gentrack dot com
2004-03-03 22:48 ` dje at watson dot ibm dot com
2004-03-04  0:00 ` ajd at gentrack dot com
2004-03-04  1:56 ` ajd at gentrack dot com [this message]
2004-03-04  2:40 ` greed at pobox dot com
2004-03-04  2:47 ` dje at watson dot ibm dot com
2004-03-04  3:01 ` greed at pobox dot com
2004-03-04  4:01 ` ajd at gentrack dot com
2004-03-04  4:06 ` dje at watson dot ibm dot com
2004-03-04  4:16 ` ajd at gentrack dot com
2004-03-04  5:35 ` dje at watson dot ibm dot com
2004-03-04  5:56 ` ajd at gentrack dot com
2004-03-04  6:11 ` dje at watson dot ibm dot com
2004-03-04  6:15 ` ajd at gentrack dot com
2004-03-04 15:34 ` dje at watson dot ibm dot com
2004-03-04 17:17 ` greed at pobox dot com
2004-03-04 17:24 ` dje at watson dot ibm dot com
2004-03-04 17:28 ` dje at watson dot ibm dot com
2004-03-04 17:36 ` greed at pobox dot com
2004-03-04 18:46 ` dje at watson dot ibm dot com
2004-03-04 21:02 ` ajd at gentrack dot com
2004-03-05 15:44 ` greed at pobox dot com
2004-03-05 18:55 ` greed at pobox dot com
2004-03-05 19:51 ` dje at watson dot ibm dot com
2004-03-05 21:08 ` greed at pobox dot com
2004-03-06 20:56 ` dje at gcc dot gnu dot org
2004-03-06 23:31 ` pinskia at gcc dot gnu dot org
2004-03-07 22:35 ` dje at gcc dot gnu dot org
2004-11-24 18:42 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040304015621.12790.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).