Outline atomics is not designed to be used with -mcmodel=large, so disable
it automatically if the large code model is used.  Update documentation.

gcc:
        PR target/112465
        * config/aarch64/aarch64.cc (aarch64_override_options_after_change_1):
        Turn off outline atomics with -mcmodel=large.
        * doc/invoke.texi (-mcmodel=large): Update description.

---

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 
f9d906f449f27906f8cf0b4b4edee898cb795e15..075bd035dd42470e5df203366a96c1eac943fe56
 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -19987,6 +19987,10 @@ aarch64_override_options_after_change_1 (struct 
gcc_options *opts)
      intermediary step for the former.  */
   if (flag_mlow_precision_sqrt)
     flag_mrecip_low_precision_sqrt = true;
+
+  /* Turn off outline atomics with -mcmodel=large.  */
+  if (aarch64_cmodel == AARCH64_CMODEL_LARGE)
+    opts->x_aarch64_flag_outline_atomics = 0;
 }
 
 /* 'Unpack' up the internal tuning structs and update the options
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 
498a3608151e8641ee1495b548ca38182efbe3eb..edc29aaec0f9aa0f6b717277f2559035507ce43a
 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -21495,10 +21495,10 @@ dynamically linked.  This is the default code model.
 
 @opindex mcmodel=large
 @item -mcmodel=large
-Generate code for the large code model.  This makes no assumptions about
-addresses and sizes of sections.  Programs can be statically linked only.  The
-@option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
-@option{-fpic} and @option{-fPIC}.
+Generate code for the large code model.  This allows large .bss and .data
+sections, however .text and .rodata must still be < 2GiB in total.
+The @option{-moutline-atomics} is turned off by default.  Static linking
+with small/tiny model object files is not supported.
 
 @item -mtp=@var{name}
 @opindex mtp

Reply via email to