diff options
author | obrien <obrien@FreeBSD.org> | 2002-10-11 06:01:20 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-10-11 06:01:20 +0000 |
commit | aae950e69caf1dc3f308b74fe6d066a645a7ed09 (patch) | |
tree | fc657a1fb5e0ceeb952b5e5ad8744fec0332849c /contrib/binutils/bfd/archive.c | |
parent | dcf134d53b2ddea66d0fe9fba4e8950a7c07b312 (diff) | |
download | FreeBSD-src-aae950e69caf1dc3f308b74fe6d066a645a7ed09.zip FreeBSD-src-aae950e69caf1dc3f308b74fe6d066a645a7ed09.tar.gz |
Import of Binutils from the FSF 2.13 branch (just pre-.1 release).
These bits are taken from the FSF anoncvs repo on 11-Oct-2002 22:39:35 PDT.
Diffstat (limited to 'contrib/binutils/bfd/archive.c')
-rw-r--r-- | contrib/binutils/bfd/archive.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/contrib/binutils/bfd/archive.c b/contrib/binutils/bfd/archive.c index e9e07c5..d7ac214 100644 --- a/contrib/binutils/bfd/archive.c +++ b/contrib/binutils/bfd/archive.c @@ -603,8 +603,6 @@ bfd_generic_archive_p (abfd) char armag[SARMAG + 1]; bfd_size_type amt; - tdata_hold = abfd->tdata.aout_ar_data; - if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG) { if (bfd_get_error () != bfd_error_system_call) @@ -621,13 +619,15 @@ bfd_generic_archive_p (abfd) return 0; #endif - /* We are setting bfd_ardata(abfd) here, but since bfd_ardata - involves a cast, we can't do it as the left operand of assignment. */ - amt = sizeof (struct artdata); - abfd->tdata.aout_ar_data = (struct artdata *) bfd_zalloc (abfd, amt); + tdata_hold = bfd_ardata (abfd); + amt = sizeof (struct artdata); + bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt); if (bfd_ardata (abfd) == NULL) - return NULL; + { + bfd_ardata (abfd) = tdata_hold; + return NULL; + } bfd_ardata (abfd)->first_file_filepos = SARMAG; bfd_ardata (abfd)->cache = NULL; @@ -636,21 +636,13 @@ bfd_generic_archive_p (abfd) bfd_ardata (abfd)->extended_names = NULL; bfd_ardata (abfd)->tdata = NULL; - if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd))) + if (!BFD_SEND (abfd, _bfd_slurp_armap, (abfd)) + || !BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) { - bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); - return NULL; - } - - if (!BFD_SEND (abfd, _bfd_slurp_extended_name_table, (abfd))) - { bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); + bfd_ardata (abfd) = tdata_hold; return NULL; } @@ -686,9 +678,9 @@ bfd_generic_archive_p (abfd) release bfd_ardata. FIXME. */ (void) bfd_close (first); bfd_release (abfd, bfd_ardata (abfd)); - abfd->tdata.aout_ar_data = tdata_hold; #endif bfd_set_error (bfd_error_wrong_object_format); + bfd_ardata (abfd) = tdata_hold; return NULL; } /* And we ought to close `first' here too. */ @@ -1746,7 +1738,7 @@ _bfd_write_archive_contents (arch) if (makemap && hasobjects) { - if (_bfd_compute_and_write_armap (arch, (unsigned int) elength) != true) + if (! _bfd_compute_and_write_armap (arch, (unsigned int) elength)) return false; } @@ -1876,8 +1868,8 @@ _bfd_compute_and_write_armap (arch, elength) current != (bfd *) NULL; current = current->next, elt_no++) { - if ((bfd_check_format (current, bfd_object) == true) - && ((bfd_get_file_flags (current) & HAS_SYMS))) + if (bfd_check_format (current, bfd_object) + && (bfd_get_file_flags (current) & HAS_SYMS) != 0) { long storage; long symcount; |