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

--- Comment #30 from Iain Sandoe <iains at gcc dot gnu.org> ---
Author: iains
Date: Sun Oct 27 21:17:33 2019
New Revision: 277493

URL: https://gcc.gnu.org/viewcvs?rev=277493&root=gcc&view=rev
Log:
[Darwin, machopic] Preparatory patches.

This is a combined set of 5 patches that allows us to fix
PR 65342 and 67183.

276924 Make machopic_finish() static.

276767 Set a SYMBOL flag for indirections.

We are able to treat these specially where needed in legitimate address
tests (specifically, they are guaranteed to be pointer-aligned).

276708 Compute and cache indirection rules.

This caches a check for the requirement to indirect a symbol in the Darwin
ABI, and uses it where needed.  We also ensure that we place the indirection
pointers into the non-lazy symbol pointers section.  Other placements have
occurred with various platform toolchains - but these seem to have been
unintentional so we match current platform toolchains.

276675 Consider visibility in indirections.

For weak, hidden vars the indirection should just be as normal, that
is that the indirections for such symbols should appear in the non-lazy
symbol pointers table, not in the .data section.

276674 Initial tidy of Mach-O symbol handling.

We want to improve the detection and caching of symbol-properties
so that (a) we can make the compiler's output match the platform
norms (b) we can improve efficiency by checking flags instead of
inspecting strings. (c) The fix for PR71767 was a largish hammer
and we want to reduce the number of symbols that are made linker-
visible.

This first patch is largely typographical changes with no functional
difference intended:

- Tries to ensure that there's no overlap between the symbols used in
the Mach-O case and those declared in the i386 or rs6000 port trees.

 - Some improvement to comments.

- Makes the naming of the symbol flags consistent with other uses.

 - Provides a predicate macro for each use.

2019-10-27  Iain Sandoe  <i...@sandoe.co.uk>

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

        * config/darwin-protos.h (machopic_finish): Delete.
        * config/darwin.c (machopic_finish): Make static.

        Backport from mainline
        2019-10-09  Iain Sandoe  <i...@sandoe.co.uk>

        * config/darwin.c (machopic_indirect_data_reference): Set flag to
        indicate that the new symbol is an indirection.
        (machopic_indirect_call_target): Likewise.
        * config/darwin.h (MACHO_SYMBOL_FLAG_INDIRECTION): New.
        (MACHO_SYMBOL_INDIRECTION_P): New.
        (MACHO_SYMBOL_FLAG_STATIC): Adjust bit number.

        Backport from mainline
        2019-10-08  Iain Sandoe  <i...@sandoe.co.uk>

        * config/darwin.c (machopic_indirect_data_reference): Check for
        required indirections before making direct access to defined
        values.
        (machopic_output_indirection): Place the indirected pointes for
        required indirections into the non-lazy symbol pointers section.
        (darwin_encode_section_info):
        * config/darwin.h (MACHO_SYMBOL_FLAG_MUST_INDIRECT): New.
        (MACHO_SYMBOL_MUST_INDIRECT_P): New.

        Backport from mainline
        2019-10-07  Iain Sandoe  <i...@sandoe.co.uk>

        * config/darwin.c (machopic_output_indirection): Don't put
        hidden symbol indirections into the .data section, use the
        non-lazy symbol pointers section as normal.
        (darwin_encode_section_info): Record if a symbol is hidden.
        * config/darwin.h (MACHO_SYMBOL_FLAG_HIDDEN_VIS): New.
        (MACHO_SYMBOL_HIDDEN_VIS_P): New.

        Backport from mainline
        2019-10-07  Iain Sandoe  <i...@sandoe.co.uk>

        * config/darwin.c (machopic_symbol_defined_p): Use symbol flag
        predicates instead of accessing bits directly.
        (machopic_indirect_call_target): Likewise.
        (machopic_output_indirection): Likewise.
        (darwin_encode_section_info): Improve description.  Use renamed
        symbol flags.  Use predicate macros for variables and functions.
        * config/darwin.h:
        Rename MACHO_SYMBOL_VARIABLE to MACHO_SYMBOL_FLAG_VARIABLE.
        Rename MACHO_SYMBOL_DEFINED to MACHO_SYMBOL_FLAG_DEFINED.
        Rename MACHO_SYMBOL_STATIC to MACHO_SYMBOL_FLAG_STATIC.
        (MACHO_SYMBOL_VARIABLE_P): New.
        (MACHO_SYMBOL_DEFINED_P):New.
        (MACHO_SYMBOL_STATIC_P): New.
        * config/i386/darwin.h (MACHO_SYMBOL_FLAG_VARIABLE): Delete.
        (SYMBOL_FLAG_SUBT_DEP): New.
        * config/rs6000/darwin.h (SYMBOL_FLAG_SUBT_DEP): New.


Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/darwin-protos.h
    branches/gcc-9-branch/gcc/config/darwin.c
    branches/gcc-9-branch/gcc/config/darwin.h
    branches/gcc-9-branch/gcc/config/i386/darwin.h
    branches/gcc-9-branch/gcc/config/rs6000/darwin.h

Reply via email to