diff options
author | Jonathan Yong <10walls@gmail.com> | 2020-11-11 15:21:26 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-11-11 15:36:05 +0000 |
commit | 505ea90904436e6477f24c8d9775762ca4b29e7b (patch) | |
tree | 2f05f0e60c94bc9a8de2e1203d8fa9deb73cafdf | |
parent | 86cca5cc14602814b98e55aae313fbe237af1b04 (diff) | |
download | gcc-505ea90904436e6477f24c8d9775762ca4b29e7b.zip gcc-505ea90904436e6477f24c8d9775762ca4b29e7b.tar.gz gcc-505ea90904436e6477f24c8d9775762ca4b29e7b.tar.bz2 |
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.
libstdc++-v3/ChangeLog:
* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Exclude
cygwin and mingw from relro linker test.
* configure: Regenerate.
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 23 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 230 |
2 files changed, 176 insertions, 77 deletions
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index b9452dd..650d63a 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. diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index efdec6e..1997c1f 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -22936,15 +22936,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -30131,15 +30140,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -36054,15 +36072,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -47976,15 +48003,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -48252,15 +48288,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -48719,15 +48764,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -55098,15 +55152,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -61029,15 +61092,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -61230,15 +61302,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. @@ -61450,15 +61531,24 @@ $as_echo "$ac_gcsections" >&6; } # Note this is only for shared objects. ac_ld_relro=no if test x"$with_gnu_ld" = x"yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 + # cygwin and mingw uses PE, which has no ELF relro support, + # multi target ld may confuse configure machinery + case "$host" in + *-*-cygwin*) + ;; + *-*-mingw*) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-z,relro" >&5 $as_echo_n "checking for ld that supports -Wl,-z,relro... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ld_relro" >&5 $as_echo "$ac_ld_relro" >&6; } + esac fi # Set linker optimization flags. |