[Bug target/98063] Emit R_X86_64_GOTOFF64 instead of R_X86_64_GOTPCRELX for -mcmodel=large -fno-plt

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 22 16:49:07 GMT 2021


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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

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

commit r8-10865-gc15b958bc1ac1dfab49953721cb797a1cc9ea164
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 1 10:44:40 2020 +0100

    x86_64: Fix up -fpic -mcmodel=large -fno-plt [PR98063]

    On the following testcase with -fpic -mcmodel=large -fno-plt we emit
    call puts@GOTPCREL(%rip)
    but that is not really appropriate for CM_LARGE_PIC, the .text can be
larger
    than 2GB in that case and the .got slot further away from %rip than what
can
    fit into the signed 32-bit immediate.

    The following patch computes the address of the .got slot the way it is
    computed for that model for function pointer loads, and calls that.

    2020-12-01  Jakub Jelinek  <jakub@redhat.com>

            PR target/98063
            * config/i386/i386.c (ix86_expand_call): Handle non-plt
            CM_LARGE_PIC calls.

            * gcc.target/i386/pr98063.c: New test.

    (cherry picked from commit ebc8606a9408623e2fa2a02a5526b882ffd0e7a8)


More information about the Gcc-bugs mailing list