about summary refs log tree commit diff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-01-02 06:01:21 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-03 05:12:34 -0800
commitbd1616c6bee625a2726d0f8b477881b4b25697d8 (patch)
treeb3dae5efabfe793bcd72173eaab4a9dec1d06871 /aclocal.m4
parenta51faeee6ae68da63e65eb0a1eb6c9ec2ce2148b (diff)
downloadglibc-bd1616c6bee625a2726d0f8b477881b4b25697d8.tar.gz
glibc-bd1616c6bee625a2726d0f8b477881b4b25697d8.tar.xz
glibc-bd1616c6bee625a2726d0f8b477881b4b25697d8.zip
Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738]
Update LIBC_LINKER_FEATURE to also check linker warning message since
unknown linker -z option may be ignored by linker:

$ touch x.c
$ gcc -shared -Wl,-z,foobar x.c
/usr/bin/ld: warning: -z foobar ignored
$ echo $?
0
$

This fixes BZ #28738.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m48
1 files changed, 7 insertions, 1 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 3a90d4f679..3e0bcdd12b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -236,7 +236,13 @@ EOF
 		    -fPIC -shared -o conftest.so conftest.c
 		    1>&AS_MESSAGE_LOG_FD])
   then
-    libc_linker_feature=yes
+    if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \
+	-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
+	| grep "warning: $1 ignored" > /dev/null 2>&1; then
+      true
+    else
+      libc_linker_feature=yes
+    fi
   fi
   rm -f conftest*
 fi