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

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 5 08:06:00 GMT 2019


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

--- Comment #16 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Sat Oct  5 08:05:44 2019
New Revision: 276623

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

Darwin's linker doesn't like text section relocations (they require special
enabling).  At least, the Fortran FE 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.

gcc/ChangeLog:

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:
    trunk/gcc/ChangeLog
    trunk/gcc/config/darwin.c


More information about the Gcc-bugs mailing list