collect2.c (aix64_flag): New variable.
authorDavid Edelsohn <dje@gcc.gnu.org>
Tue, 27 Oct 1998 13:23:17 +0000 (08:23 -0500)
committerDavid Edelsohn <dje@gcc.gnu.org>
Tue, 27 Oct 1998 13:23:17 +0000 (08:23 -0500)
* collect2.c (aix64_flag): New variable.
(main, case 'b'): Parse it.
(GCC_CHECK_HDR): object magic number must match mode.
(scan_prog_file): Only check for shared object if valid header.
Print debugging if header/mode mismatch.

From-SVN: r23365

gcc/ChangeLog
gcc/collect2.c

index ba537b5576387da440767dc9897f633962eba99d..d664b98475acf5c4c8e4f2116bf8e8c2e747096f 100644 (file)
@@ -1,4 +1,12 @@
-Tue Oct 27 10:15:02 EST 1998  Nick Clifton  <nickc@cygnus.com>
+Tue Oct 27 16:11:43 1998  David Edelsohn  <edelsohn@mhpcc.edu>
+
+       * collect2.c (aix64_flag): New variable.
+       (main, case 'b'): Parse it.
+       (GCC_CHECK_HDR): object magic number must match mode.
+       (scan_prog_file): Only check for shared object if valid header.
+       Print debugging if header/mode mismatch.
+
+Tue Oct 27 10:15:02 1998  Nick Clifton  <nickc@cygnus.com>
 
        Added support for arm-elf-linux configuration, submitted by Philip
        Blundell <pb@nexus.co.uk>, and integrated this with the arm-elf
@@ -52,7 +60,7 @@ Tue Oct 27 10:15:02 EST 1998  Nick Clifton  <nickc@cygnus.com>
        command line option.
 
        
-Tue Oct 27 08:56:46 EST 1998  Andrew MacLeod  <amacleod@cygnus.com>
+Tue Oct 27 08:56:46 1998  Andrew MacLeod  <amacleod@cygnus.com>
 
        * dwarfout.c (ASM_OUTPUT_DWARF_STRING_NEWLINE): ASM_OUTPUT_DWARF_STRING
        has been changed to not include a newline. Use this macro instead.
index bf494c04562a8164736200a5a19ce8da9b7317b8..166cbe1c483fff641fe89410a2763fcf7a7cdf64 100644 (file)
@@ -196,6 +196,7 @@ static int rflag;                   /* true if -r */
 static int strip_flag;                 /* true if -s */
 #ifdef COLLECT_EXPORT_LIST
 static int export_flag;                 /* true if -bE */
+static int aix64_flag;                 /* true if -b64 */
 #endif
 
 int debug;                             /* true if -debug */
@@ -1264,6 +1265,8 @@ main (argc, argv)
            case 'b':
              if (arg[2] == 'E' || strncmp (&arg[2], "export", 6) == 0)
                 export_flag = 1;
+             if (arg[2] == '6' && arg[3] == '4')
+               aix64_flag = 1;
              break;
 #endif
 
@@ -2798,7 +2801,9 @@ scan_libraries (prog_name)
      (((X).n_sclass == C_EXT) && ((X).n_scnum == N_UNDEF))
 #   define GCC_SYMINC(X)       ((X).n_numaux+1)
 #   define GCC_SYMZERO(X)      0
-#   define GCC_CHECK_HDR(X)    (1)
+#   define GCC_CHECK_HDR(X) \
+     ((HEADER (X).f_magic == U802TOCMAGIC && ! aix64_flag) \
+      || (HEADER (X).f_magic == 0757 && aix64_flag))
 #endif
 
 extern char *ldgetname ();
@@ -2841,18 +2846,19 @@ scan_prog_file (prog_name, which_pass)
 #endif
       if ((ldptr = ldopen (prog_name, ldptr)) != NULL)
        {
-
-         if (!MY_ISCOFF (HEADER (ldptr).f_magic))
+         if (! MY_ISCOFF (HEADER (ldptr).f_magic))
            fatal ("%s: not a COFF file", prog_name);
 
-#ifdef COLLECT_EXPORT_LIST
-         /* Is current archive member a shared object?  */
-         is_shared = HEADER (ldptr).f_flags & F_SHROBJ;
-#endif
          if (GCC_CHECK_HDR (ldptr))
            {
              sym_count = GCC_SYMBOLS (ldptr);
              sym_index = GCC_SYMZERO (ldptr);
+
+#ifdef COLLECT_EXPORT_LIST
+             /* Is current archive member a shared object?  */
+             is_shared = HEADER (ldptr).f_flags & F_SHROBJ;
+#endif
+
              while (sym_index < sym_count)
                {
                  GCC_SYMENT symbol;
@@ -2970,6 +2976,16 @@ scan_prog_file (prog_name, which_pass)
 #endif
                }
            }
+#ifdef COLLECT_EXPORT_LIST
+         else
+           {
+             /* If archive contains both 32-bit and 64-bit objects,
+                we want to skip objects in other mode so mismatch normal.  */
+             if (debug)
+               fprintf (stderr, "%s : magic=%o aix64=%d mismatch\n",
+                        prog_name, HEADER (ldptr).f_magic, aix64_flag);
+           }
+#endif
        }
       else
        {