On Tue, Mar 4, 2025 at 11:47 PM Wilco Dijkstra <wilco.dijks...@arm.com> wrote:
>
> Hi Kyrill,
>
> > This restriction should be documented in invoke.texi IMO.
> > I also think it would be more user friendly to warn them about the 
> > incompatibility if an explicit -moutline-atomics option is passed.
> > It’s okay though to silently turn off the implicit default-on option though.
>
> I've updated the documentation for -mcmodel=large so it's a little closer to 
> reality.
> I've also added the same check as for other incompatible options like -fPIC - 
> this
> means with explicit use of outline atomics you get an error immediately 
> instead of
> an unclear linker error.
>
> Cheers,
> Wilco
>
>
> v2: Update docs, report incompatible use of -mcmodel=large and outline 
> atomics.
>
> Outline atomics is not designed to be used with -mcmodel=large, so disable
> it automatically if the large code model is used.  Report incompatible
> explicit use of outline atomics with large model.  Update documentation.
>
> gcc:
>         PR target/112465
>         * config/aarch64/aarch64.cc (aarch64_override_options_after_change_1):
>         Turn off outline atomics with -mcmodel=large.
>         (initialize_aarch64_code_model): Report incompatible use of large 
> model
>         and outline atomics.
>         * doc/invoke.texi (-mcmodel=large): Update description.
>
> ---
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 
> fe76730b0a7c8a2baaae24152e13d82a12d5d0a3..8bf0c011309d1f603137556006297dae5f009a47
>  100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -18563,6 +18563,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
> @@ -19150,6 +19154,8 @@ initialize_aarch64_code_model (struct gcc_options 
> *opts)
>                opts->x_flag_pic > 1 ? "PIC" : "pic");
>        if (opts->x_aarch64_abi == AARCH64_ABI_ILP32)
>         sorry ("code model %qs not supported in ilp32 mode", "large");
> +      if (opts->x_aarch64_flag_outline_atomics == 1)
> +       sorry ("code model %qs does not support %<-moutline-atomics%>", 
> "large");
>        break;
>      case AARCH64_CMODEL_TINY_PIC:
>      case AARCH64_CMODEL_SMALL_PIC:
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 
> bad49a017cc1bb0922eba9f0b2db80166d409cd7..7352da7724a60efdbdbb6b743b1f7fef258f4bc8
>  100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -21512,10 +21512,12 @@ 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
> +Generate code for the large code model.  This allows large .bss and .data
> +sections, however .text and .rodata must still be < 2GiB in total.  Position
> +independent code or statically linked libraries are not supported.  The
>  @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
> -@option{-fpic} and @option{-fPIC}.
> +@option{-fpie}, @option{-fPIE}, @option{-fpic}, @option{-fPIC},
> +@option{-static}, @option{-moutline-atomics}.

What's the issue with -static ?


Ramana

>
>  @item -mtp=@var{name}
>  @opindex mtp
>

Reply via email to