aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-07-14 07:07:46 +0000
committerNick Clifton <nickc@redhat.com>2005-07-14 07:07:46 +0000
commit15ac1d4f68f6ee5be2df0e125b101759f27dfd12 (patch)
tree3aa9b3136a8d379dad86fef7c5be3e20e18171fd
parent1d9c9cd779b490a3934235b2a6bf18b9282e3642 (diff)
downloadfsf-binutils-gdb-15ac1d4f68f6ee5be2df0e125b101759f27dfd12.zip
fsf-binutils-gdb-15ac1d4f68f6ee5be2df0e125b101759f27dfd12.tar.gz
fsf-binutils-gdb-15ac1d4f68f6ee5be2df0e125b101759f27dfd12.tar.bz2
Add code to detect and either handle or issue an error message for binaries
created by the DEC ALPHA compilers.
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/coff-alpha.c17
-rw-r--r--include/coff/ChangeLog5
-rw-r--r--include/coff/alpha.h5
-rw-r--r--include/coff/ecoff.h4
5 files changed, 34 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fea84de..65d1668 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2005-07-14 Daniel Marques <marques@cs.cornell.edu>
+ Nick Clifton <nickc@redhat.com>
+
+ * coff-alpha.c (alpha_ecoff_bad_format_hook): Detect compressed
+ Alpha binaries and issue a helpful error message.
+ (alpha_ecoff_swap_reloc_out): Increase maximum allowed internal
+ symbol index to 15 to allow for binaries produced by DEC
+ compilers.
+
2005-07-13 Steve Ellcey <sje@cup.hp.com>
* bfd.m4 (BFD_NEED_DECLARATION): Remove.
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 444385e..19aeb96 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -481,10 +481,16 @@ alpha_ecoff_bad_format_hook (abfd, filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
- if (ALPHA_ECOFF_BADMAG (*internal_f))
- return FALSE;
+ if (! ALPHA_ECOFF_BADMAG (*internal_f))
+ return TRUE;
- return TRUE;
+ if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
+ (*_bfd_error_handler)
+ (_("%B: Cannot handle compressed Alpha binaries.\n"
+ " Use compiler flags, or objZ, to generate uncompressed binaries."),
+ abfd);
+
+ return FALSE;
}
/* This is a hook called by coff_real_object_p to create any backend
@@ -603,8 +609,11 @@ alpha_ecoff_swap_reloc_out (abfd, intern, dst)
size = intern->r_size;
}
+ /* XXX FIXME: The maximum symndx value used to be 14 but this
+ fails with object files prodiced by DEC's C++ compiler.
+ Where does the value 14 (or 15) come from anyway ? */
BFD_ASSERT (intern->r_extern
- || (intern->r_symndx >= 0 && intern->r_symndx <= 14));
+ || (intern->r_symndx >= 0 && intern->r_symndx <= 15));
H_PUT_64 (abfd, intern->r_vaddr, ext->r_vaddr);
H_PUT_32 (abfd, symndx, ext->r_symndx);
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index 822beb1..c4ff60d 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-14 Daniel Marques <marques@cs.cornell.edu>
+
+ * alpha.h (ALPHA_ECOFF_COMPRESSEDMAG): Define.
+ * ecoff.h (ALPHA_MAGIC_COMPRESSED): Define.
+
2005-05-10 Nick Clifton <nickc@redhat.com>
* Update the address and phone number of the FSF organization in
diff --git a/include/coff/alpha.h b/include/coff/alpha.h
index 3b00c92..7433938 100644
--- a/include/coff/alpha.h
+++ b/include/coff/alpha.h
@@ -1,7 +1,7 @@
/* ECOFF support on Alpha machines.
coff/ecoff.h must be included before this file.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,6 +34,9 @@ struct external_filehdr
#define ALPHA_ECOFF_BADMAG(x) \
((x).f_magic != ALPHA_MAGIC && (x).f_magic != ALPHA_MAGIC_BSD)
+#define ALPHA_ECOFF_COMPRESSEDMAG(x) \
+ ((x).f_magic == ALPHA_MAGIC_COMPRESSED)
+
/* The object type is encoded in the f_flags. */
#define F_ALPHA_OBJECT_TYPE_MASK 0x3000
#define F_ALPHA_NO_SHARED 0x1000
diff --git a/include/coff/ecoff.h b/include/coff/ecoff.h
index 4bd8a6c..d4d3fa5 100644
--- a/include/coff/ecoff.h
+++ b/include/coff/ecoff.h
@@ -2,7 +2,7 @@
This does not include symbol information, found in sym.h and
symconst.h.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -41,6 +41,8 @@
/* Alpha magic numbers used in filehdr. */
#define ALPHA_MAGIC 0x183
#define ALPHA_MAGIC_BSD 0x185
+/* A compressed version of an ALPHA_MAGIC file created by DEC's tools. */
+#define ALPHA_MAGIC_COMPRESSED 0x188
/* Magic numbers used in a.out header. */
#define ECOFF_AOUT_OMAGIC 0407 /* not demand paged (ld -N). */