From: Jan Kratochvil Date: Wed, 11 Nov 2009 04:54:32 +0000 (+0000) Subject: binutils/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee2fb9eb60f34103739b42fbc70431cb6cdf141e;p=binutils-gdb.git binutils/ * configure.in: Stop checking for fopen64 and stat64. * strings.c (file_off, file_open, statbuf, file_stat): Remove. (strings_file): Change file_off to file_ptr, file_open to fopen, statbuf to struct stat and file_stat to stat. (get_char): Change parameter type file_off * to file_ptr *. (print_strings): Change parameter and variable `start' type file_off to file_ptr. * configure: Regenerate. * config.in: Regenerate. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 4f9fdd49d4b..30b566ae8e8 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2009-11-11 Jan Kratochvil + + * configure.in: Stop checking for fopen64 and stat64. + * strings.c (file_off, file_open, statbuf, file_stat): Remove. + (strings_file): Change file_off to file_ptr, file_open to fopen, + statbuf to struct stat and file_stat to stat. + (get_char): Change parameter type file_off * to file_ptr *. + (print_strings): Change parameter and variable `start' type file_off to + file_ptr. + * configure: Regenerate. + * config.in: Regenerate. + 2009-11-11 Jan Kratochvil * configure.in: Call ACX_LARGEFILE. Stop calling AC_PLUGINS, diff --git a/binutils/config.in b/binutils/config.in index ceae20716df..0cb7290d2d1 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -70,9 +70,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Is fopen64 available? */ -#undef HAVE_FOPEN64 - /* Define to 1 if you have the `getc_unlocked' function. */ #undef HAVE_GETC_UNLOCKED @@ -103,9 +100,6 @@ /* Define to 1 if you have the `setmode' function. */ #undef HAVE_SETMODE -/* Is stat64 available? */ -#undef HAVE_STAT64 - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -231,9 +225,6 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Enable LFS */ -#undef _LARGEFILE64_SOURCE - /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES diff --git a/binutils/configure b/binutils/configure index 9fdcaa030a2..f1eaaa1d73d 100755 --- a/binutils/configure +++ b/binutils/configure @@ -12554,120 +12554,6 @@ $as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h fi -# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE -# needs to be defined for it -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fopen64" >&5 -$as_echo_n "checking for fopen64... " >&6; } -if test "${bu_cv_have_fopen64+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen64 ("/tmp/foo","r"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - bu_cv_have_fopen64=yes -else - saved_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen64 ("/tmp/foo","r"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE" -else - bu_cv_have_fopen64=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS=$saved_CPPFLAGS -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bu_cv_have_fopen64" >&5 -$as_echo "$bu_cv_have_fopen64" >&6; } -if test "$bu_cv_have_fopen64" != no; then - -$as_echo "#define HAVE_FOPEN64 1" >>confdefs.h - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stat64" >&5 -$as_echo_n "checking for stat64... " >&6; } -if test "${bu_cv_have_stat64+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -struct stat64 st; stat64 ("/tmp/foo", &st); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - bu_cv_have_stat64=yes -else - saved_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -struct stat64 st; stat64 ("/tmp/foo", &st); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE" -else - bu_cv_have_stat64=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CPPFLAGS=$saved_CPPFLAGS -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bu_cv_have_stat64" >&5 -$as_echo "$bu_cv_have_stat64" >&6; } -if test "$bu_cv_have_stat64" != no; then - -$as_echo "#define HAVE_STAT64 1" >>confdefs.h - -fi -if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ - || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then - -$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h - - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" -fi - # Some systems have frexp only in -lm, not in -lc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing frexp" >&5 $as_echo_n "checking for library containing frexp... " >&6; } diff --git a/binutils/configure.in b/binutils/configure.in index 6ed8f4cbb55..94e49f1e8ef 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -88,45 +88,6 @@ AC_CHECK_FUNC([mkdtemp], AC_DEFINE([HAVE_MKDTEMP], 1, [Define to 1 if you have the `mkdtemp' function.])) -# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE -# needs to be defined for it -AC_MSG_CHECKING([for fopen64]) -AC_CACHE_VAL(bu_cv_have_fopen64, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [FILE *f = fopen64 ("/tmp/foo","r");])], -bu_cv_have_fopen64=yes, -[saved_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [FILE *f = fopen64 ("/tmp/foo","r");])], - bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE", - bu_cv_have_fopen64=no) - CPPFLAGS=$saved_CPPFLAGS])]) -AC_MSG_RESULT($bu_cv_have_fopen64) -if test "$bu_cv_have_fopen64" != no; then - AC_DEFINE([HAVE_FOPEN64], 1, - [Is fopen64 available?]) -fi -AC_MSG_CHECKING([for stat64]) -AC_CACHE_VAL(bu_cv_have_stat64, -[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [struct stat64 st; stat64 ("/tmp/foo", &st);])], -bu_cv_have_stat64=yes, -[saved_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [struct stat64 st; stat64 ("/tmp/foo", &st);])], - bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE", - bu_cv_have_stat64=no) - CPPFLAGS=$saved_CPPFLAGS])]) -AC_MSG_RESULT($bu_cv_have_stat64) -if test "$bu_cv_have_stat64" != no; then - AC_DEFINE([HAVE_STAT64], 1, - [Is stat64 available?]) -fi -if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \ - || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then - AC_DEFINE([_LARGEFILE64_SOURCE], 1, - [Enable LFS]) - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" -fi - # Some systems have frexp only in -lm, not in -lc. AC_SEARCH_LIBS(frexp, m) diff --git a/binutils/strings.c b/binutils/strings.c index dc2d8f24219..00cfb6dc669 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -80,21 +80,6 @@ extern int errno; /* The BFD section flags that identify an initialized data section. */ #define DATA_FLAGS (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS) -#ifdef HAVE_FOPEN64 -typedef off64_t file_off; -#define file_open(s,m) fopen64(s, m) -#else -typedef off_t file_off; -#define file_open(s,m) fopen(s, m) -#endif -#ifdef HAVE_STAT64 -typedef struct stat64 statbuf; -#define file_stat(f,s) stat64(f, s) -#else -typedef struct stat statbuf; -#define file_stat(f,s) stat(f, s) -#endif - /* Radix for printing addresses (must be 8, 10 or 16). */ static int address_radix; @@ -145,9 +130,9 @@ typedef struct static void strings_a_section (bfd *, asection *, void *); static bfd_boolean strings_object_file (const char *); static bfd_boolean strings_file (char *file); -static void print_strings (const char *, FILE *, file_off, int, int, char *); +static void print_strings (const char *, FILE *, file_ptr, int, int, char *); static void usage (FILE *, int); -static long get_char (FILE *, file_off *, int *, char **); +static long get_char (FILE *, file_ptr *, int *, char **); int main (int, char **); @@ -414,9 +399,11 @@ strings_object_file (const char *file) static bfd_boolean strings_file (char *file) { - statbuf st; + struct stat st; + + /* get_file_size does not support non-S_ISREG files. */ - if (file_stat (file, &st) < 0) + if (stat (file, &st) < 0) { if (errno == ENOENT) non_fatal (_("'%s': No such file"), file); @@ -434,7 +421,7 @@ strings_file (char *file) { FILE *stream; - stream = file_open (file, FOPEN_RB); + stream = fopen (file, FOPEN_RB); if (stream == NULL) { fprintf (stderr, "%s: ", program_name); @@ -442,7 +429,7 @@ strings_file (char *file) return FALSE; } - print_strings (file, stream, (file_off) 0, 0, 0, (char *) 0); + print_strings (file, stream, (file_ptr) 0, 0, 0, (char *) 0); if (fclose (stream) == EOF) { @@ -466,7 +453,7 @@ strings_file (char *file) MAGICCOUNT is how many characters are in it. */ static long -get_char (FILE *stream, file_off *address, int *magiccount, char **magic) +get_char (FILE *stream, file_ptr *address, int *magiccount, char **magic) { int c, i; long r = EOF; @@ -542,14 +529,14 @@ get_char (FILE *stream, file_off *address, int *magiccount, char **magic) Those characters come at address ADDRESS and the data in STREAM follow. */ static void -print_strings (const char *filename, FILE *stream, file_off address, +print_strings (const char *filename, FILE *stream, file_ptr address, int stop_point, int magiccount, char *magic) { char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1)); while (1) { - file_off start; + file_ptr start; int i; long c;