about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-11 10:40:44 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-11-01 09:51:06 -0300
commit8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4 (patch)
tree9fe2d950df8424164112464dfbb5ec906b279757 /configure.ac
parent5c5a8b99cf96b71940e36a9db66d3a61bc315016 (diff)
downloadglibc-8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4.tar.gz
glibc-8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4.tar.xz
glibc-8d98c7c00f3f06545de9e5ce5cf778d2ab2450a4.zip
configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases
clang emits an warning when a double alias redirection is used, to warn
the the original symbol will be used even when weak definition is
overridden.  However, this is a common pattern for weak_alias, where
multiple alias are set to same symbol.

Reviewed-by: Fangrui Song <maskray@google.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac22
1 files changed, 22 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index c5c4b383a3..9fc1fb1c1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1404,6 +1404,28 @@ rm -f conftest*])
 AC_SUBST(libc_cv_mtls_dialect_gnu2)
 LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
 
+dnl clang emits an warning for a double alias redirection, to warn the
+dnl original symbol is sed even when weak definition overriddes it.
+dnl It is a usual pattern for weak_alias, where multiple alias point to
+dnl same symbol.
+AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
+	       libc_cv_wno_ignored_attributes, [dnl
+cat > conftest.c <<EOF
+void __foo (void)
+{
+}
+extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
+extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
+EOF
+libc_cv_wno_ignored_attributes=""
+if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
+then
+  libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
+fi
+rm -f conftest*])
+LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
+		[$libc_cv_wno_ignored_attributes])
+
 AC_CACHE_CHECK(whether cc puts quotes around section names,
 	       libc_cv_have_section_quotes,
 	       [cat > conftest.c <<EOF