Hi Andrea,
> I think we should warn if someone passes both `-mcmodel=large
> -moutline-atomics` to the command line. I noticed
> aarch64_flag_outline_atomics is initialized to 2 so I think
> `aarch64_flag_outline_atomics == 1` or
> opts_set->x_aarch64_flag_outline_atomics will be the check there.
Sure, something like this? Not sure what OPT_ value to use, but the outline
atomics one seemed most relevant.
Cheers,
Wilco
v3: Add warning
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 --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index
f9d906f449f27906f8cf0b4b4edee898cb795e15..b176f0474b19f91ac496d986b6b24f8a09923420
100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -19987,6 +19987,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
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