AArch64: Disable outline atomics with -mcmodel=large
Outline atomics are now disabled by default when using AArch64's -mcmodel=large.
This change disables the outline atomics feature on AArch64 when the -mcmodel=large option is used. Outline atomics are not designed to function correctly with the large code model, which affects how code addresses are generated. The compiler will now automatically turn off outline atomics if -mcmodel=large is active and issue a warning if the outline atomics option was explicitly enabled by the user. Documentation has been updated to reflect this change.
In Details
The aarch64_override_options_after_change_1 function now automatically disables outline atomics (outline_atomic_p) when -mcmodel=large is selected. This is because the large code model implies a different addressing scheme that is incompatible with the current implementation of outline atomics, which assumes a smaller, more constrained code size. A warning is emitted if outline atomics were explicitly requested via the command line. Documentation in invoke.texi is updated accordingly.
- AArch64
- The 64-bit ARM architecture, commonly used in mobile devices and increasingly in servers and desktops.
- outline atomics
- A GCC feature for AArch64 that implements atomic operations by calling out to a small, separate function, rather than inlining the atomic instructions. This can reduce code size in some cases but may have performance implications.
- -mcmodel=large
- An AArch64 compiler option that instructs the compiler to generate code for a large memory model. This typically means that addresses can be arbitrary, potentially affecting the efficiency of certain code generation strategies.
- code model
- A set of assumptions and strategies the compiler uses regarding the layout and addressing of code and data in memory. Different code models are suited for different program sizes and target architectures.