public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: exclude cygwin/mingw from relro linker test
@ 2020-11-11 12:34 Jonathan Yong
  2020-11-11 12:41 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Yong @ 2020-11-11 12:34 UTC (permalink / raw)
  To: libstdc++; +Cc: Gcc Patch List


[-- Attachment #1.1.1: Type: text/plain, Size: 200 bytes --]

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?

[-- Attachment #1.1.2: 0001-libstdc-exclude-cygwin-and-mingw-from-linker-relro-s.patch --]
[-- Type: text/x-patch, Size: 1825 bytes --]

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


[-- Attachment #1.1.3: OpenPGP_0x713B5FE29C145D45_and_old_rev.asc --]
[-- Type: application/pgp-keys, Size: 8035 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: exclude cygwin/mingw from relro linker test
  2020-11-11 12:34 [PATCH] libstdc++: exclude cygwin/mingw from relro linker test Jonathan Yong
@ 2020-11-11 12:41 ` Jonathan Wakely
  2020-11-11 15:36   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2020-11-11 12:41 UTC (permalink / raw)
  To: Jonathan Yong; +Cc: libstdc++, Gcc Patch List

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
>






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libstdc++: exclude cygwin/mingw from relro linker test
  2020-11-11 12:41 ` Jonathan Wakely
@ 2020-11-11 15:36   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2020-11-11 15:36 UTC (permalink / raw)
  To: Jonathan Yong; +Cc: libstdc++, Gcc Patch List

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-11 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 12:34 [PATCH] libstdc++: exclude cygwin/mingw from relro linker test Jonathan Yong
2020-11-11 12:41 ` Jonathan Wakely
2020-11-11 15:36   ` Jonathan Wakely

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).