From 952781e82cc7dd01165447f137ea88f83f2c6bdf Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 5 Apr 2013 04:13:41 +0000 Subject: [PATCH] PR binutils/15324 * configure.in: Add strnlen to AC_CHECK_DECLS, sort. * dwarf.c (strnlen): Provide fallback decl. * config.in: Regnerate. * configure: Regenerate. --- binutils/ChangeLog | 8 ++++++++ binutils/config.in | 4 ++++ binutils/configure | 46 ++++++++++++++++++++++++++++------------------ binutils/configure.in | 4 ++-- binutils/dwarf.c | 4 ++++ 5 files changed, 46 insertions(+), 20 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6534091..1528836 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2013-04-05 Alan Modra + + PR binutils/15324 + * configure.in: Add strnlen to AC_CHECK_DECLS, sort. + * dwarf.c (strnlen): Provide fallback decl. + * config.in: Regnerate. + * configure: Regenerate. + 2013-03-29 H.J. Lu * dwarf.c (process_debug_info): Increment hdrptr by 8 after diff --git a/binutils/config.in b/binutils/config.in index f5f3298..0a8551f 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -63,6 +63,10 @@ */ #undef HAVE_DECL_STPCPY +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNLEN + /* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. */ #undef HAVE_DECL_STRSTR diff --git a/binutils/configure b/binutils/configure index 2193ae8..74a39e5 100755 --- a/binutils/configure +++ b/binutils/configure @@ -13003,6 +13003,16 @@ $as_echo "#define HAVE_GOOD_UTIME_H 1" >>confdefs.h fi +ac_fn_c_check_decl "$LINENO" "environ" "ac_cv_have_decl_environ" "$ac_includes_default" +if test "x$ac_cv_have_decl_environ" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ENVIRON $ac_have_decl +_ACEOF ac_fn_c_check_decl "$LINENO" "fprintf" "ac_cv_have_decl_fprintf" "$ac_includes_default" if test "x$ac_cv_have_decl_fprintf" = x""yes; then : ac_have_decl=1 @@ -13013,25 +13023,25 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_FPRINTF $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "stpcpy" "ac_cv_have_decl_stpcpy" "$ac_includes_default" -if test "x$ac_cv_have_decl_stpcpy" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" +if test "x$ac_cv_have_decl_getc_unlocked" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STPCPY $ac_have_decl +#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default" -if test "x$ac_cv_have_decl_strstr" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default" +if test "x$ac_cv_have_decl_getenv" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRSTR $ac_have_decl +#define HAVE_DECL_GETENV $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "sbrk" "ac_cv_have_decl_sbrk" "$ac_includes_default" if test "x$ac_cv_have_decl_sbrk" = x""yes; then : @@ -13043,45 +13053,45 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_SBRK $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default" -if test "x$ac_cv_have_decl_getenv" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" +if test "x$ac_cv_have_decl_snprintf" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETENV $ac_have_decl +#define HAVE_DECL_SNPRINTF $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "environ" "ac_cv_have_decl_environ" "$ac_includes_default" -if test "x$ac_cv_have_decl_environ" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "stpcpy" "ac_cv_have_decl_stpcpy" "$ac_includes_default" +if test "x$ac_cv_have_decl_stpcpy" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ENVIRON $ac_have_decl +#define HAVE_DECL_STPCPY $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" -if test "x$ac_cv_have_decl_getc_unlocked" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" +if test "x$ac_cv_have_decl_strnlen" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl +#define HAVE_DECL_STRNLEN $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" -if test "x$ac_cv_have_decl_snprintf" = x""yes; then : +ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default" +if test "x$ac_cv_have_decl_strstr" = x""yes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SNPRINTF $ac_have_decl +#define HAVE_DECL_STRSTR $ac_have_decl _ACEOF ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" if test "x$ac_cv_have_decl_vsnprintf" = x""yes; then : diff --git a/binutils/configure.in b/binutils/configure.in index f676fc5..4072178 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -185,8 +185,8 @@ if test $bu_cv_header_utime_h = yes; then AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does define struct utimbuf?]) fi -AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, - snprintf, vsnprintf]) +AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv, + sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf]) # Link in zlib if we can. This allows us to read compressed debug # sections. This is used only by readelf.c (objdump uses bfd for diff --git a/binutils/dwarf.c b/binutils/dwarf.c index a3a5949..4f5aa2b 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -29,6 +29,10 @@ #include "dwarf.h" #include "gdb/gdb-index.h" +#if !HAVE_DECL_STRNLEN +size_t strnlen (const char *, size_t); +#endif + static const char *regname (unsigned int regno, int row); static int have_frame_base; -- 2.7.4