about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-01-04 13:46:38 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:41 -0300
commit3be1ab1ff9a6e9e8115702c4dd6c8cb6e207a36d (patch)
tree00a372bb407c72cb32fcf2a97420e9c3e6597676 /configure.ac
parent1eed82b6917bfd26e642b6eaf831d08595cf9cfb (diff)
downloadglibc-3be1ab1ff9a6e9e8115702c4dd6c8cb6e207a36d.tar.gz
glibc-3be1ab1ff9a6e9e8115702c4dd6c8cb6e207a36d.tar.xz
glibc-3be1ab1ff9a6e9e8115702c4dd6c8cb6e207a36d.zip
Use -Wl,--undefined-version if linker requires it
The lld might set --no-undefined-version as default, which triggers
a lot of error since the Versions files may contain entries not
exported by all ABI.

The  -Wl,--undefined-version can not be set by default, since binutils
ld does not support (although gold does).  So it requires to be checked
at configure if linker requires and enabled it conditionally.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac27
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b501ddd439..5f75b25105 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1254,6 +1254,33 @@ LIBC_LINKER_FEATURE([--no-dynamic-linker],
 		    [libc_cv_no_dynamic_linker=no])
 LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
 
+AC_CACHE_CHECK(whether to suppress unused version in version script,
+	       libc_cv_undefined_version, [dnl
+cat > conftest.c <<EOF
+void foo (void) { }
+EOF
+cat > conftest.map <<EOF
+VER_1.0 {
+  global:
+    bar;
+};
+EOF
+libc_cv_undefined_version=""
+if ! AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared -Wl,--version-script=conftest.map conftest.c -o conftest.so]);
+then
+  LIBC_LINKER_FEATURE([--undefined-version],
+		      [-Wl,--undefined-version],
+		      [libc_cv_support_undefined_version=yes],
+		      [libc_cv_support_undefined_version=no])
+  if test "$libc_cv_support_undefined_version" = no; then
+    AC_MSG_ERROR([support for -Wl,--undefined-version required])
+  fi
+  libc_cv_undefined_version="-Wl,--undefined-version"
+fi
+rm -f conftest.*t])
+LIBC_CONFIG_VAR([config-ldflags-undefined-version],[$libc_cv_undefined_version])
+
+
 AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
 LIBC_TRY_CC_OPTION([-static-pie],
 		   [libc_cv_static_pie=yes],