Hi.

As mentioned in the ovmf project [1], they would like to have a control
over the -mno-outline-atomics via a function attribute. They struggle
with configure detection and this can help them to disable the outlining.

Would it be possible to add the attribute?
Thanks,
Martin

[1] https://bugzilla.tianocore.org/show_bug.cgi?id=2723

gcc/ChangeLog:

2020-05-21  Martin Liska  <mli...@suse.cz>

        * common/config/aarch64/aarch64-common.c (aarch64_handle_option):
        Handle OPT_moutline_atomics.
        * config/aarch64/aarch64.c: Add outline-atomics to
        aarch64_attributes.
        * doc/extend.texi: Document the newly added target attribute.
---
 gcc/common/config/aarch64/aarch64-common.c | 4 ++++
 gcc/config/aarch64/aarch64.c               | 2 ++
 gcc/doc/extend.texi                        | 6 ++++++
 3 files changed, 12 insertions(+)


diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c
index 0bddcc8c3e9..51bd319d6d3 100644
--- a/gcc/common/config/aarch64/aarch64-common.c
+++ b/gcc/common/config/aarch64/aarch64-common.c
@@ -116,6 +116,10 @@ aarch64_handle_option (struct gcc_options *opts,
       opts->x_flag_omit_leaf_frame_pointer = val;
       return true;
 
+    case OPT_moutline_atomics:
+      opts->x_aarch64_flag_outline_atomics = val;
+      return true;
+
     default:
       return true;
     }
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 79c016f4dc3..78db0a56323 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -15266,6 +15266,8 @@ static const struct aarch64_attribute_info aarch64_attributes[] =
      aarch64_handle_attr_branch_protection, OPT_mbranch_protection_ },
   { "sign-return-address", aarch64_attr_enum, false, NULL,
      OPT_msign_return_address_ },
+  { "outline-atomics", aarch64_attr_bool, true, NULL,
+     OPT_moutline_atomics},
   { NULL, aarch64_attr_custom, false, NULL, OPT____ }
 };
 
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index c80848e9061..a2ebef8cf8c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -4066,6 +4066,12 @@ Select the function scope on which branch protection will be applied.  The
 behavior and permissible arguments are the same as for the command-line option
 @option{-mbranch-protection=}.  The default value is @code{none}.
 
+@item outline-atomics
+@cindex @code{outline-atomics} function attribute, AArch64
+Enable or disable calls to out-of-line helpers to implement atomic operations.
+This corresponds to the behavior of the command line options
+@option{-moutline-atomics} and @option{-mno-outline-atomics}.
+
 @end table
 
 The above target attributes can be specified as follows:

Reply via email to