Patch to add fopen/fopen64 declarations to bfd

Steve Ellcey sje@cup.hp.com
Fri Nov 4 19:57:00 GMT 2005


My build of binutils recently started failing when a use of fopen64 was
added because, while IA64 HP-UX has a fopen64 function in libc, it does
not make the declaration visible unless _LARGEFILE64_SOURCE is defined.
So I get an error since it uses fopen64 but it didn't see a declaration
for fopen64.

This patch fixes the problem by checking for a fopen64 declaration and
inserting one if it doesn't find it.  I also did the same change for
fopen just to make those functions consistent.

Tested on IA64 HP-UX, OK for checkin?

Steve Ellcey
sje@cup.hp.com


bfd/ChangeLog

2005-11-04  Steve Ellcey  <sje@cup.hp.com>

	* sysdep.h: (fopen) Add declaration if needed.
	(fopen64): Ditto.
	* configure.in: Check for fopen and fopen64 declarations.
	* configure: Regenerate.
	* config.h.in: Regenerate.


*** src.orig/bfd/sysdep.h	Fri Nov  4 11:50:03 2005
--- src/bfd/sysdep.h	Fri Nov  4 11:49:44 2005
*************** extern int fseeko64 (FILE *stream, off64
*** 162,167 ****
--- 162,179 ----
  #endif
  #endif
  
+ #ifdef HAVE_FOPEN
+ #if !HAVE_DECL_FOPEN
+ extern FILE *fopen(const char *pathname, const char *type);
+ #endif
+ #endif
+ 
+ #ifdef HAVE_FOPEN64
+ #if !HAVE_DECL_FOPEN64
+ extern FILE *fopen64(const char *pathname, const char *type);
+ #endif
+ #endif
+ 
  /* Define offsetof for those systems which lack it */
  
  #ifndef offsetof
*** src.orig/bfd/configure.in	Fri Nov  4 11:50:15 2005
--- src/bfd/configure.in	Fri Nov  4 11:49:52 2005
*************** AC_CHECK_DECLS(ftello)
*** 146,151 ****
--- 146,153 ----
  AC_CHECK_DECLS(ftello64)
  AC_CHECK_DECLS(fseeko)
  AC_CHECK_DECLS(fseeko64)
+ AC_CHECK_DECLS(fopen)
+ AC_CHECK_DECLS(fopen64)
  
  BFD_BINARY_FOPEN
  



More information about the Binutils mailing list