From 1dfe007e1696128ff0d3ec78e54d3406073f7727 Mon Sep 17 00:00:00 2001 From: Jeremiah Gowdy Date: Thu, 16 Jun 2022 10:29:28 -0700 Subject: [PATCH] Update configure.ac Co-authored-by: Nobuyoshi Nakada --- configure.ac | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index ef3f521a6d..7bfc2a03ef 100644 --- a/configure.ac +++ b/configure.ac @@ -782,14 +782,11 @@ AS_IF([test "$GCC" = yes], [ # aarch64 branch protection AS_CASE(["$target_cpu"], [aarch64], [ - branch_protection=no - RUBY_TRY_CFLAGS(-mbranch-protection=pac-ret,[branch_protection=yes]) - AS_IF([test "x$branch_protection" = xyes], [ - RUBY_APPEND_OPTION(XCFLAGS, -mbranch-protection=pac-ret) - ], - [ - RUBY_TRY_CFLAGS(-msign-return-address=all, [ - RUBY_APPEND_OPTION(XCFLAGS, -msign-return-address=all) + AS_FOR(option, opt, [-mbranch-protection=pac-ret -msign-return-address=all], [ + RUBY_TRY_CFLAGS(option, [branch_protection=yes], [branch_protection=no]) + AS_IF([test "x$branch_protection" = xyes], [ + RUBY_APPEND_OPTION(XCFLAGS, option) + break ]) ]) ])