summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-04-16 14:23:41 +0000
committerTristan Gingold <gingold@adacore.com>2010-04-16 14:23:41 +0000
commita96f4e9a30f4f99085f49a9c55b2d783cb0cf317 (patch)
treebdbddf4b6ffc890249831aa76c7244d8d6e11145 /bfd
parent7b6b00aad65506010cb5b10e880df977a255b007 (diff)
downloadbinutils-redhat-a96f4e9a30f4f99085f49a9c55b2d783cb0cf317.tar.gz
2010-04-16 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (_bfd_vms_slurp_eihd): Fix typo. (_bfd_vms_get_object_record): Always assume there is a pad byte for alignment. * vms-lib.c: Add a few comments.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/vms-alpha.c17
-rw-r--r--bfd/vms-lib.c4
3 files changed, 15 insertions, 13 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 56f977b829..195590db76 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-16 Tristan Gingold <gingold@adacore.com>
+
+ * vms-alpha.c (_bfd_vms_slurp_eihd): Fix typo.
+ (_bfd_vms_get_object_record): Always assume there is a pad byte
+ for alignment.
+ * vms-lib.c: Add a few comments.
+
2010-04-15 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* elf32-arm.c (elf32_arm_merge_eabi_attributes): Support additions to
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index e213f4ee84..65dafa19da 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -492,7 +492,7 @@ _bfd_vms_slurp_eihd (bfd *abfd, unsigned int *eisd_offset,
size, imgtype, (unsigned long)symvva,
*eisd_offset, *eihs_offset));
- return FALSE;
+ return TRUE;
}
/* Read & process EISD record.
@@ -753,15 +753,12 @@ maybe_adjust_record_pointer_for_object (bfd *abfd)
static int
_bfd_vms_get_object_record (bfd *abfd)
{
- unsigned int test_len;
+ unsigned int test_len = 6;
int type;
- int off = 0;
vms_debug2 ((8, "_bfd_vms_get_obj_record\n"));
- test_len = 6;
-
- /* Skip odd alignment byte. */
+ /* Skip alignment byte if the current position is odd. */
if (bfd_tell (abfd) & 1)
{
if (bfd_bread (PRIV (recrd.buf), 1, abfd) != 1)
@@ -769,16 +766,10 @@ _bfd_vms_get_object_record (bfd *abfd)
bfd_set_error (bfd_error_file_truncated);
return -1;
}
- /* Alignment byte may be present or not. This is not easy to
- detect but all object record types are not 0 (on Alpha VMS).
- We also hope that pad byte is 0. */
- if (PRIV (recrd.buf)[0])
- off = 1;
}
/* Read the record header */
- if (bfd_bread (PRIV (recrd.buf) + off, test_len - off, abfd)
- != test_len - off)
+ if (bfd_bread (PRIV (recrd.buf), test_len, abfd) != test_len)
{
bfd_set_error (bfd_error_file_truncated);
return -1;
diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c
index 4f7da81d79..d05fab7081 100644
--- a/bfd/vms-lib.c
+++ b/bfd/vms-lib.c
@@ -557,6 +557,7 @@ vms_lib_bread_raw (struct bfd *abfd, void *buf, file_ptr nbytes)
if (!vms_lib_read_block (abfd))
return -1;
+ /* Do not read past the data block, do not read more than requested. */
l = DATA__LENGTH - vec->blk_off;
if (l > nbytes)
l = nbytes;
@@ -564,11 +565,13 @@ vms_lib_bread_raw (struct bfd *abfd, void *buf, file_ptr nbytes)
return 0;
if (buf != NULL)
{
+ /* Really read into BUF. */
if (bfd_bread (buf, l, abfd->my_archive) != l)
return -1;
}
else
{
+ /* Make as if we are reading. */
if (bfd_seek (abfd->my_archive, l, SEEK_CUR) != 0)
return -1;
}
@@ -818,6 +821,7 @@ vms_lib_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
if (vec->rec_rem == 0)
{
+ /* End of record reached. */
if (bfd_libdata (abfd->my_archive)->kind == vms_lib_txt)
{
if ((vec->rec_len & 1) == 1