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

--- Comment #65 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain D Sandoe
<ia...@gcc.gnu.org>:

https://gcc.gnu.org/g:94c9c6acdc14de186abe4ea59c54920fbfb60beb

commit r11-9878-g94c9c6acdc14de186abe4ea59c54920fbfb60beb
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Sat Sep 18 23:38:53 2021 +0100

    Darwin: Rework handling for unwinder code in libgcc_s and specs [PR80556].

    This addresses a long-standing problem where a work-around for an unwinder
    issue (also a regression) regresses other functionality.  The patch
replaces
    several work-arounds with a fix for PR80556 and a work-around for PR88590.

    * The fix for PR80556 requires a bump to the SO name for libgcc_s, since we
    need to remove the unwinder symbols from it.  This would trigger PR88590
    hence the work-around for that.

    * We weaken the symbols for emulated TLS support so that it is possible
    for a DSO linked with static-libgcc to interoperate with a DSO linked with
    libgcc_s.  Likewise main exes.

    * We remove all the gcc-4.2.1 era stubs machinery and workarounds.

    * libgcc is always now linked ahead of libc, which avoids fails where the
    libc (libSystem) builtins implementations are not up to date.

    * The unwinder now always comes from the system
     - for Darwin9 from /usr/lib/libgcc_s.1.dylib
     - for Darwin10 from /usr/lib/libSystem.dylib
     - for Darwin11+ from /usr/lib/system/libunwind.dylib.

     We still insert a shim on Darwin10 to fix an omitted unwind function, but
     the underlying unwinder remains the system one.

    * The work-around for PR88590 has two parts (1) we always link libgcc from
    its convenience lib on affected system versions (avoiding the need to find
    the DSO path); (2) we add and export the emutls functions from DSOs - this
    makes a relatively small (20k) addition to a DSO.  These can be backed out
    when a proper fix for PR88590 is committed.

    For distributions that wish to install a libgcc_s.1.dylib to satisfy
linkage
    from exes that linked against the stubs can use a reexported libgcc_s.1.1
    (since that contains all the symbols that were previously exported via the
     stubs).

    The replacement libgcc_s.1 forwards the symbols from the new SO.
    In order to support DYLD_LIBRARY_PATH on systems (where it works)
    we forward the libSystem unwinder symbols from 10.7+ and a
    compiler-local version of the libgcc unwinder on earlier.

    For macOS 10.4 to 10.6 this is 'bug-compatible' with existing uses.
    For 10.7+ the behaviour will now actually be correct.

    Backported from commits d4943ce939d9654932624b9ece24c3a474ae4157,
    7add7f7bb3d35726a0c45322ffdbbab2bbf6a348,
    b504917e43b9a559c9ac779e08784ad412125f2e,
    32731fa5b0abf092029b8e2be64319b978bda514,
    574c09da48a5a0ff4c32dd4577eaf65bac8c94a0 and
    c18ddb05b0391a397f8882fc6a12a1bab7e0df52

    Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

    gcc/ChangeLog:

            PR target/80556
            * config/darwin-driver.c (darwin_driver_init): Handle exported
            symbols and symbol lists (suppress automatic export of the TLS
            symbols).
            * config/darwin.c (darwin_rename_builtins): Remove workaround.
            * config/darwin.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
            (REAL_LIBGCC_SPEC): Handle revised library uses.
            * config/darwin.opt (nodefaultexport): New.
            * config/i386/darwin.h (PR80556_WORKAROUND): Remove.
            * config/i386/darwin32-biarch.h (PR80556_WORKAROUND): Likewise.
            * config/i386/darwin64-biarch.h (PR80556_WORKAROUND): Likewise.

    libgcc/ChangeLog:

            * config.host: Add weak emutls crt to the extra_parts.
            (*-*-darwin*): Add logic to build a shared unwinder library for
            Darwin8-10.  Add shim declaration header to powerpc*-darwin builds.
            * config/i386/darwin-lib.h (DECLARE_LIBRARY_RENAMES): Remove
            workaround.
            * config/libgcc-libsystem.ver: Add exclude list for the system-
            provided unwinder.
            * config/t-slibgcc-darwin: Bump SO version, remove stubs code.
            Build a legacy libgcc_s.1 and the supporting pieces (all FAT libs).
            * config/t-darwin-ehs: Add dependencies to the shared unwinder
            objects.  Add dependency on unwind.h.
            * config/t-darwin: Reorganise the EH fragments to place them for
            inclusion in a shared EH lib.  Add libgcc_tm.h to the dependencies
            for darwin10-unwind-find-enc-func.
            * config/i386/libgcc-darwin.10.4.ver: Removed.
            * config/i386/libgcc-darwin.10.5.ver: Removed.
            * config/rs6000/libgcc-darwin.10.4.ver: Removed.
            * config/rs6000/libgcc-darwin.10.5.ver: Removed.
            * config/i386/t-darwin: Build legacy libgcc_s.1.
            * config/rs6000/t-darwin: Likewise.
            * config/rs6000/t-darwin-ehs: Remove dependency on the powerpc end
            file.  Add darwin-fallback.o.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/fp-int-convert-timode-3.c: Remove XFAIL.
            * gcc.dg/torture/fp-int-convert-timode-4.c: Likewise.

Reply via email to