* [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] @ 2022-01-02 14:16 H.J. Lu 2022-01-03 11:20 ` Florian Weimer 2022-01-04 18:37 ` Joseph Myers 0 siblings, 2 replies; 5+ messages in thread From: H.J. Lu @ 2022-01-02 14:16 UTC (permalink / raw) To: libc-alpha 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. --- aclocal.m4 | 8 +++++++- configure | 32 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 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 diff --git a/configure b/configure index 954bae803e..3f956cf777 100755 --- a/configure +++ b/configure @@ -6009,7 +6009,13 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_linker_feature=yes + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: -z execstack ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi fi rm -f conftest* fi @@ -6039,7 +6045,13 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_linker_feature=yes + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi fi rm -f conftest* fi @@ -6070,7 +6082,13 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_linker_feature=yes + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: --depaudit ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi fi rm -f conftest* fi @@ -6101,7 +6119,13 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_linker_feature=yes + if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ + -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ + | grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then + true + else + libc_linker_feature=yes + fi fi rm -f conftest* fi -- 2.33.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] 2022-01-02 14:16 [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] H.J. Lu @ 2022-01-03 11:20 ` Florian Weimer 2022-01-04 18:37 ` Joseph Myers 1 sibling, 0 replies; 5+ messages in thread From: Florian Weimer @ 2022-01-03 11:20 UTC (permalink / raw) To: H.J. Lu via Libc-alpha * H. J. Lu via Libc-alpha: > 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. Looks okay to me. Thanks, Florian ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] 2022-01-02 14:16 [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] H.J. Lu 2022-01-03 11:20 ` Florian Weimer @ 2022-01-04 18:37 ` Joseph Myers 2022-01-04 18:47 ` [PATCH] Set LC_ALL=C for " H.J. Lu 2022-01-04 21:47 ` [PATCH] Properly check linker option in " Florian Weimer 1 sibling, 2 replies; 5+ messages in thread From: Joseph Myers @ 2022-01-04 18:37 UTC (permalink / raw) To: H.J. Lu; +Cc: libc-alpha On Sun, 2 Jan 2022, H.J. Lu via Libc-alpha wrote: > + 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 If you check for specific English language text like that (which may not be a good idea, since binutils maintainers may expect to be able to rephrase messages without breaking glibc), you need to run the linker (and thus the compiler) with LC_ALL=C to avoid getting a translated message. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Set LC_ALL=C for LIBC_LINKER_FEATURE [BZ #28738] 2022-01-04 18:37 ` Joseph Myers @ 2022-01-04 18:47 ` H.J. Lu 2022-01-04 21:47 ` [PATCH] Properly check linker option in " Florian Weimer 1 sibling, 0 replies; 5+ messages in thread From: H.J. Lu @ 2022-01-04 18:47 UTC (permalink / raw) To: Joseph Myers; +Cc: GNU C Library [-- Attachment #1: Type: text/plain, Size: 843 bytes --] On Tue, Jan 4, 2022 at 10:37 AM Joseph Myers <joseph@codesourcery.com> wrote: > > On Sun, 2 Jan 2022, H.J. Lu via Libc-alpha wrote: > > > + 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 > > If you check for specific English language text like that (which may not > be a good idea, since binutils maintainers may expect to be able to True. Different linkers can have different behavior on unknown options. We need to update the linker feature check for it. > rephrase messages without breaking glibc), you need to run the linker (and > thus the compiler) with LC_ALL=C to avoid getting a translated message. > Here is a patch to set LC_ALL=C for LIBC_LINKER_FEATURE. Thanks. -- H.J. [-- Attachment #2: 0001-Set-LC_ALL-C-for-LIBC_LINKER_FEATURE-BZ-28738.patch --] [-- Type: text/x-patch, Size: 2828 bytes --] From 8f3266ac512e2182c49a42f065bbe97451044ebc Mon Sep 17 00:00:00 2001 From: "H.J. Lu" <hjl.tools@gmail.com> Date: Tue, 4 Jan 2022 10:40:56 -0800 Subject: [PATCH] Set LC_ALL=C for LIBC_LINKER_FEATURE [BZ #28738] Set LC_ALL=C when compiling the LIBC_LINKER_FEATURE to avoid linker warning message translation. This updates the fix for BZ #28738. --- aclocal.m4 | 2 +- configure | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 3e0bcdd12b..7ee9c53ee8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -236,7 +236,7 @@ EOF -fPIC -shared -o conftest.so conftest.c 1>&AS_MESSAGE_LOG_FD]) then - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp $2 -nostdlib \ + if LC_ALL=C ${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 diff --git a/configure b/configure index 3f956cf777..a71360abd9 100755 --- a/configure +++ b/configure @@ -6009,7 +6009,7 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ + if LC_ALL=C ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,execstack -nostdlib \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ | grep "warning: -z execstack ignored" > /dev/null 2>&1; then true @@ -6045,7 +6045,7 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ + if LC_ALL=C ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-z,start-stop-gc -nostdlib \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ | grep "warning: -z start-stop-gc ignored" > /dev/null 2>&1; then true @@ -6082,7 +6082,7 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ + if LC_ALL=C ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--depaudit,x -nostdlib \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ | grep "warning: --depaudit ignored" > /dev/null 2>&1; then true @@ -6119,7 +6119,7 @@ EOF $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ + if LC_ALL=C ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,--no-dynamic-linker -nostdlib \ -nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \ | grep "warning: --no-dynamic-linker ignored" > /dev/null 2>&1; then true -- 2.33.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] 2022-01-04 18:37 ` Joseph Myers 2022-01-04 18:47 ` [PATCH] Set LC_ALL=C for " H.J. Lu @ 2022-01-04 21:47 ` Florian Weimer 1 sibling, 0 replies; 5+ messages in thread From: Florian Weimer @ 2022-01-04 21:47 UTC (permalink / raw) To: Joseph Myers; +Cc: H.J. Lu, libc-alpha * Joseph Myers: > On Sun, 2 Jan 2022, H.J. Lu via Libc-alpha wrote: > >> + 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 > > If you check for specific English language text like that (which may not > be a good idea, since binutils maintainers may expect to be able to > rephrase messages without breaking glibc), you need to run the linker (and > thus the compiler) with LC_ALL=C to avoid getting a translated message. That was my thought as well, but I think the generated configure script already takes care of that: # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE That's fairly early in the script. Thanks, Florian ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-04 21:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-01-02 14:16 [PATCH] Properly check linker option in LIBC_LINKER_FEATURE [BZ #28738] H.J. Lu 2022-01-03 11:20 ` Florian Weimer 2022-01-04 18:37 ` Joseph Myers 2022-01-04 18:47 ` [PATCH] Set LC_ALL=C for " H.J. Lu 2022-01-04 21:47 ` [PATCH] Properly check linker option in " Florian Weimer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).