Blob Blame History Raw
From c8ccdbfe1e45cb3b832109d644296c0a3b3e0b59 Mon Sep 17 00:00:00 2001
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sun, 2 Sep 2018 03:49:31 +0000
Subject: [PATCH] configure.in: -fstack-protector-strong

* configure.in: use -fstack-protector-strong if available instead of
  -fstack-protector conditionally.  [ruby-core:88788] [Misc #15053]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 configure.in | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/configure.in b/configure.in
index f949883..bb9aef3 100644
--- a/configure.in
+++ b/configure.in
@@ -907,15 +907,20 @@ if test "$GCC" = yes; then
 	stack_protector=no
     ])
     if test -z "${stack_protector+set}"; then
-	RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no])
+	     AS_FOR(option, opt, [-fstack-protector-strong -fstack-protector], [
+        RUBY_TRY_CFLAGS(option, [stack_protector=yes])
 	if test "x$stack_protector" = xyes; then
-	    RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken])
+	    RUBY_TRY_LDFLAGS(option, [], [stack_protector=])
 	fi
+	if test "x$stack_protector" = xyes; then
+        stack_protector=option; break
+	fi
+      ])
     fi
     if test "x$stack_protector" = xyes; then
-	RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector)
-	RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector)
-	RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector)
+	RUBY_APPEND_OPTION(XCFLAGS, $stack_protector)
+	RUBY_APPEND_OPTION(XLDFLAGS, $stack_protector)
+	RUBY_APPEND_OPTION(LDFLAGS, $stack_protector)
     fi
 
     AS_CASE(["$target_os"],[mingw*], [