summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edelsohn <edelsohn@mhpcc.edu>1998-10-28 19:18:09 +0000
committerJeff Law <law@gcc.gnu.org>1998-10-28 12:18:09 -0700
commitb6d4d480910d3e1c9cc524e45364d6e5ca8f4647 (patch)
tree174cc9f55a8d74afecb840a65a9474246eeb72b4
parentec7bdb51e5b7fe1b926433051fc69d61482b87c3 (diff)
downloadgcc-b6d4d480910d3e1c9cc524e45364d6e5ca8f4647.tar.gz
collect2.c (aix64_flag): New variable.
* 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. * README.RS6000: Update. From-SVN: r23408
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/README.RS600013
-rw-r--r--gcc/collect2.c30
3 files changed, 45 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 155a2b84f94..af620b2bc34 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+ * README.RS6000: Update.
+
Sun Oct 25 23:36:52 1998 Jason Merrill <jason@yorick.cygnus.com>
* stmt.c (expand_fixup): Set fixup->before_jump to a
diff --git a/gcc/README.RS6000 b/gcc/README.RS6000
index fde55b01782..5e8225e4f09 100644
--- a/gcc/README.RS6000
+++ b/gcc/README.RS6000
@@ -1,3 +1,16 @@
+ AIX 4.3 archive libraries
+
+AIX 4.3 utilizes a new "large format" archive to support both 32-bit and
+64-bit object modules. The routines provided in AIX 4.3.0 and AIX 4.3.1
+to parse archive libraries did not handle the new format correctly. These
+routines are used by GCC and result in error messages during linking such
+as "not a COFF file". The version of the routines shipped with AIX 4.3.1
+should work for a 32-bit environment. The "-g" option of the archive
+command may be used to create archives of 32-bit objects using the
+original "small format". A correct version of the routines is shipped
+with AIX 4.3.2.
+
+
AIX 4.3 assembler
The AIX 4.3.0.0 assembler generates incorrect object files if the ".bs"
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 539e088472f..4fcbe73a437 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -198,6 +198,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 */
@@ -1194,6 +1195,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
@@ -2669,7 +2672,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 ();
@@ -2712,18 +2717,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;
@@ -2841,6 +2847,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
{