* strings.c (statbuf): New typedef.
(file_stat): Define. (strings_object_file): Avoid using get_file_size, instead do the checks here, using file_stat. * configure.in (HAVE_STAT64): New test. * configure: Rebuilt. * config.in: Rebuilt.
This commit is contained in:
parent
2a1b9a480a
commit
fb5b547845
5 changed files with 109 additions and 9 deletions
|
@ -1,3 +1,13 @@
|
||||||
|
2004-10-13 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* strings.c (statbuf): New typedef.
|
||||||
|
(file_stat): Define.
|
||||||
|
(strings_object_file): Avoid using get_file_size, instead do the
|
||||||
|
checks here, using file_stat.
|
||||||
|
* configure.in (HAVE_STAT64): New test.
|
||||||
|
* configure: Rebuilt.
|
||||||
|
* config.in: Rebuilt.
|
||||||
|
|
||||||
2004-10-12 Paul Brook <paul@codesourcery.com>
|
2004-10-12 Paul Brook <paul@codesourcery.com>
|
||||||
|
|
||||||
* readelf.c (decode_ARM_machine_flags): Support EABI version 4.
|
* readelf.c (decode_ARM_machine_flags): Support EABI version 4.
|
||||||
|
|
|
@ -166,6 +166,9 @@
|
||||||
/* Is fopen64 available? */
|
/* Is fopen64 available? */
|
||||||
#undef HAVE_FOPEN64
|
#undef HAVE_FOPEN64
|
||||||
|
|
||||||
|
/* Is stat64 available? */
|
||||||
|
#undef HAVE_STAT64
|
||||||
|
|
||||||
/* Enable LFS */
|
/* Enable LFS */
|
||||||
#undef _LARGEFILE64_SOURCE
|
#undef _LARGEFILE64_SOURCE
|
||||||
|
|
||||||
|
|
60
binutils/configure
vendored
60
binutils/configure
vendored
|
@ -5035,12 +5035,66 @@ if test "$bu_cv_have_fopen64" != no; then
|
||||||
#define HAVE_FOPEN64 1
|
#define HAVE_FOPEN64 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
|
fi
|
||||||
cat >> confdefs.h <<\EOF
|
echo $ac_n "checking for stat64""... $ac_c" 1>&6
|
||||||
|
echo "configure:5054: checking for stat64" >&5
|
||||||
|
if eval "test \"`echo '$''{'bu_cv_have_stat64'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 5059 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
int main() {
|
||||||
|
struct stat64 st; stat64 ("/tmp/foo", &st);
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
|
rm -rf conftest*
|
||||||
|
bu_cv_have_stat64=yes
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
saved_CPPFLAGS=$CPPFLAGS
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 5076 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
int main() {
|
||||||
|
struct stat64 st; stat64 ("/tmp/foo", &st);
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:5083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||||
|
rm -rf conftest*
|
||||||
|
bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE"
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
bu_cv_have_stat64=no
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
CPPFLAGS=$saved_CPPFLAGS
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ac_t""$bu_cv_have_stat64" 1>&6
|
||||||
|
if test "$bu_cv_have_stat64" != no; then
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_STAT64 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
|
||||||
|
|| test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
#define _LARGEFILE64_SOURCE 1
|
#define _LARGEFILE64_SOURCE 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
fi
|
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Some systems have frexp only in -lm, not in -lc.
|
# Some systems have frexp only in -lm, not in -lc.
|
||||||
|
|
|
@ -118,10 +118,27 @@ AC_MSG_RESULT($bu_cv_have_fopen64)
|
||||||
if test "$bu_cv_have_fopen64" != no; then
|
if test "$bu_cv_have_fopen64" != no; then
|
||||||
AC_DEFINE([HAVE_FOPEN64], 1,
|
AC_DEFINE([HAVE_FOPEN64], 1,
|
||||||
[Is fopen64 available?])
|
[Is fopen64 available?])
|
||||||
if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
|
fi
|
||||||
AC_DEFINE([_LARGEFILE64_SOURCE], 1,
|
AC_MSG_CHECKING([for stat64])
|
||||||
[Enable LFS])
|
AC_CACHE_VAL(bu_cv_have_stat64,
|
||||||
fi
|
[AC_TRY_LINK([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);],
|
||||||
|
bu_cv_have_stat64=yes,
|
||||||
|
[saved_CPPFLAGS=$CPPFLAGS
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
|
||||||
|
AC_TRY_LINK([#include <sys/stat.h>], [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
|
fi
|
||||||
|
|
||||||
# Some systems have frexp only in -lm, not in -lc.
|
# Some systems have frexp only in -lm, not in -lc.
|
||||||
|
|
|
@ -104,6 +104,13 @@ typedef off64_t file_off;
|
||||||
typedef off_t file_off;
|
typedef off_t file_off;
|
||||||
#define file_open(s,m) fopen(s, m)
|
#define file_open(s,m) fopen(s, m)
|
||||||
#endif
|
#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). */
|
/* Radix for printing addresses (must be 8, 10 or 16). */
|
||||||
static int address_radix;
|
static int address_radix;
|
||||||
|
@ -370,8 +377,17 @@ strings_object_file (const char *file)
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
strings_file (char *file)
|
strings_file (char *file)
|
||||||
{
|
{
|
||||||
if (get_file_size (file) < 1)
|
statbuf st;
|
||||||
return FALSE;
|
|
||||||
|
if (file_stat (file, &st) < 0)
|
||||||
|
{
|
||||||
|
if (errno == ENOENT)
|
||||||
|
non_fatal (_("'%s': No such file"), file);
|
||||||
|
else
|
||||||
|
non_fatal (_("Warning: could not locate '%s'. reason: %s"),
|
||||||
|
file, strerror (errno));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we weren't told to scan the whole file,
|
/* If we weren't told to scan the whole file,
|
||||||
try to open it as an object file and only look at
|
try to open it as an object file and only look at
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue