Check for strnlen declaration to fix Solaris 10 build
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 7 Jul 2021 11:44:31 +0000 (13:44 +0200)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 7 Jul 2021 11:49:27 +0000 (13:49 +0200)
commitb737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0
tree652788169b81ba887dbb0d39c37070c61f3538b6
parentffa5352c0c0f735541e69fe6d9a192d82e7d418c
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.
bfd/ChangeLog
bfd/config.in
bfd/configure
bfd/configure.ac
binutils/ChangeLog
binutils/config.in
binutils/configure
binutils/configure.ac