Message ID | 438b6e5d-b04a-a549-2ab3-a793cb96011a@gmail.com |
---|---|
State | New |
Headers | show |
Series | libstdc++: exclude cygwin/mingw from relro linker test | expand |
On 11/11/20 12:34 +0000, Jonathan Yong via Libstdc++ wrote: >cygwin/mingw hosted linker may support multiple targets with ELF relro >support. This breaks configure testing. > >Attached patch excludes cygwin/mingw PE format from relro linker flag. >Patch OK? OK, thanks. >From a72f02aec065c312528e41e4243c702d7371b5ce Mon Sep 17 00:00:00 2001 >From: Jonathan Yong <10walls@gmail.com> >Date: Wed, 11 Nov 2020 12:23:06 +0000 >Subject: [PATCH] libstdc++: exclude cygwin and mingw from linker relro support > >PE format does not have ELF style relro linker support, exclude >from checking. If the host linker supports ELF format, configure >may get confused. > > 11-11-20202 Jonathan Yong <10walls@gmail.com> > libstdc++: > * acinclude (GLIBCXX_CHECK_LINKER_FEATURES): exclude > cygwin and mingw from relro linker test. >--- > libstdc++-v3/acinclude.m4 | 23 ++++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > >diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 >index b9452dd74cd..650d63ab3d7 100644 >--- a/libstdc++-v3/acinclude.m4 >+++ b/libstdc++-v3/acinclude.m4 >@@ -273,13 +273,22 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ > # Note this is only for shared objects. > ac_ld_relro=no > if test x"$with_gnu_ld" = x"yes"; then >- AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) >- cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` >- if test -n "$cxx_z_relo"; then >- OPT_LDFLAGS="-Wl,-z,relro" >- ac_ld_relro=yes >- fi >- AC_MSG_RESULT($ac_ld_relro) >+ # cygwin and mingw uses PE, which has no ELF relro support, >+ # multi target ld may confuse configure machinery >+ case "$host" in >+ *-*-cygwin*) >+ ;; >+ *-*-mingw*) >+ ;; >+ *) >+ AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) >+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` >+ if test -n "$cxx_z_relo"; then >+ OPT_LDFLAGS="-Wl,-z,relro" >+ ac_ld_relro=yes >+ fi >+ AC_MSG_RESULT($ac_ld_relro) >+ esac > fi > > # Set linker optimization flags. >-- >2.29.2 >
On 11/11/20 12:41 +0000, Jonathan Wakely wrote: >On 11/11/20 12:34 +0000, Jonathan Yong via Libstdc++ wrote: >>cygwin/mingw hosted linker may support multiple targets with ELF >>relro support. This breaks configure testing. >> >>Attached patch excludes cygwin/mingw PE format from relro linker >>flag. Patch OK? > >OK, thanks. Pushed to master now.
From a72f02aec065c312528e41e4243c702d7371b5ce Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10walls@gmail.com> Date: Wed, 11 Nov 2020 12:23:06 +0000 Subject: [PATCH] libstdc++: exclude cygwin and mingw from linker relro support PE format does not have ELF style relro linker support, exclude from checking. If the host linker supports ELF format, configure may get confused. 11-11-20202 Jonathan Yong <10walls@gmail.com> libstdc++: * acinclude (GLIBCXX_CHECK_LINKER_FEATURES): exclude cygwin and mingw from relro linker test. --- libstdc++-v3/acinclude.m4 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index b9452dd74cd..650d63ab3d7 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -273,13 +273,22 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) - cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` - if test -n "$cxx_z_relo"; then - OPT_LDFLAGS="-Wl,-z,relro" - ac_ld_relro=yes - fi - AC_MSG_RESULT($ac_ld_relro) + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) + cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` + if test -n "$cxx_z_relo"; then + OPT_LDFLAGS="-Wl,-z,relro" + ac_ld_relro=yes + fi + AC_MSG_RESULT($ac_ld_relro) + esac fi # Set linker optimization flags. -- 2.29.2