This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ATTRIBUTE_HIDDEN for libbfd.h


On Fri, May 25, 2018 at 09:48:35AM +0930, Alan Modra wrote:
> Thanks for the report.  I can reproduce the problem on Ubuntu too.
> My configure test is broken.
> 
> configure:14046: checking compiler support for hidden visibility
> configure:14064: x86_64-w64-mingw32-gcc -c -g -O2 -D__USE_MINGW_ACCESS  conftest.c >&5
> conftest.c:83:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
>  }
>  ^
> configure:14064: $? = 0
> configure:14071: result: yes

I'm committing the following.

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 --git a/bfd/configure.ac b/bfd/configure.ac
index b320828fbb..bb5c1687b4 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.])

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]