[PATCH] MinGW: Add support for 'strnlen' prototype to BFD.
Meador Inge
meadori@codesourcery.com
Fri Mar 14 02:35:00 GMT 2014
More information about the Binutils mailing list
Fri Mar 14 02:35:00 GMT 2014
- Previous message (by thread): [PATCH v2] Add "--trampolines" option to allow assembler to relax out-of-range jumps
- Next message (by thread): [PATCH] MinGW: Add support for 'strnlen' prototype to BFD.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi All, Commit e9847026c92f330f18863a7b9cb0aaa299345559 to fix PR binutils/16664 added two calls to `strnlen' which is not supplied by MinGW. We already handle the necessary configure logic on the 'binutils' side. I added the same check on the 'bfd' side and pulled the prototypes into 'sysdep.h' on each side to fix the issue. OK? P.S. I already have write after approval for GDB and GCC. Can I commit to Binutils as well? If not, then can someone please apply this for me? Or just give me access? :-) bfd/ 2014-03-13 Meador Inge <meadori@codesourcery.com> * configure.in: Add strnlen to AC_CHECK_DECLS. * config.in: Regenerate. * configure: Regenerate. * sysdep.h (strnlen): Add prototype. binutils/ 2014-03-13 Meador Inge <meadori@codesourcery.com> * dwarf.c (strnlen): Move prototype ... * sysdep.h (strnlen): ... to here. --- bfd/config.in | 4 ++++ bfd/configure | 11 +++++++++++ bfd/configure.in | 1 + bfd/sysdep.h | 4 ++++ binutils/dwarf.c | 4 ---- binutils/sysdep.h | 4 ++++ 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/bfd/config.in b/bfd/config.in index 3106c28..05829e2 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -64,6 +64,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/bfd/configure b/bfd/configure index fbf5f44..c5cb2a1 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13766,6 +13766,17 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_VSNPRINTF $ac_have_decl _ACEOF +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_STRNLEN $ac_have_decl +_ACEOF + # Link in zlib if we can. This allows us to read compressed debug sections. # This is used only by compress.c. diff --git a/bfd/configure.in b/bfd/configure.in index f1ec965..af98f62 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -239,6 +239,7 @@ AC_CHECK_DECLS(stpcpy) AC_CHECK_DECLS(strstr) AC_CHECK_DECLS(snprintf) AC_CHECK_DECLS(vsnprintf) +AC_CHECK_DECLS(strnlen) # Link in zlib if we can. This allows us to read compressed debug sections. # This is used only by compress.c. diff --git a/bfd/sysdep.h b/bfd/sysdep.h index a30da90..7e441eb 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -170,6 +170,10 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence); #endif #endif +#if !HAVE_DECL_STRNLEN +size_t strnlen (const char *, size_t); +#endif + /* Define offsetof for those systems which lack it */ #ifndef offsetof diff --git a/binutils/dwarf.c b/binutils/dwarf.c index aa8a1df..c8360b5 100644 --- a/binutils/dwarf.c +++ b/binutils/dwarf.c @@ -29,10 +29,6 @@ #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; diff --git a/binutils/sysdep.h b/binutils/sysdep.h index 3312925..689e8c9 100644 --- a/binutils/sysdep.h +++ b/binutils/sysdep.h @@ -112,6 +112,10 @@ extern int snprintf(char *, size_t, const char *, ...); extern int vsnprintf(char *, size_t, const char *, va_list); #endif +#if !HAVE_DECL_STRNLEN +size_t strnlen (const char *, size_t); +#endif + #ifndef O_RDONLY #define O_RDONLY 0 #endif -- 1.7.9.5
- Previous message (by thread): [PATCH v2] Add "--trampolines" option to allow assembler to relax out-of-range jumps
- Next message (by thread): [PATCH] MinGW: Add support for 'strnlen' prototype to BFD.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list