diff options
author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2021-07-07 13:44:31 +0200 |
---|---|---|
committer | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2021-07-07 13:49:27 +0200 |
commit | b737d3047cc56b5e2fbb5c8390c4ed031eaf5ec0 (patch) | |
tree | 652788169b81ba887dbb0d39c37070c61f3538b6 /binutils | |
parent | ffa5352c0c0f735541e69fe6d9a192d82e7d418c (diff) | |
download | gdb-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 'binutils')
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/config.in | 4 | ||||
-rwxr-xr-x | binutils/configure | 10 | ||||
-rw-r--r-- | binutils/configure.ac | 2 |
4 files changed, 20 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 77b7ac7..be5fd77 100644 --- a/binutils/ChangeLog +++ b/binutils/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-05 Alan Modra <amodra@gmail.com> PR 28047 diff --git a/binutils/config.in b/binutils/config.in index e79967c..e6fa66f 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -55,6 +55,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 <dlfcn.h> header file. */ #undef HAVE_DLFCN_H diff --git a/binutils/configure b/binutils/configure index bf6461d..82640b8 100755 --- a/binutils/configure +++ b/binutils/configure @@ -13642,6 +13642,16 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STPCPY $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 # Link in zlib if we can. This allows us to read compressed debug diff --git a/binutils/configure.ac b/binutils/configure.ac index b8ab642..b2d0be0 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -265,7 +265,7 @@ if test $bu_cv_header_utime_h = yes; then AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?]) fi -AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy]) +AC_CHECK_DECLS([asprintf, environ, getc_unlocked, sbrk, stpcpy, strnlen]) # 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 |