]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* aout-adobe.c, aoutf1.h, archive.c, bout.c, coff-rs6000.c,
authorJohn Gilmore <gnu@cygnus>
Thu, 15 Oct 1992 09:00:09 +0000 (09:00 +0000)
committerJohn Gilmore <gnu@cygnus>
Thu, 15 Oct 1992 09:00:09 +0000 (09:00 +0000)
coffcode.h, elf.c, ieee.c, libaout.h, libbfd.c, oasys.c,
sco-core.c:  Lint:  Second argument of bfd_seek is always file_ptr.
Third argument is SEEK_SET or SEEK_CUR.  Result is always 0 or -1.

13 files changed:
bfd/ChangeLog
bfd/aout-adobe.c
bfd/aoutf1.h
bfd/archive.c
bfd/bout.c
bfd/coff-rs6000.c
bfd/coffcode.h
bfd/elf.c
bfd/ieee.c
bfd/libaout.h
bfd/libbfd.c
bfd/oasys.c
bfd/sco-core.c

index 22aa069fc9a946803cdb624e55c72232a54ec848..e69851efb36089a5f12b962eeee038a3b1c3aac3 100644 (file)
@@ -1,3 +1,10 @@
+Thu Oct 15 01:32:22 1992  John Gilmore  (gnu@cygnus.com)
+
+       * aout-adobe.c, aoutf1.h, archive.c, bout.c, coff-rs6000.c,
+       coffcode.h, elf.c, ieee.c, libaout.h, libbfd.c, oasys.c,
+       sco-core.c:  Lint:  Second argument of bfd_seek is always file_ptr.
+       Third argument is SEEK_SET or SEEK_CUR.  Result is always 0 or -1.
+
 Fri Oct  9 03:46:37 1992  John Gilmore  (gnu@cygnus.com)
 
        * configure.host:  New file, contains mapping of host configs
index 526d7f87febe410308e811fb9eaa95817938b10a..6a7fb823994aa5580aa57f028d04b7511e43f29c 100644 (file)
@@ -309,7 +309,7 @@ aout_adobe_write_object_contents (abfd)
 
   aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
 
