summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <vinschen@redhat.com>2018-08-13 17:08:51 +0200
committerDamien Miller <djm@mindrot.org>2018-08-13 13:01:25 -0700
commit477b49a34b89f506f4794b35e3c70b3e2e83cd38 (patch)
tree9b744cef0d733197b71a2599334f78be52e025c7
parentb0917945efa374be7648d67dbbaaff323ab39edc (diff)
configure: work around GCC shortcoming on Cygwin
Cygwin's latest 7.x GCC allows to specify -mfunction-return=thunk as well as -mindirect-branch=thunk on the command line, albeit producing invalid code, leading to an error at link stage. The check in configure.ac only checks if the option is present, but not if it produces valid code. This patch fixes it by special-casing Cygwin. Another solution may be to change these to linker checks. Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
-rw-r--r--configure.ac11
1 files changed, 9 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index c4c759d4e..83e530750 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,8 +164,15 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result]) 164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) 165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
166 if test "x$use_toolchain_hardening" = "x1"; then 166 if test "x$use_toolchain_hardening" = "x1"; then
167 OSSH_CHECK_CFLAG_COMPILE([-mfunction-return=thunk]) # gcc 167 # Cygwin GCC 7.x allows thunking on the CLI, but produces non-working
168 OSSH_CHECK_CFLAG_COMPILE([-mindirect-branch=thunk]) # gcc 168 # code. Unfortunately you only notice this at link time.
169 case "$host" in
170 *-*-cygwin*) ;;
171 *)
172 OSSH_CHECK_CFLAG_COMPILE([-mfunction-return=thunk]) # gcc
173 OSSH_CHECK_CFLAG_COMPILE([-mindirect-branch=thunk]) # gcc
174 ;;
175 esac
169 OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang 176 OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang
170 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt]) 177 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt])
171 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2]) 178 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])