* libbfd.c (bfd_get_file_window): Change writable parameter from
authorIan Lance Taylor <ian@airs.com>
Wed, 8 Nov 1995 21:24:33 +0000 (21:24 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 8 Nov 1995 21:24:33 +0000 (21:24 +0000)
int to boolean; update all callers.  Pass MAP_SHARED if not
writable--it's required on Solaris.  Cast fprintf argument to
avoid warning.
* bfd-in.h (bfd_get_file_window): Update declaration.
* bfd-in2.h: Rebuild.
* aoutx.h: Update calls to bfd_get_file_window.

bfd/ChangeLog
bfd/aoutx.h
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/libbfd.c

index 1334726..783ea82 100644 (file)
@@ -1,5 +1,13 @@
 Wed Nov  8 11:31:11 1995  Ian Lance Taylor  <ian@cygnus.com>
 
+       * libbfd.c (bfd_get_file_window): Change writable parameter from
+       int to boolean; update all callers.  Pass MAP_SHARED if not
+       writable--it's required on Solaris.  Cast fprintf argument to
+       avoid warning.
+       * bfd-in.h (bfd_get_file_window): Update declaration.
+       * bfd-in2.h: Rebuild.
+       * aoutx.h: Update calls to bfd_get_file_window.
+
        * xcofflink.c (XCOFF_DEF_DYNAMIC): Rename from XCOFF_REF_DYNAMIC.
        Change all uses.
        (xcoff_swap_ldhdr_in): New static function.
index 8d7ea3a..8d36de5 100644 (file)
@@ -1230,7 +1230,7 @@ aout_get_external_symbols (abfd)
 
       if (bfd_get_file_window (abfd,
                               obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms,
-                              &obj_aout_sym_window (abfd), 1) == false)
+                              &obj_aout_sym_window (abfd), true) == false)
        return false;
       syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
 
@@ -1253,7 +1253,7 @@ aout_get_external_symbols (abfd)
       stringsize = GET_WORD (abfd, string_chars);
 
       if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
-                              &obj_aout_string_window (abfd), 1) == false)
+                              &obj_aout_string_window (abfd), true) == false)
        return false;
       strings = (char *) obj_aout_string_window (abfd).data;
 
index 303ce02..de096c5 100644 (file)
@@ -621,7 +621,7 @@ typedef struct _bfd_window {
 extern void bfd_init_window PARAMS ((bfd_window *));
 extern void bfd_free_window PARAMS ((bfd_window *));
 extern boolean bfd_get_file_window
-  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
+  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
 
 /* XCOFF support routines for the linker.  */
 
index 54a7c0c..3621b55 100644 (file)
@@ -621,7 +621,7 @@ typedef struct _bfd_window {
 extern void bfd_init_window PARAMS ((bfd_window *));
 extern void bfd_free_window PARAMS ((bfd_window *));
 extern boolean bfd_get_file_window
-  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, int));
+  PARAMS ((bfd *, file_ptr, bfd_size_type, bfd_window *, boolean));
 
 /* XCOFF support routines for the linker.  */
 
index 291b1fd..c2d8b9f 100644 (file)
@@ -308,7 +308,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
      file_ptr offset;
      bfd_size_type size;
      bfd_window *windowp;
-     int writable;
+     boolean writable;
 {
   static size_t pagesize;
   bfd_window_internal *i = windowp->i;
@@ -367,7 +367,9 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
        }
       i->data = mmap (i->data, real_size,
                      writable ? PROT_WRITE | PROT_READ : PROT_READ,
-                     writable ? MAP_FILE | MAP_PRIVATE : MAP_FILE,
+                     (writable
+                      ? MAP_FILE | MAP_PRIVATE
+                      : MAP_FILE | MAP_SHARED),
                      fd, file_offset);
       if (i->data == (PTR) -1)
        {
@@ -393,7 +395,7 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
     {
       if (ok_to_map)
        fprintf (stderr, "not mapping: data=%x mapped=%d\n",
-                i->data, i->mapped);
+                i->data, (int) i->mapped);
       else
        fprintf (stderr, "not mapping: env var not set\n");
     }
@@ -1039,7 +1041,7 @@ _bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
       return bfd_get_section_contents (abfd, section, w->data, offset, count);
     }
   if ((bfd_size_type) (offset+count) > section->_raw_size
-      || (bfd_get_file_window (abfd, section->filepos + offset, count, w, 1)
+      || (bfd_get_file_window (abfd, section->filepos + offset, count, w, true)
          == false))
     return false;
   return true;