aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-alpha.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-01-25 01:52:48 +0000
committerIan Lance Taylor <ian@airs.com>1994-01-25 01:52:48 +0000
commit3f048f7ff93498de36e35e49cf736cd2f5ddf7b7 (patch)
treef651d149496ad9460eb6b72b61a561ca16c21a2e /bfd/coff-alpha.c
parent1fe2801ae61d3c10ea6f3714fbff930640fdadbf (diff)
downloadgdb-3f048f7ff93498de36e35e49cf736cd2f5ddf7b7.zip
gdb-3f048f7ff93498de36e35e49cf736cd2f5ddf7b7.tar.gz
gdb-3f048f7ff93498de36e35e49cf736cd2f5ddf7b7.tar.bz2
* coff-alpha.c (alpha_ecoff_object_p): New function. Set size of
.pdata section based on lnnoptr field, not section header. (alpha_relocate_section): Don't bother to check if r_symndx >= 0, since it is unsigned. (ecoffalpha_little_vec): Use alpha_ecoff_object_p rather than coff_object_p. * ecoff.c (ecoff_new_section_hook): Set alignment_power field of .pdata section to 3. (ecoff_compute_section_file_positions): Save the size of the .pdata section in the line_filepos field, and actually align the .pdata section to an alignment power of 4. (ecoff_compute_reloc_file_positions): Set output_has_begun after calling ecoff_compute_section_file_positions. (ecoff_write_object_contents): Set s_lnnoptr for the .pdata section from the line_filepos field. Set vstamp for the optional header from the vstamp of the symbolic header. (ecoff_bfd_final_link): Set vstamp of the symbolic header to the vstamp used by the first object file in the link.
Diffstat (limited to 'bfd/coff-alpha.c')
-rw-r--r--bfd/coff-alpha.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 5a35d7d..7a220d0 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -33,6 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Prototypes for static functions. */
+static bfd_target *alpha_ecoff_object_p PARAMS ((bfd *));
static boolean alpha_ecoff_bad_format_hook PARAMS ((bfd *abfd, PTR filehdr));
static void alpha_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
struct internal_reloc *));
@@ -401,6 +402,45 @@ static reloc_howto_type alpha_howto_table[] =
false) /* pcrel_offset */
};
+/* Recognize an Alpha ECOFF file. */
+
+static bfd_target *
+alpha_ecoff_object_p (abfd)
+ bfd *abfd;
+{
+ static bfd_target *ret;
+
+ ret = coff_object_p (abfd);
+
+ if (ret != (bfd_target *) NULL)
+ {
+ asection *sec;
+
+ /* Alpha ECOFF has a .pdata section. The lnnoptr field of the
+ .pdata section is the number of entries it contains. Each
+ entry takes up 8 bytes. The number of entries is required
+ since the section is aligned to a 16 byte boundary. When we
+ link .pdata sections together, we do not want to include the
+ alignment bytes. We handle this on input by faking the size
+ of the .pdata section to remove the unwanted alignment bytes.
+ On output we will set the lnnoptr field and force the
+ alignment. */
+ sec = bfd_get_section_by_name (abfd, _PDATA);
+ if (sec != (asection *) NULL)
+ {
+ bfd_size_type size;
+
+ size = sec->line_filepos * 8;
+ BFD_ASSERT (size == bfd_section_size (abfd, sec)
+ || size + 8 == bfd_section_size (abfd, sec));
+ if (! bfd_set_section_size (abfd, sec, size))
+ return NULL;
+ }
+ }
+
+ return ret;
+}
+
/* See whether the magic number matches. */
static boolean
@@ -1638,7 +1678,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
}
else
{
- if (r_symndx < 0 || r_symndx >= NUM_RELOC_SECTIONS)
+ if (r_symndx >= NUM_RELOC_SECTIONS)
s = NULL;
else
s = symndx_to_section[r_symndx];
@@ -1919,7 +1959,7 @@ bfd_target ecoffalpha_little_vec =
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
- {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
+ {_bfd_dummy_target, alpha_ecoff_object_p, /* bfd_check_format */
ecoff_archive_p, _bfd_dummy_target},
{bfd_false, ecoff_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},