diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-09-21 10:27:30 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-09-21 10:27:30 -0400 |
commit | a767a1c4d3c7c5dd2f32cc106a21c1e01eddebcc (patch) | |
tree | 2e7136e26fcf5824de044f41db40a63b3ec997ad | |
parent | 4daf19021fef36767e70845608a8a2c3b4d72f99 (diff) | |
download | gdb-a767a1c4d3c7c5dd2f32cc106a21c1e01eddebcc.zip gdb-a767a1c4d3c7c5dd2f32cc106a21c1e01eddebcc.tar.gz gdb-a767a1c4d3c7c5dd2f32cc106a21c1e01eddebcc.tar.bz2 |
elf32-nds32: Don't define fls if it is provided by the system
The fls function already exists on macOS and FreeBSD (and probably others),
leading to this error:
/Users/simark/src/binutils-gdb/bfd/elf32-nds32.c:5074:1: error: static declaration of 'fls' follows non-static declaration
fls (register unsigned int x)
^
/usr/include/strings.h:87:6: note: previous declaration is here
int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^
Add a configure-time check for it, and only define it if the system doesn't
provide it.
bfd/ChangeLog:
* configure.ac: Check for fls.
* elf32-nds32.c (fls): Only define if !HAVE_FLS.
* config.in: Re-generate.
* configure: Re-generate.
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/config.in | 3 | ||||
-rwxr-xr-x | bfd/configure | 2 | ||||
-rw-r--r-- | bfd/configure.ac | 2 | ||||
-rw-r--r-- | bfd/elf32-nds32.c | 2 |
5 files changed, 14 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cfd89cb..a5c857a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2018-09-21 Simon Marchi <simon.marchi@ericsson.com> + + * configure.ac: Check for fls. + * elf32-nds32.c (fls): Only define if !HAVE_FLS. + * config.in: Re-generate. + * configure: Re-generate. + 2018-09-20 Maciej W. Rozycki <macro@linux-mips.org> * config.bfd <rs6000-*-aix5.[01], rs6000-*-aix[5-9]*>: Remove diff --git a/bfd/config.in b/bfd/config.in index 6ebdc51..be57296 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -107,6 +107,9 @@ /* Define to 1 if you have the `fileno' function. */ #undef HAVE_FILENO +/* Define to 1 if you have the `fls' function. */ +#undef HAVE_FLS + /* Define to 1 if you have the `fopen64' function. */ #undef HAVE_FOPEN64 diff --git a/bfd/configure b/bfd/configure index 8c83a6a..4c94cf0 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14089,7 +14089,7 @@ $as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h fi -for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno +for ac_func in fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno fls do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/bfd/configure.ac b/bfd/configure.ac index 787ac7f..270e54e 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -229,7 +229,7 @@ AC_HEADER_TIME AC_HEADER_DIRENT ACX_HEADER_STRING -AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno) +AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno fls) AC_CHECK_FUNCS(strtoull getrlimit) AC_CHECK_DECLS(basename) diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 6215f28..8844166 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -5083,11 +5083,13 @@ ones32 (register unsigned int x) return (x & 0x0000003f); } +#if !HAVE_FLS static unsigned int fls (register unsigned int x) { return ffs (x & (-x)); } +#endif /* !HAVE_FLS */ #define nds32_elf_local_tlsdesc_gotent(bfd) \ (elf_nds32_tdata (bfd)->local_tlsdesc_gotent) |