-  bfd_seek (abfd, 0L, SEEK_SET);
+  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
   bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd);
 
   /* Now write out the section information.  Text first, data next, rest
@@ -337,12 +337,11 @@ aout_adobe_write_object_contents (abfd)
   /* Now write out reloc info, followed by syms and strings */
   if (bfd_get_symcount (abfd) != 0) 
     {
-      bfd_seek (abfd,
-               (long)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
 
       aout_32_write_syms (abfd);
 
-      bfd_seek (abfd, (long)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET);
 
       for (sect = abfd->sections; sect; sect = sect->next) {
         if (sect->flags & SEC_CODE)    {
@@ -351,7 +350,7 @@ aout_adobe_write_object_contents (abfd)
         }
       }
 
-      bfd_seek (abfd, (long)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET);
 
       for (sect = abfd->sections; sect; sect = sect->next) {
         if (sect->flags & SEC_DATA)    {
index e7aa1ed252a825b8411b5227d96b9977ce250337..da933cde38044942eeb6a4363c7ce84a7ca77ec6 100644 (file)
@@ -393,7 +393,7 @@ DEFUN(sunos4_core_file_p,(abfd),
   if (core_size > 20000)
     return 0;
 
-  if (bfd_seek (abfd, 0L, false) < 0) return 0;
+  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) < 0) return 0;
 
   mergem = (struct mergem *)bfd_zalloc (abfd, core_size + sizeof (struct mergem));
   if (mergem == NULL) {
index 747745aa6ab090684451af2cec309fe5631b46c3..a46372c63ac75e222eeee772da028e8f703d0c6b 100644 (file)
@@ -562,7 +562,7 @@ bfd_slurp_bsd_armap (abfd)
        but fail for any other size... */
     if (bfd_read ((PTR)nextname, 1, 16, abfd) == 16) {
            /* The archive has at least 16 bytes in it */
-           bfd_seek (abfd, -16L, SEEK_CUR);
+           bfd_seek (abfd, (file_ptr) -16, SEEK_CUR);
 
            /* This should be using RANLIBMAG, but at least it can be grepped for
               in this comment.  */
@@ -637,7 +637,7 @@ bfd_slurp_coff_armap (abfd)
   bfd_vma (*swap)();
   
   result = bfd_read ((PTR)&nextname, 1, 1, abfd);
-  bfd_seek (abfd, -1L, SEEK_CUR);
+  bfd_seek (abfd, (file_ptr) -1, SEEK_CUR);
 
   if (result != 1 || nextname != '/') {
     /* Actually I think this is an error for a COFF archive */
@@ -755,7 +755,7 @@ _bfd_slurp_extended_name_table (abfd)
      we probably don't want to return true.  */
   if (bfd_read ((PTR)nextname, 1, 16, abfd) == 16) {
 
-    bfd_seek (abfd, -16L, SEEK_CUR);
+    bfd_seek (abfd, (file_ptr) -16, SEEK_CUR);
 
     if (strncmp (nextname, "ARFILENAMES/    ", 16) != 0 &&
        strncmp (nextname, "//              ", 16) != 0) 
@@ -1172,7 +1172,7 @@ _bfd_write_archive_contents (arch)
   if (!bfd_construct_extended_name_table (arch, &etable, &elength))
     return false;
 
-  bfd_seek (arch, 0, SEEK_SET);
+  bfd_seek (arch, (file_ptr) 0, SEEK_SET);
 #ifdef GNU960
   bfd_write (BFD_GNU960_ARMAG(arch), 1, SARMAG, arch);
 #else
@@ -1212,7 +1212,7 @@ _bfd_write_archive_contents (arch)
        bfd_error = system_call_error;
        return false;
       }
-    if (bfd_seek (current, 0L, SEEK_SET) != 0L) goto syserr;
+    if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0) goto syserr;
     while (remaining) 
        {
          unsigned int amt = DEFAULT_BUFFERSIZE;
index 0e3c0ecf7a0444c0dd7fe8540c7856875f2079e1..020ca1390860587b8ee7af1463923eacda7c931a 100644 (file)
@@ -238,21 +238,20 @@ b_out_write_object_contents (abfd)
 
   bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
 
-  bfd_seek (abfd, 0L, SEEK_SET);
+  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
   bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd);
 
   /* Now write out reloc info, followed by syms and strings */
   if (bfd_get_symcount (abfd) != 0) 
     {
-      bfd_seek (abfd,
-               (long)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
 
       aout_32_write_syms (abfd);
 
-      bfd_seek (abfd,  (long)(N_TROFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_TROFF(*exec_hdr(abfd))), SEEK_SET);
 
       if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
-      bfd_seek (abfd, (long)(N_DROFF(*exec_hdr(abfd))), SEEK_SET);
+      bfd_seek (abfd, (file_ptr)(N_DROFF(*exec_hdr(abfd))), SEEK_SET);
 
       if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd))) return false;
     }
@@ -459,7 +458,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
   return false;
 
  doit:
-  bfd_seek (abfd, (long)(asect->rel_filepos),  SEEK_SET);
+  bfd_seek (abfd, (file_ptr)(asect->rel_filepos),  SEEK_SET);
   count = reloc_size / sizeof (struct relocation_info);
 
   relocs = (struct relocation_info *) bfd_xmalloc (reloc_size);
index 8ee70d63f295b94448f2310388cd7a235904e650..0d6d4f31b650356efce18f6d1425e1feb447f104 100644 (file)
@@ -171,7 +171,7 @@ rs6000coff_get_elt_at_filepos (archive, filepos)
   n_nfd = look_for_bfd_in_cache (archive, filepos);
   if (n_nfd) return n_nfd;
 
-  if (0 > bfd_seek (archive, filepos, SEEK_SET)) {
+  if (0 != bfd_seek (archive, filepos, SEEK_SET)) {
     bfd_error = system_call_error;
     return NULL;
   }
index a104051e2451f1ca9d5a5fa254e10c39fad1a122..6b311f958b91d0957effc81dd9667e1e6a97775d 100644 (file)
@@ -1230,7 +1230,7 @@ DEFUN(coff_object_p,(abfd),
   }
 
   /* Seek past the opt hdr stuff */
-  bfd_seek(abfd, internal_f.f_opthdr + FILHSZ, SEEK_SET);
+  bfd_seek(abfd, (file_ptr) (internal_f.f_opthdr + FILHSZ), SEEK_SET);
 
   /* if the optional header is NULL or not the correct size then
      quit; the only difference I can see between m88k dgux headers (MC88DMAGIC)
@@ -2263,15 +2263,10 @@ coff_section_symbol (abfd, name)
      bfd *abfd;
      char *name;
 {
-  asection *sec = bfd_get_section_by_name (abfd, name);
+  asection *sec = bfd_make_section_old_way (abfd, name);
   asymbol *sym;
   combined_entry_type *csym;
 
-  if (!sec)
-    {
-      /* create empty symbol */
-      abort ();
-    }
   sym = sec->symbol;
   if (coff_symbol_from (abfd, sym))
     csym = coff_symbol_from (abfd, sym)->native;
@@ -2409,10 +2404,6 @@ DEFUN(coff_write_object_contents,(abfd),
       current->target_index = count;
       count++;
   }
-  
-    
-
-
 
   if(abfd->output_has_begun == false) {
       coff_compute_section_file_positions(abfd);
@@ -2696,7 +2687,7 @@ DEFUN(coff_write_object_contents,(abfd),
   internal_f.f_nsyms =  bfd_get_symcount(abfd);
 
   /* now write them */
-  if (bfd_seek(abfd, 0L, SEEK_SET) != 0)
+  if (bfd_seek(abfd, (file_ptr) 0, SEEK_SET) != 0)
    return false;
 {
   FILHDR buff;
index 1c3fd092e697d46637c19319d554663579db8020..7f3a43066e2ac75fe6cab355ac359bd3ed509dee 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -947,7 +947,7 @@ DEFUN(elf_corefile_note, (abfd, hdr),
 
   if (hdr -> p_filesz > 0
       && (buf = (char *) bfd_xmalloc (hdr -> p_filesz)) != NULL
-      && bfd_seek (abfd, hdr -> p_offset, SEEK_SET) != -1L
+      && bfd_seek (abfd, hdr -> p_offset, SEEK_SET) != -1
       && bfd_read ((PTR) buf, hdr -> p_filesz, 1, abfd) == hdr -> p_filesz)
     {
       x_note_p = (Elf_External_Note *) buf;
@@ -1788,7 +1788,7 @@ DEFUN (elf_write_object_contents, (abfd), bfd *abfd)
 
   /* swap the header before spitting it out... */
   elf_swap_ehdr_out (abfd, i_ehdrp, &x_ehdr);
-  bfd_seek (abfd, 0L, SEEK_SET);
+  bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
   bfd_write ((PTR) &x_ehdr, sizeof(x_ehdr), 1, abfd);
 
   outbase += i_ehdrp->e_shentsize * i_ehdrp->e_shnum;
@@ -1828,7 +1828,7 @@ DEFUN (elf_write_object_contents, (abfd), bfd *abfd)
     }
   
   /* sample use of bfd:
-   * bfd_seek (abfd, 0L, false);
+   * bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
    * bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd);
    * if (bfd_seek(abfd, scn_base, SEEK_SET) != 0)
    * return false;
index 09d268b8a8a10ed6a0212a0e53443715d9db212a..87e15eedccd619c4e1c3c781c08580232b9a4bfe 100644 (file)
@@ -992,7 +992,7 @@ DEFUN(ieee_archive_p,(abfd),
   unsigned int i;
 uint8e_type buffer[512];
   struct obstack ob;
-  int buffer_offset = 0;
+  file_ptr buffer_offset = 0;
   ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
   ieee_ar_data_type *ieee ;
   abfd->tdata.ieee_ar_data = (ieee_ar_data_type *)bfd_alloc(abfd, sizeof(ieee_ar_data_type));
@@ -1113,7 +1113,7 @@ DEFUN(ieee_object_p,(abfd),
   ieee_mkobject(abfd);
   
   ieee = IEEE_DATA(abfd);
-  bfd_seek(abfd, 0, 0);
+  bfd_seek(abfd, (file_ptr) 0, SEEK_SET);
   /* Read the first few bytes in to see if it makes sense */
   bfd_read((PTR)buffer, 1, sizeof(buffer), abfd);
 
@@ -1185,7 +1185,7 @@ DEFUN(ieee_object_p,(abfd),
 
   IEEE_DATA(abfd)->h.first_byte = (uint8e_type *) bfd_alloc(ieee->h.abfd, ieee->w.r.me_record
                                            + 50);
-  bfd_seek(abfd, 0, 0);
+  bfd_seek(abfd, (file_ptr) 0, SEEK_SET);
   bfd_read((PTR)(IEEE_DATA(abfd)->h.first_byte), 1,   ieee->w.r.me_record+50,  abfd);
 
   ieee_slurp_sections(abfd);
@@ -2706,19 +2706,13 @@ DEFUN(ieee_write_object_contents,(abfd),
   unsigned int i;
   file_ptr   old;
   /* Fast forward over the header area */
-  bfd_seek(abfd, 0, 0);
+  bfd_seek(abfd, (file_ptr) 0, SEEK_SET);
   ieee_write_byte(abfd, ieee_module_beginning_enum);
 
   ieee_write_id(abfd, bfd_printable_name(abfd));
   ieee_write_id(abfd, abfd->filename);
 
-
-
-
   /* Fast forward over the variable bits */    
-
-
-
   ieee_write_byte(abfd, ieee_address_descriptor_enum);
 
   /* Bits per MAU */
@@ -2727,10 +2721,8 @@ DEFUN(ieee_write_object_contents,(abfd),
   ieee_write_byte(abfd, bfd_arch_bits_per_address(abfd)  /
                  bfd_arch_bits_per_byte(abfd));
 
-
   old = bfd_tell(abfd);
-  bfd_seek(abfd, 8 * N_W_VARIABLES, 1);
-
+  bfd_seek(abfd, (file_ptr) (8 * N_W_VARIABLES), SEEK_CUR);
 
   ieee->w.r.extension_record = bfd_tell(abfd);
   bfd_write((char *)exten, 1, sizeof(exten), abfd);
@@ -2776,7 +2768,7 @@ DEFUN(ieee_write_object_contents,(abfd),
 
 
   /* Generate the header */
-  bfd_seek(abfd, old, false);
+  bfd_seek(abfd, old, SEEK_SET);
 
   for (i= 0; i < N_W_VARIABLES; i++) {
     ieee_write_2bytes(abfd,ieee_assign_value_to_variable_enum);
index c37ae7e9154eb6fc82861ad6bba242940792936c..52b47ed299d8ea7776c552f9123c1c4806c8c80b 100644 (file)
@@ -290,21 +290,20 @@ PROTO(char *, aout_stab_name, (int code));
                           obj_reloc_entry_size (abfd));                      \
        NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);           \
                                                                              \
-       bfd_seek (abfd, 0L, false);                                           \
+       bfd_seek (abfd, (file_ptr) 0, SEEK_SET);                              \
        bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd);              \
        /* Now write out reloc info, followed by syms and strings */          \
                                                                              \
        if (bfd_get_symcount (abfd) != 0)                                     \
            {                                                                 \
-             bfd_seek (abfd,                                                 \
-                       (long)(N_SYMOFF(*execp)), false);                     \
+             bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET);        \
                                                                              \
              NAME(aout,write_syms)(abfd);                                    \
                                                                              \
-             bfd_seek (abfd,   (long)(N_TRELOFF(*execp)), false);            \
+             bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET);       \
                                                                              \
              if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false; \
-             bfd_seek (abfd, (long)(N_DRELOFF(*execp)), false);              \
+             bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET);       \
                                                                              \
              if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) return false; \
            }                                                                 \
index 394ac5e6cfc38a6e7e6386a49d904f85ac9b441b..f48b78fd06ff9b2a821101c22ce62671e72b7c61 100644 (file)
@@ -18,14 +18,19 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-/* $Id$ */
-
 #include "bfd.h"
 #include "sysdep.h"
 #include "libbfd.h"
 
-/** Dummies for targets that don't want or need to implement
-   certain operations */
+/*
+SECTION
+       libbfd
+
+DESCRIPTION
+       This file contains various routines which are used within BFD.
+       They are not intended for export, but are documented here for
+       completeness.
+*/
 
 boolean
 DEFUN(_bfd_dummy_new_section_hook,(ignore, ignore_newsect),
@@ -125,10 +130,18 @@ DEFUN(zalloc,(size),
 }
 #endif
 
-/*proto-internal* bfd_xmalloc
-bfd_xmalloc -- Like malloc, but exit if no more memory.
-*; PROTO(PTR, bfd_xmalloc,( bfd_size_type size));
+/*
+INTERNAL_FUNCTION
+       bfd_xmalloc
+
+SYNOPSIS
+       PTR  bfd_xmalloc( bfd_size_type size);
+
+DESCRIPTION
+       Like malloc, but exit if no more memory.
+
 */
+
 /** There is major inconsistency in how running out of memory is handled.
   Some routines return a NULL, and set bfd_error to no_memory.
   However, obstack routines can't do this ... */
@@ -137,11 +150,10 @@ bfd_xmalloc -- Like malloc, but exit if no more memory.
 DEFUN(PTR bfd_xmalloc,(size),
       bfd_size_type size)
 {
-  static char no_memory_message[] = "Virtual memory exhausted!\n";
+  static CONST char no_memory_message[] = "Virtual memory exhausted!\n";
   PTR ptr;
   if (size == 0) size = 1;
   ptr = (PTR)malloc(size);
-  if (ptr == NULL)
   if (!ptr)
     {
       write (2, no_memory_message, sizeof(no_memory_message)-1);
@@ -189,9 +201,18 @@ DEFUN(bfd_write,(ptr, size, nitems, abfd),
   return fwrite (ptr, 1, (int)(size*nitems), bfd_cache_lookup(abfd));
 }
 
-/*proto-internal* bfd_write_bigendian_4byte_int
+/*
+INTERNAL_FUNCTION
+       bfd_write_bigendian_4byte_int
+
+SYNOPSIS
+       void bfd_write_bigendian_4byte_int(bfd *abfd,  int i);
+
+DESCRIPTION
+       Writes a 4 byte integer to the outputing bfd, in big endian
+       mode regardless of what else is going on.  This is usefull in
+       archives.
 
-*; PROTO(void, bfd_write_bigendian_4byte_int,( bfd *abfd,  int i));
 */
 void
 DEFUN(bfd_write_bigendian_4byte_int,(abfd, i),
@@ -307,60 +328,69 @@ DEFUN(bfd_add_to_string_table,(table, new_string, table_length, free_ptr),
                              functions in swap.h #ifdef __GNUC__. 
                              Gprof them later and find out.  */
 
-/*proto*
-*i bfd_put_size
-*i bfd_get_size
-These macros as used for reading and writing raw data in sections;
-each access (except for bytes) is vectored through the target format
-of the BFD and mangled accordingly. The mangling performs any
-necessary endian translations and removes alignment restrictions.
-*+
-#define bfd_put_8(abfd, val, ptr) \
-                (*((char *)ptr) = (char)val)
-#define bfd_get_8(abfd, ptr) \
-                (*((char *)ptr))
-#define bfd_put_16(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx16, (val,ptr))
-#define bfd_get_16(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx16, (ptr))
-#define bfd_put_32(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx32, (val,ptr))
-#define bfd_get_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx32, (ptr))
-#define bfd_put_64(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_putx64, (val, ptr))
-#define bfd_get_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_getx64, (ptr))
-*-
-*-*/ 
-
-/*proto*
-*i bfd_h_put_size
-*i bfd_h_get_size
-These macros have the same function as their @code{bfd_get_x}
-bretherin, except that they are used for removing information for the
-header records of object files. Believe it or not, some object files
-keep their header records in big endian order, and their data in little
-endan order.
-*+
-#define bfd_h_put_8(abfd, val, ptr) \
-                (*((char *)ptr) = (char)val)
-#define bfd_h_get_8(abfd, ptr) \
-                (*((char *)ptr))
-#define bfd_h_put_16(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
-#define bfd_h_get_16(abfd, ptr) \
-                BFD_SEND(abfd, bfd_h_getx16,(ptr))
-#define bfd_h_put_32(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
-#define bfd_h_get_32(abfd, ptr) \
-                BFD_SEND(abfd, bfd_h_getx32,(ptr))
-#define bfd_h_put_64(abfd, val, ptr) \
-                BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
-#define bfd_h_get_64(abfd, ptr) \
-                BFD_SEND(abfd, bfd_h_getx64,(ptr))
-*-
-*-*/ 
+/*
+FUNCTION
+       bfd_put_size
+FUNCTION
+       bfd_get_size
+
+DESCRIPTION
+       These macros as used for reading and writing raw data in
+       sections; each access (except for bytes) is vectored through
+       the target format of the BFD and mangled accordingly. The
+       mangling performs any necessary endian translations and
+       removes alignment restrictions. 
+
+.#define bfd_put_8(abfd, val, ptr) \
+.                (*((char *)ptr) = (char)val)
+.#define bfd_get_8(abfd, ptr) \
+.                (*((char *)ptr))
+.#define bfd_put_16(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_putx16, (val,ptr))
+.#define bfd_get_16(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_getx16, (ptr))
+.#define bfd_put_32(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_putx32, (val,ptr))
+.#define bfd_get_32(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_getx32, (ptr))
+.#define bfd_put_64(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_putx64, (val, ptr))
+.#define bfd_get_64(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_getx64, (ptr))
+
+*/ 
+
+/*
+FUNCTION
+       bfd_h_put_size
+FUNCTION
+       bfd_h_get_size
+
+DESCRIPTION
+       These macros have the same function as their <<bfd_get_x>>
+       bretherin, except that they are used for removing information
+       for the header records of object files. Believe it or not,
+       some object files keep their header records in big endian
+       order, and their data in little endan order.
+
+.#define bfd_h_put_8(abfd, val, ptr) \
+.                (*((char *)ptr) = (char)val)
+.#define bfd_h_get_8(abfd, ptr) \
+.                (*((char *)ptr))
+.#define bfd_h_put_16(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
+.#define bfd_h_get_16(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_h_getx16,(ptr))
+.#define bfd_h_put_32(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
+.#define bfd_h_get_32(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_h_getx32,(ptr))
+.#define bfd_h_put_64(abfd, val, ptr) \
+.                BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
+.#define bfd_h_get_64(abfd, ptr) \
+.                BFD_SEND(abfd, bfd_h_getx64,(ptr))
+
+*/ 
 
 bfd_vma
 DEFUN(_do_getb16,(addr),
@@ -532,8 +562,8 @@ DEFUN(bfd_generic_get_section_contents, (abfd, section, location, offset, count)
 {
     if (count == 0)
         return true;
-    if ((bfd_size_type)(offset+count) > section->size
-        || bfd_seek(abfd,(file_ptr)( section->filepos + offset), SEEK_SET) == -1
+    if ((bfd_size_type)(offset+count) > section->_raw_size
+        || bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
         || bfd_read(location, (bfd_size_type)1, count, abfd) != count)
         return (false); /* on error */
     return (true);
@@ -553,19 +583,24 @@ DEFUN(bfd_generic_set_section_contents, (abfd, section, location, offset, count)
 {
     if (count == 0)
         return true;
-    if ((bfd_size_type)(offset+count) > section->size
+    if ((bfd_size_type)(offset+count) > bfd_get_section_size_after_reloc(section)
         || bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
         || bfd_write(location, (bfd_size_type)1, count, abfd) != count)
         return (false); /* on error */
     return (true);
 }
 
-/*proto-internal*
-*i bfd_log2
-Return the log base 2 of the value supplied, rounded up. eg an arg
-of 1025 would return 11.
-*; PROTO(bfd_vma, bfd_log2,(bfd_vma x));
-*-*/
+/*
+INTERNAL_FUNCTION
+       bfd_log2
+
+DESCRIPTION
+       Return the log base 2 of the value supplied, rounded up. eg an
+       arg of 1025 would return 11.
+
+SYNOPSIS
+       bfd_vma bfd_log2(bfd_vma x);
+*/
 
 bfd_vma bfd_log2(x)
 bfd_vma x;
index 7a0101525673f62db5f90bd74553ebb6e666ddc3..d3cd294a3744420ccddaa05cce1159b5db58ff3b 100644 (file)
@@ -282,7 +282,7 @@ DEFUN(oasys_archive_p,(abfd),
 
       filepos = header.mod_tbl_offset;
       for (i = 0; i < header.mod_count; i++) {
-        bfd_seek(abfd , filepos, SEEK_SET);
+        bfd_seek(abfd, filepos, SEEK_SET);
 
        /* There are two ways of specifying the archive header */
 
index 1485b7ca0e5cce4fbf8f1fac7b8ca188cf0b548b..fefbbd84b795680e4be20456c4c982f396b3087f 100644 (file)
@@ -49,15 +49,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <errno.h>
 
-  struct trad_core_struct 
-    {
-      asection *data_section;
-      asection *stack_section;
-      asection *reg_section;
+/* This struct is just for allocating two things with one zalloc, so
+   they will be freed together, without violating alignment constraints. */
 
-      struct user              u;
-    } *rawptr;
+struct trad_core_struct 
+  {
+    asection *data_section;
+    asection *stack_section;
+    asection *reg_section;
 
+    struct user                u;
+  } *rawptr;
 
 #define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
 #define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
@@ -74,11 +76,8 @@ sco_core_file_p (abfd)
 {
   int val;
   struct user u;
-  /* This struct is just for allocating two things with one zalloc, so
-     they will be freed together, without violating alignment constraints. */
-
 
-  bfd_seek(abfd, 0, SEEK_SET);
+  bfd_seek(abfd, (file_ptr) 0, SEEK_SET);
   val = bfd_read ((void *)&u, 1, sizeof u, abfd);
   if (val != sizeof u)
     return 0;                  /* Too small to be a core file */
@@ -89,7 +88,8 @@ sco_core_file_p (abfd)
 
   /* Allocate both the upage and the struct core_data at once, so
      a single free() will free them both.  */
-  rawptr = (struct trad_core_struct *)bfd_zalloc (abfd, sizeof (struct trad_core_struct));
+  rawptr = (struct trad_core_struct *)
+          bfd_zalloc (abfd, sizeof (struct trad_core_struct));
   if (rawptr == NULL) {
     bfd_error = no_memory;
     return 0;
@@ -97,7 +97,7 @@ sco_core_file_p (abfd)
   
   abfd->tdata.trad_core_data = rawptr;
 
-  rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
+  rawptr->u = u; /* Copy the uarea into the tdata part of the bfd */
 
   /* Create the sections.  This is raunchy, but bfd_close wants to free
      them separately.  */