* 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.
This commit is contained in:
Ian Lance Taylor 1995-11-08 21:24:33 +00:00
parent 7812bf9c25
commit 0bb8ff191e
5 changed files with 18 additions and 8 deletions

View 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.

View 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;

View 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. */

View 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. */

View 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;