gdb/2045: gdb 6.4 compilation fails on HPUX 10

Mark Kettenis mark.kettenis@xs4all.nl
Mon Dec 5 22:18:00 GMT 2005


The following reply was made to PR gdb/2045; it has been noted by GNATS.

From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: drow@false.org
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/2045: gdb 6.4 compilation fails on HPUX 10
Date: Mon, 5 Dec 2005 23:14:07 +0100 (CET)

 > Date: Mon, 5 Dec 2005 16:56:12 -0500
 > From: Daniel Jacobowitz <drow@false.org>
 > 
 > On Mon, Dec 05, 2005 at 09:38:01PM -0000, Mark Kettenis wrote:
 > >  Hi,
 > >  
 > >  I've been looking into the problem today.  I remember stumbling across
 > >  the -D_LARGEFILE64_SOURCE issue, and could indeed reproduce it.  I'm
 > >  working on a proper fix, but it seems the HP-UX 10.20 header files are
 > >  seriously borked, so the "right" fix doesn't quite work :(.
 > 
 > Can you reproduce this with HEAD?  I'm pretty sure one of the HP/UX
 > binutils developers fixed this, possibly just after GDB 6.4 branched.
 
 Oh yes, sorry, I reproduces this with head (didn't try with the
 official gdb 6.4 release).  I tried to fix this by using
 AC_SYS_LARGEFILE and dumping the fseeko64/ftello64 stuff.
 Unfortunately the HP-UX 10.20 header files are broken for
 -D_FILE_OFFSET_BITS=64.  In <sys/fcntl.h> they do something like:
 
 static open(a,b,c) const char *a; mode_t c; { return __open64(a,b,c); }
 
 without providing a protytype for __open64.  Of course that makes gcc
 spit out all kinds of warnings, which are fatal with -Werror.
 
 Not sure what to do about it yet :(.
 
 Mark
 
 
 Index: bfdio.c
 ===================================================================
 RCS file: /cvs/src/src/bfd/bfdio.c,v
 retrieving revision 1.12
 diff -u -p -r1.12 bfdio.c
 --- bfdio.c 3 Nov 2005 16:06:10 -0000 1.12
 +++ bfdio.c 5 Dec 2005 22:07:04 -0000
 @@ -42,9 +42,7 @@ Foundation, Inc., 51 Franklin Street - F
  file_ptr
  real_ftell (FILE *file)
  {
 -#if defined (HAVE_FTELLO64)
 -  return ftello64 (file);
 -#elif defined (HAVE_FTELLO)
 +#if defined (HAVE_FSEEKO)
    return ftello (file);
  #else
    return ftell (file);
 @@ -54,9 +52,7 @@ real_ftell (FILE *file)
  int
  real_fseek (FILE *file, file_ptr offset, int whence)
  {
 -#if defined (HAVE_FSEEKO64)
 -  return fseeko64 (file, offset, whence);
 -#elif defined (HAVE_FSEEKO)
 +#if defined (HAVE_FSEEKO)
    return fseeko (file, offset, whence);
  #else
    return fseek (file, offset, whence);
 @@ -66,11 +62,7 @@ real_fseek (FILE *file, file_ptr offset,
  FILE *
  real_fopen (const char *filename, const char *modes)
  {
 -#if defined (HAVE_FOPEN64)
 -  return fopen64 (filename, modes);
 -#else
    return fopen (filename, modes);
 -#endif
  }
  
  /*
 Index: config.in
 ===================================================================
 RCS file: /cvs/src/src/bfd/config.in,v
 retrieving revision 1.31
 diff -u -p -r1.31 config.in
 --- config.in 3 Nov 2005 16:06:10 -0000 1.31
 +++ config.in 5 Dec 2005 22:07:04 -0000
 @@ -35,22 +35,6 @@
     */
  #undef HAVE_DECL_FREE
  
 -/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't.
 -   */
 -#undef HAVE_DECL_FSEEKO
 -
 -/* Define to 1 if you have the declaration of `fseeko64', and to 0 if you
 -   don't. */
 -#undef HAVE_DECL_FSEEKO64
 -
 -/* Define to 1 if you have the declaration of `ftello', and to 0 if you don't.
 -   */
 -#undef HAVE_DECL_FTELLO
 -
 -/* Define to 1 if you have the declaration of `ftello64', and to 0 if you
 -   don't. */
 -#undef HAVE_DECL_FTELLO64
 -
  /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
     */
  #undef HAVE_DECL_GETENV
 @@ -92,21 +76,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. */
 +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
  #undef HAVE_FSEEKO
  
 -/* Define to 1 if you have the `fseeko64' function. */
 -#undef HAVE_FSEEKO64
 -
 -/* Define to 1 if you have the `ftello' function. */
 -#undef HAVE_FTELLO
 -
 -/* Define to 1 if you have the `ftello64' function. */
 -#undef HAVE_FTELLO64
 -
  /* Define to 1 if you have the `getcwd' function. */
  #undef HAVE_GETCWD
  
 @@ -354,11 +326,20 @@
  /* Version number of package */
  #undef VERSION
  
 +/* Number of bits in a file offset, on hosts where this is settable. */
 +#undef _FILE_OFFSET_BITS
 +
  /* Enable GNU extensions on systems that have them.  */
  #ifndef _GNU_SOURCE
  # undef _GNU_SOURCE
  #endif
  
 +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 +#undef _LARGEFILE_SOURCE
 +
 +/* Define for large files, on AIX-style hosts. */
 +#undef _LARGE_FILES
 +
  /* Define to empty if `const' does not conform to ANSI C. */
  #undef const
  
 Index: configure.host
 ===================================================================
 RCS file: /cvs/src/src/bfd/configure.host,v
 retrieving revision 1.16
 diff -u -p -r1.16 configure.host
 --- configure.host 7 Nov 2005 21:55:14 -0000 1.16
 +++ configure.host 5 Dec 2005 22:07:07 -0000
 @@ -19,18 +19,12 @@ HOST_U_64BIT_TYPE=
  
  case "${host}" in
  
 -hppa*-*-hpux*)		# HP/UX's ftello64 et.al. declarations are only
 -			# visible when _LARGEFILE64_SOURCE is defined.
 -			# Without those declarations, real_ftell et.al.
 -			# get mis-compiled.
 -			HDEFINES="-DHOST_HPPAHPUX -D_LARGEFILE64_SOURCE" ;;
 +hppa*-*-hpux*)		HDEFINES=-DHOST_HPPAHPUX ;;
  hppa*-*-hiux*)		HDEFINES=-DHOST_HPPAHPUX ;;
  hppa*-*-mpeix*)		HDEFINES=-DHOST_HPPAMPEIX ;;
  hppa*-*-bsd*)		HDEFINES=-DHOST_HPPABSD ;;
  hppa*-*-osf*)		HDEFINES=-DHOST_HPPAOSF ;;
  
 -ia64-*-hpux*)		HDEFINES=-D_LARGEFILE64_SOURCE
 -			host64=true;;
  ia64-*-*)		host64=true;;
  
  # Workaround for limitations on win9x where file contents are
 Index: configure.in
 ===================================================================
 RCS file: /cvs/src/src/bfd/configure.in,v
 retrieving revision 1.197
 diff -u -p -r1.197 configure.in
 --- configure.in 3 Nov 2005 16:06:11 -0000 1.197
 +++ configure.in 5 Dec 2005 22:07:07 -0000
 @@ -84,6 +84,8 @@ bfd_default_target_size=32
  AC_PROG_CC
  AC_GNU_SOURCE
  
 +AC_SYS_LARGEFILE
 +
  ALL_LINGUAS="fr tr ja es sv da zh_CN ro rw vi"
  CY_GNU_GETTEXT
  
 @@ -140,15 +142,11 @@ AC_HEADER_DIRENT
  ACX_HEADER_STRING
  AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
  AC_CHECK_FUNCS(strtoull)
 -
 -AC_CHECK_DECLS(basename)
 -AC_CHECK_DECLS(ftello)
 -AC_CHECK_DECLS(ftello64)
 -AC_CHECK_DECLS(fseeko)
 -AC_CHECK_DECLS(fseeko64)
 +AC_FUNC_FSEEKO
  
  BFD_BINARY_FOPEN
  
 +AC_CHECK_DECLS(basename)
  AC_CHECK_DECLS(ffs)
  AC_CHECK_DECLS(free)
  AC_CHECK_DECLS(getenv)
 @@ -921,15 +919,11 @@ 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 fopen64)
 -if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
 -    AC_CHECK_SIZEOF(off_t)
 -fi
 +AC_CHECK_SIZEOF(off_t)
  AC_MSG_CHECKING([file_ptr type])
  bfd_file_ptr="long"
  bfd_ufile_ptr="unsigned long"
 -if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
 -	-o x"${ac_cv_sizeof_off_t}" = x8; then
 +if test x"${ac_cv_sizeof_off_t}" = x8; then
      bfd_file_ptr=BFD_HOST_64_BIT
      bfd_ufile_ptr=BFD_HOST_U_64_BIT
  fi
 Index: sysdep.h
 ===================================================================
 RCS file: /cvs/src/src/bfd/sysdep.h,v
 retrieving revision 1.16
 diff -u -p -r1.16 sysdep.h
 --- sysdep.h 5 May 2005 18:51:14 -0000 1.16
 +++ sysdep.h 5 Dec 2005 22:07:07 -0000
 @@ -138,30 +138,6 @@ extern char *stpcpy (char *__dest, const
  extern char *strstr ();
  #endif
  
 -#ifdef HAVE_FTELLO
 -#if !HAVE_DECL_FTELLO
 -extern off_t ftello (FILE *stream);
 -#endif
 -#endif
 -
 -#ifdef HAVE_FTELLO64
 -#if !HAVE_DECL_FTELLO64
 -extern off64_t ftello64 (FILE *stream);
 -#endif
 -#endif
 -
 -#ifdef HAVE_FSEEKO
 -#if !HAVE_DECL_FSEEKO
 -extern int fseeko (FILE *stream, off_t offset, int whence);
 -#endif
 -#endif
 -
 -#ifdef HAVE_FSEEKO64
 -#if !HAVE_DECL_FSEEKO64
 -extern int fseeko64 (FILE *stream, off64_t offset, int whence);
 -#endif
 -#endif
 -
  /* Define offsetof for those systems which lack it */
  
  #ifndef offsetof
 



More information about the Gdb-prs mailing list