Check for strnlen declaration to fix Solaris 10 build

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Tue Jul 6 11:29:14 GMT 2021


binutils currently fails to compile on Solaris 10:

/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function ‘bf
d_get_debug_link_info_1’:
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: i
mplicit declaration of function ‘strnlen’ [-Werror=implicit-function-declarati
on]
 1231 |	  crc_offset = strnlen (name, size) + 1;
      |		       ^~~~~~~
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1231:16: error: i
ncompatible implicit declaration of built-in function ‘strnlen’ [-Werror]
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c: In function ‘bf
d_get_alt_debug_link_info’:
/vol/src/gnu/binutils/hg/binutils-2.37-branch/git/bfd/opncls.c:1319:20: error: i
ncompatible 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.

Ok for master and the 2.37 branch?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol10-strnlen-decl.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210706/d667ab61/attachment.bin>


More information about the Binutils mailing list