https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123791
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Wilco Dijkstra <[email protected]>: https://gcc.gnu.org/g:b4aa063fe4a4142544a0aad362ef45b2f23165ee commit r17-652-gb4aa063fe4a4142544a0aad362ef45b2f23165ee Author: Wilco Dijkstra <[email protected]> Date: Mon Feb 9 19:01:19 2026 +0000 AArch64: Add PIC/PIE support to large model [PR 123791] Use an indirection via GOT for data accesses that might be out of range of ADRP. Using the GOT avoids placing relro symbol references in literal pools (PR 123791). It also allows the large model to trivially support PIC/PIE. Constants and readonly data use ADRP since the maximum text size is 2GB in the large model [1]. The code quality of -mcmodel=large improves dramatically as a result: codesize of SPEC2017 reduces by 2.2%. [1] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#code-models gcc: PR target/123791 * config/aarch64/aarch64.cc (aarch64_cannot_force_const_mem): Remove forcing symbol references to const mem. (aarch64_can_use_per_function_literal_pools_p): Return false for large model. (aarch64_use_blocks_for_constant_p): Update comment. (initialize_aarch64_code_model): Allow PIC/PIE. (aarch64_classify_symbol): Use SYMBOL_SMALL_ABSOLUTE for constant references and SYMBOL_SMALL_GOT_4G for writeable data. gcc/testsuite: PR target/123791 * gcc.target/aarch64/pr123791.c: Update test. * gcc.target/aarch64/pr63304_1.c: Likewise. * gcc.target/aarch64/pr78733.c: Likewise. * gcc.target/aarch64/pr79041-2.c: Likewise.
