[Bug target/67183] Darwin stub vs. non_lazy pointer ordering incompatible with clang assembler.

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


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

--- Comment #8 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Tue Oct 29 20:16:28 2019
New Revision: 277587

URL: https://gcc.gnu.org/viewcvs?rev=277587&root=gcc&view=rev
Log:
[Darwin, machopic] Fix for 67183

When we're using the LLVM-based assembler (the default on modern Darwin)
the ordering of stubs and non-lazy symbol pointers is important.

Interleaving the output (current GCC behaviour) leads to crashes which
prevents us from building code with symbol stubs.

To resolve this, we order the output of stubs and symbol indirections:

1. Any indirections in the data section
2. Symbol stubs.
3. Non-lazy symbol pointers.

At present, we still emit LTO sections after these.

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

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

        PR target/67183
        * config/darwin.c (machopic_indirection): New field to flag
        non-lazy-symbol-pointers in the data section.
        (machopic_indirection_name): Compute if an indirection should
        appear in the data section.
        (machopic_output_data_section_indirection): New callback split
        from machopic_output_indirection.
        (machopic_output_stub_indirection): Likewise.
        (machopic_output_indirection): Retain the code for non-lazy
        symbol pointers in their regular section.
        (machopic_finish): Use the new callbacks to order the indirection
        output.


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


More information about the Gcc-bugs mailing list