aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2021-07-07 13:44:31 +0200
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>2021-07-07 13:49:27 +0200
commitb737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0 (patch)
tree652788169b81ba887dbb0d39c37070c61f3538b6 /bfd
parentffa5352c0c0f735541e69fe6d9a192d82e7d418c (diff)
downloadgdb-b737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0.zip
gdb-b737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0.tar.gz
gdb-b737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0.tar.bz2
Check for strnlen declaration to fix Solaris 10 build
binutils currently fails to compile on Solaris 10: /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_debug_link_info_1': /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: implicit declaration of function 'strnlen' [-Werror=implicit-function-declaration] 1231 | crc_offset = strnlen (name, size) + 1; | ^~~~~~~ /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror] /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function 'bfd_get_alt_debug_link_info': /vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1319:20: error: incompatible implicit declaration of built-in function 'strnlen' [-Werror] 1319 | buildid_offset = strnlen (name, size) + 1; | ^~~~~~~ and in a couple of other places. The platform lacks strnlen, and while libiberty.h can provide a fallback declaration, the necessary configure test isn't run. Fixed with the following patch. Tested on i386-pc-solaris2.10. 2021-07-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> bfd: * configure.ac: Check for strnlen declaration. * configure, config.in: Regenerate. binutils: * configure.ac: Check for strnlen declaration. * configure, config.in: Regenerate.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/config.in4
-rwxr-xr-xbfd/configure10
-rw-r--r--bfd/configure.ac2
4 files changed, 20 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 96bd8ff..d96cc78 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2021-07-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.ac: Check for strnlen declaration.
+ * configure, config.in: Regenerate.
+
2021-07-07 Nick Clifton <nickc@redhat.com>
PR 28051
diff --git a/bfd/config.in b/bfd/config.in
index 6d46ea7..f54a3ca 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -56,6 +56,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 `vasprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VASPRINTF
diff --git a/bfd/configure b/bfd/configure
index daa5124..24171d0 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -12890,6 +12890,16 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VASPRINTF $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" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRNLEN $ac_have_decl
+_ACEOF
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 07a75ed..fec067b 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -260,7 +260,7 @@ AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \
AC_CHECK_FUNCS(fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \
sysconf)
-AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf])
+AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen])
BFD_BINARY_FOPEN