PowerPC -mcmodel=large now supports PC-relative addressing.
PowerPC compilers now allow the large code model (-mcmodel=large) to use PC-relative addressing, previously restricted to medium.
This change enables the use of PC-relative addressing with the -mcmodel=large option for PowerPC processors, including Power10 and Power11. Previously, PC-relative addressing was only supported for the -mcmodel=medium option. This update allows for greater flexibility in code generation for large models on these architectures.
In Details
Support for PC-relative addressing on PowerPC, previously limited to -mcmodel=medium, has been extended to -mcmodel=large. This involved modifying rs6000.cc to allow prefixed addressing for the large code model and adjusting the rs6000_elf_declare_function_name function to correctly handle local/non-local labels when PC-relative addressing is used with the large model.
- PC-relative addressing
- A method of addressing memory where the address is calculated relative to the current value of the Program Counter (PC). This is often used for position-independent code (PIC) and position-independent executables (PIE).
- -mcmodel=large
- A GCC command-line option that instructs the compiler to generate code for a large memory model, which typically implies support for addressing beyond a certain limit (e.g., 2GB) and may affect how code and data are laid out and addressed.
- PowerPC
- A RISC instruction set architecture developed by Apple, IBM, and Motorola. GCC supports various versions and implementations of PowerPC.
- Power10/Power11
- Specific generations of IBM's Power ISA, featuring architectural enhancements relevant to instruction sets and capabilities.
- Prefixed addressing
- A type of addressing mode that uses a base register and an offset, often used in conjunction with PC-relative calculations.