https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91420

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <[email protected]>:

https://gcc.gnu.org/g:fb8a9da75a4962e2a79eef640364d2544b1319ee

commit r16-5943-gfb8a9da75a4962e2a79eef640364d2544b1319ee
Author: Alexandre Oliva <[email protected]>
Date:   Sat Dec 6 20:11:42 2025 -0300

    [riscv] avoid auipc overflow with large offsets [PR91420]

    When computing an address plus a large offset on riscv64 with a
    PC-relative sequence, we may hit the range limit for auipc and get a
    relocation overflow, where on riscv32 the computation wraps around.

    Since -mcmodel=medany requires the entire program to fit in a 2GiB
    address range, a +/-1GiB+ offset added to an in-range symbol in a
    barely-fitting program is more likely than not to be out-of-range.
    Since such large constants are unlikely to come up by chance, separate
    them from the symbol so as to avoid the relocation overflow.


    for  gcc/ChangeLog

            PR target/91420
            * config/riscv/riscv.cc (riscv_symbolic_constant_p): Require
            offsets smaller than +/- 1GiB for PCREL symbols.

    for  gcc/testsuite/ChangeLog

            PR target/91420
            * gcc.target/riscv/pr91420.c: New.
  • [Bug target/91420] relocation t... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to