[binutils-gdb] Fix hidden visibility compiler test
Alan Modra
amodra@sourceware.org
Fri May 25 06:23:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=629dabe3b731c6194499652301935f34c3c20e0c
commit 629dabe3b731c6194499652301935f34c3c20e0c
Author: Alan Modra <amodra@gmail.com>
Date: Fri May 25 15:07:15 2018 +0930
Fix hidden visibility compiler test
Warnings from configure tests aren't usually checked. gcc's
"visibility attribute not supported in this configuration" warning is
enabled by default so we don't need to add any warning flag except
-Werror.
* configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
* configure: Regenerate.
Diff:
---
bfd/ChangeLog | 5 +++++
bfd/configure | 3 +++
bfd/configure.ac | 3 +++
3 files changed, 11 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f086ad5..88a64d6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-25 Alan Modra <amodra@gmail.com>
+
+ * configure.ac (bfd_cv_hidden): Run test with -Werror in CFLAGS.
+ * configure: Regenerate.
+
2018-05-23 H.J. Lu <hongjiu.lu@intel.com>
* elf64-ppc.c (ppc64_elf_write_core_note): Add ATTRIBUTE_NONSTRING
diff --git a/bfd/configure b/bfd/configure
index 2f3dbe7..c5b6335 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14043,6 +14043,8 @@ fi
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler support for hidden visibility" >&5
$as_echo_n "checking compiler support for hidden visibility... " >&6; }
if test "${bfd_cv_hidden+set}" = set; then :
@@ -14070,6 +14072,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_hidden" >&5
$as_echo "$bfd_cv_hidden" >&6; }
+CFLAGS="$save_CFLAGS"
if test $bfd_cv_hidden = yes; then
$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h
diff --git a/bfd/configure.ac b/bfd/configure.ac
index b320828..bb5c168 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -256,12 +256,15 @@ AC_CHECK_DECLS(strnlen)
# This is used only by compress.c.
AM_ZLIB
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
AC_CACHE_CHECK([compiler support for hidden visibility], bfd_cv_hidden,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
const char hw[] __attribute__ ((__visibility__ ("hidden"))) = "Hello, World\n";
extern void print (const char *) __attribute__ ((__visibility__ ("hidden")));]],
[[print (hw);]])],
[bfd_cv_hidden=yes], [bfd_cv_hidden=no])])
+CFLAGS="$save_CFLAGS"
if test $bfd_cv_hidden = yes; then
AC_DEFINE(HAVE_HIDDEN, 1,
[Define if your compiler supports hidden visibility.])
More information about the Binutils-cvs
mailing list