From d4943ce939d9654932624b9ece24c3a474ae4157 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Mon, 20 Sep 2021 18:41:56 +0100 Subject: 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). Signed-off-by: Iain Sandoe 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. * 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. * 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/t-darwin-noeh: New file. gcc/testsuite/ChangeLog: * gcc.dg/torture/fp-int-convert-timode-3.c: Remove XFAIL. * gcc.dg/torture/fp-int-convert-timode-4.c: Likewise. --- gcc/config/darwin.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'gcc/config/darwin.c') diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 204114c..c5ba792 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -3637,30 +3637,6 @@ darwin_fold_builtin (tree fndecl, int n_args, tree *argp, void darwin_rename_builtins (void) { - /* The system ___divdc3 routine in libSystem on darwin10 is not - accurate to 1ulp, ours is, so we avoid ever using the system name - for this routine and instead install a non-conflicting name that - is accurate. - - When -ffast-math or -funsafe-math-optimizations is given, we can - use the faster version. */ - if (!flag_unsafe_math_optimizations) - { - enum built_in_function dcode - = (enum built_in_function)(BUILT_IN_COMPLEX_DIV_MIN - + DCmode - MIN_MODE_COMPLEX_FLOAT); - tree fn = builtin_decl_explicit (dcode); - /* Fortran and c call TARGET_INIT_BUILTINS and - TARGET_INIT_LIBFUNCS at different times, so we have to put a - call into each to ensure that at least one of them is called - after build_common_builtin_nodes. A better fix is to add a - new hook to run after build_common_builtin_nodes runs. */ - if (fn) - set_user_assembler_name (fn, "___ieee_divdc3"); - fn = builtin_decl_implicit (dcode); - if (fn) - set_user_assembler_name (fn, "___ieee_divdc3"); - } } /* Implementation for the TARGET_LIBC_HAS_FUNCTION hook. */ -- cgit v1.1