* configure.in: Check for fopen64.

* libbfd-in.h (real_fopen): New prototype.
	* configure, config.in, libbfd.h: Regenerated.
	* bfdio.c (real_fopen): New function.
	* opncls.c (bfd_fopen, bfd_fill_in_gnu_debuglink_section): Use it.
	* cache.c (bfd_open_file): Likewise.
This commit is contained in:
Daniel Jacobowitz 2005-11-03 16:06:11 +00:00
parent 6f2942edf0
commit 2e6f4fae07
9 changed files with 150 additions and 233 deletions

View File

@ -1,3 +1,12 @@
2005-11-03 Daniel Jacobowitz <dan@codesourcery.com>
* configure.in: Check for fopen64.
* libbfd-in.h (real_fopen): New prototype.
* configure, config.in, libbfd.h: Regenerated.
* bfdio.c (real_fopen): New function.
* opncls.c (bfd_fopen, bfd_fill_in_gnu_debuglink_section): Use it.
* cache.c (bfd_open_file): Likewise.
2005-11-03 Thiemo Seufer <ths@networkno.de>
* elfxx-mips.c (mips_elf_calculate_relocation): Handle only

View File

@ -63,6 +63,16 @@ real_fseek (FILE *file, file_ptr offset, int whence)
#endif
}
FILE *
real_fopen (const char *filename, const char *modes)
{
#if defined (HAVE_FOPEN64)
return fopen64 (filename, modes);
#else
return fopen (filename, modes);
#endif
}
/*
INTERNAL_DEFINITION
struct bfd_iovec

View File

@ -476,15 +476,15 @@ bfd_open_file (bfd *abfd)
{
case read_direction:
case no_direction:
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_RUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_RUB);
if (abfd->iostream == NULL)
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
}
else
{
@ -514,7 +514,7 @@ bfd_open_file (bfd *abfd)
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink_if_ordinary (abfd->filename);
#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WUB);
abfd->iostream = (PTR) real_fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = TRUE;
}
break;

View File

@ -92,6 +92,9 @@
/* Define to 1 if you have the `fdopen' function. */
#undef HAVE_FDOPEN
/* Define to 1 if you have the `fopen64' function. */
#undef HAVE_FOPEN64
/* Define to 1 if you have the `fseeko' function. */
#undef HAVE_FSEEKO

345
bfd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -921,7 +921,7 @@ AC_SUBST(bfd_default_target_size)
# fseeko, long. This assumes that sizeof off_t is .ge. sizeof long.
# Hopefully a reasonable assumption since fseeko et.al. should be
# upward compatible.
AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64)
AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64 fopen64)
if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
AC_CHECK_SIZEOF(off_t)
fi

View File

@ -651,6 +651,7 @@ extern void _bfd_abort
the system "off_t" or "off64_t", as the offset. */
extern file_ptr real_ftell (FILE *file);
extern int real_fseek (FILE *file, file_ptr offset, int whence);
extern FILE *real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */

View File

@ -656,6 +656,7 @@ extern void _bfd_abort
the system "off_t" or "off64_t", as the offset. */
extern file_ptr real_ftell (FILE *file);
extern int real_fseek (FILE *file, file_ptr offset, int whence);
extern FILE *real_fopen (const char *filename, const char *modes);
/* List of supported target vectors, and the default vector (if
bfd_default_vector[0] is NULL, there is no default). */

View File

@ -175,7 +175,7 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd)
nbfd->iostream = fdopen (fd, mode);
else
#endif
nbfd->iostream = fopen (filename, mode);
nbfd->iostream = real_fopen (filename, mode);
if (nbfd->iostream == NULL)
{
bfd_set_error (bfd_error_system_call);
@ -1407,7 +1407,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd,
.gnu_debuglink section, we insist upon the user providing us with a
correct-for-section-creation-time path, but this need not conform to
the gdb location algorithm. */
handle = fopen (filename, FOPEN_RB);
handle = real_fopen (filename, FOPEN_RB);
if (handle == NULL)
{
bfd_set_error (bfd_error_system_call);