https://gcc.gnu.org/g:ee5bf81d7816b0b6c54788f195295ba448cda49e

commit r17-4655-gee5bf81d7816b0b6c54788f195295ba448cda49e
Author: Wilco Dijkstra <[email protected]>
Date:   Mon Mar 3 13:56:20 2025 +0000

    AArch64: Turn off outline atomics with -mcmodel=large [PR112465]
    
    Outline atomics is not designed to be used with -mcmodel=large, so disable
    it automatically if the large code model is used.  Warn if the option was
    enabled on the command-line.  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:
---
 gcc/config/aarch64/aarch64.cc | 9 +++++++++
 gcc/doc/invoke.texi           | 8 ++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 705c5378bac6..107271b04045 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -20081,6 +20081,15 @@ 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)
+    {
+      if (!TARGET_LSE && opts->x_aarch64_flag_outline_atomics == 1)
+       warning (OPT_moutline_atomics,
+                "%<-mcmodel=large%> implies %<-mno-outline-atomics%>");
+      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 feec1561850d..c5d17c059fd7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -21501,10 +21501,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