[Bug target/99783] relocation truncated to fit: R_OR1K_GOT16 on OpenRISC, building libgeos

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Aug 14 22:23:23 GMT 2021


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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Stafford Horne <shorne@gcc.gnu.org>:

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

commit r12-2909-geff8110674ef193481d3657456a262beeb9951ff
Author: Stafford Horne <shorne@gmail.com>
Date:   Tue Apr 6 05:47:17 2021 +0900

    or1k: Add mcmodel option to handle large GOTs

    When building libgeos we get an error with:

        linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
        crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16
against symbol `__cxa_finalize' defined in .text section in
       
/home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.

    This is caused by GOT code having a limit of 64k.  In OpenRISC this
    looks to be the only relocation code pattern to be limited to 64k.

    This patch allows specifying a new option -mcmodel=large which can be
    used to generate 2 more instructions to construct 32-bit addresses for
    up to 4G GOTs.

    gcc/ChangeLog:

            PR target/99783
            * config/or1k/or1k-opts.h: New file.
            * config/or1k/or1k.c (or1k_legitimize_address_1, print_reloc):
            Support generating gotha relocations if -mcmodel=large is
            specified.
            * config/or1k/or1k.h (TARGET_CMODEL_SMALL, TARGET_CMODEL_LARGE):
            New macros.
            * config/or1k/or1k.opt (mcmodel=): New option.
            * doc/invoke.texi (OpenRISC Options): Document mcmodel.


More information about the Gcc-bugs mailing list