f8d165
From c8ccdbfe1e45cb3b832109d644296c0a3b3e0b59 Mon Sep 17 00:00:00 2001
f8d165
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
f8d165
Date: Sun, 2 Sep 2018 03:49:31 +0000
f8d165
Subject: [PATCH] configure.ac: -fstack-protector-strong
f8d165
f8d165
* configure.ac: use -fstack-protector-strong if available instead of
f8d165
  -fstack-protector conditionally.  [ruby-core:88788] [Misc #15053]
f8d165
f8d165
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
f8d165
---
f8d165
 configure.ac | 17 ++++++++++-------
f8d165
 1 file changed, 10 insertions(+), 7 deletions(-)
f8d165
f8d165
diff --git a/configure.ac b/configure.ac
f8d165
index 9328fa532de0..b8ee57239215 100644
f8d165
--- a/configure.ac
f8d165
+++ b/configure.ac
f8d165
@@ -837,15 +837,18 @@ AS_IF([test "$GCC" = yes], [
f8d165
 	stack_protector=no
f8d165
     ])
f8d165
     AS_IF([test -z "${stack_protector+set}"], [
f8d165
-	RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no])
f8d165
-	AS_IF([test "x$stack_protector" = xyes], [
f8d165
-	    RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken])
f8d165
+	AS_FOR(option, opt, [-fstack-protector-strong -fstack-protector], [
f8d165
+	    RUBY_TRY_CFLAGS(option, [stack_protector=yes])
f8d165
+	    AS_IF([test "x$stack_protector" = xyes], [
f8d165
+		RUBY_TRY_LDFLAGS(option, [], [stack_protector=])
f8d165
+	    ])
f8d165
+	    AS_IF([test "x$stack_protector" = xyes], [stack_protector=option; break])
f8d165
 	])
f8d165
     ])
f8d165
-    AS_IF([test "x$stack_protector" = xyes], [
f8d165
-	RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector)
f8d165
-	RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector)
f8d165
-	RUBY_APPEND_OPTION(LDFLAGS, -fstack-protector)
f8d165
+    AS_CASE(["$stack_protector"], [-*], [
f8d165
+	RUBY_APPEND_OPTION(XCFLAGS, $stack_protector)
f8d165
+	RUBY_APPEND_OPTION(XLDFLAGS, $stack_protector)
f8d165
+	RUBY_APPEND_OPTION(LDFLAGS, $stack_protector)
f8d165
     ])
f8d165
 
f8d165
     AS_CASE("${compress_debug_sections:-zlib}",