[Bug target/59888] Darwin linker error "illegal text-relocation" with -shared

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 29 20:05:00 GMT 2019


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

--- Comment #22 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Tue Oct 29 20:05:05 2019
New Revision: 277584

URL: https://gcc.gnu.org/viewcvs?rev=277584&root=gcc&view=rev
Log:
[Darwin] Amend section for constants with relocations.

Darwin's linker doesn't like text section relocations (they require special
enabling). The Fortran FE, at least, seems to generate cases where the
initialiser for a pointer constant can need a relocation. We can handle
this by special-casing SECCAT_RODATA when the relocation is present by
placing the constant in the .const_data section.

2019-10-29  Iain Sandoe  <iain@sandoe.co.uk>

        Backport from mainline
        2019-10-05  Iain Sandoe  <iain@sandoe.co.uk>

        PR target/59888
        * config/darwin.c (darwin_rodata_section): Add relocation flag,
        choose const_data section for constants with relocations.
        (machopic_select_section): Pass relocation flag to
        darwin_rodata_section ().


Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/config/darwin.c


More information about the Gcc-bugs mailing list