Blame SOURCES/ruby-2.6.0-configure-fstack-protector-strong.patch

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