diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-04-20 18:38:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-04-20 18:38:22 +0000 |
commit | 476d01f08af3be7554b3214a08c17d605ed0181f (patch) | |
tree | c9f834c6bd15010cfcd36a8ded1a4e37eeb2e9b0 /bfd/nlmcode.h | |
parent | c59fa195b80e304f96f09593053a65ac46583011 (diff) | |
download | gdb-476d01f08af3be7554b3214a08c17d605ed0181f.zip gdb-476d01f08af3be7554b3214a08c17d605ed0181f.tar.gz gdb-476d01f08af3be7554b3214a08c17d605ed0181f.tar.bz2 |
start-sanitize-powerpc-netware
* nlm32-ppc.c: Complete rewrite for new version of PowerPC
NetWare. Old code still present, but ifdeffed out.
end-sanitize-powerpc-netware
* nlmcode.h (nlm_swap_auxiliary_headers_in): Don't assume a
particular format for the customer header. Allocate a block of
memory and read it into that.
(nlm_swap_auxiliary_headers_out): Write out the block of memory.
(nlm_compute_section_file_positions): Include length of customer
header when computing its size.
Diffstat (limited to 'bfd/nlmcode.h')
-rw-r--r-- | bfd/nlmcode.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h index 13e4319..61e748f 100644 --- a/bfd/nlmcode.h +++ b/bfd/nlmcode.h @@ -491,16 +491,20 @@ nlm_swap_auxiliary_headers_in (abfd) else if (strncmp (tempstr, "CuStHeAd", 8) == 0) { Nlm_External_Custom_Header thdr; - if (bfd_read ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) - return (false); + if (bfd_read ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + return false; memcpy (nlm_custom_header (abfd)->stamp, thdr.stamp, sizeof (thdr.stamp)); nlm_custom_header (abfd)->dataLength = get_word (abfd, (bfd_byte *) thdr.dataLength); - nlm_custom_header (abfd)->debugRecOffset = - get_word (abfd, (bfd_byte *) thdr.debugRecOffset); - nlm_custom_header (abfd)->debugRecLength = - get_word (abfd, (bfd_byte *) thdr.debugRecLength); + nlm_custom_header (abfd)->data = + bfd_alloc (abfd, nlm_custom_header (abfd)->dataLength); + if (nlm_custom_header (abfd)->data == NULL) + return false; + if (bfd_read (nlm_custom_header (abfd)->data, 1, + nlm_custom_header (abfd)->dataLength, abfd) + != nlm_custom_header (abfd)->dataLength) + return false; } else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0) { @@ -685,11 +689,11 @@ nlm_swap_auxiliary_headers_out (abfd) memcpy (thdr.stamp, "CuStHeAd", 8); put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->dataLength, (bfd_byte *) thdr.dataLength); - put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->debugRecOffset, - (bfd_byte *) thdr.debugRecOffset); - put_word (abfd, (bfd_vma) nlm_custom_header (abfd)->debugRecLength, - (bfd_byte *) thdr.debugRecLength); - if (bfd_write ((PTR) & thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + if (bfd_write ((PTR) &thdr, sizeof (thdr), 1, abfd) != sizeof (thdr)) + return false; + if (bfd_write (nlm_custom_header (abfd)->data, 1, + nlm_custom_header (abfd)->dataLength, abfd) + != nlm_custom_header (abfd)->dataLength) return false; } @@ -1249,7 +1253,8 @@ nlm_compute_section_file_positions (abfd) sofar += sizeof (Nlm_External_Extended_Header); if (find_nonzero ((PTR) nlm_custom_header (abfd), sizeof (Nlm_Internal_Custom_Header))) - sofar += sizeof (Nlm_External_Custom_Header); + sofar += (sizeof (Nlm_External_Custom_Header) + + nlm_custom_header (abfd)->dataLength); if (find_nonzero ((PTR) nlm_copyright_header (abfd), sizeof (Nlm_Internal_Copyright_Header))) sofar += (sizeof (Nlm_External_Copyright_Header) |