d4943ce939
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 <iain@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. * 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.
82 lines
2.6 KiB
Plaintext
82 lines
2.6 KiB
Plaintext
# Build a shared libgcc library with the darwin linker.
|
|
|
|
SHLIB_SOVERSION = 1.1
|
|
SHLIB_SO_MINVERSION = 1
|
|
SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) -current_version $(SHLIB_SOVERSION)
|
|
SHLIB_EXT = .dylib
|
|
SHLIB_LC = -lSystem
|
|
|
|
# Shorthand expressions for the LINK below.
|
|
SHLIB_INSTALL_NAME = @shlib_base_name@.$(SHLIB_SOVERSION)$(SHLIB_EXT)
|
|
SHLIB_MAP = @shlib_map_file@
|
|
SHLIB_DIR = @multilib_dir@
|
|
SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT)
|
|
|
|
# Darwin only searches in shlib_slibdir for shared libraries, not in
|
|
# subdirectories. The link builds one architecture slice in its designated
|
|
# subdir. The code under MULTIBUILDTOP combines these into a single FAT
|
|
# library, that is what we eventually install.
|
|
|
|
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \
|
|
-install_name @shlib_slibdir@/$(SHLIB_INSTALL_NAME) \
|
|
-single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \
|
|
-Wl,-exported_symbols_list,$(SHLIB_MAP) \
|
|
$(SHLIB_VERSTRING) \
|
|
@multilib_flags@ @shlib_objs@ $(SHLIB_LC)
|
|
|
|
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
|
|
SHLIB_MKMAP_OPTS = -v leading_underscore=1
|
|
|
|
LGCC_FILES = libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)
|
|
|
|
INSTALL_FILES=$(LGCC_FILES)
|
|
|
|
# we do our own thing
|
|
SHLIB_INSTALL =
|
|
|
|
# For the toplevel multilib, build a fat archive including all the multilibs.
|
|
ifeq ($(MULTIBUILDTOP),)
|
|
|
|
ifeq ($(enable_shared),yes)
|
|
all: $(INSTALL_FILES)
|
|
install-leaf: install-darwin-libgcc-stubs
|
|
endif
|
|
|
|
libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT): all-multi libgcc_s$(SHLIB_EXT)
|
|
MLIBS=`$(CC) --print-multi-lib | sed -e 's/;.*$$//'` ; \
|
|
for mlib in $$MLIBS ; do \
|
|
cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \
|
|
./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
|
|
done
|
|
$(LIPO) -output libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
|
|
-create libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
|
|
rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
|
|
|
|
# Install the shared library.
|
|
|
|
install-darwin-libgcc-stubs :
|
|
$(mkinstalldirs) $(DESTDIR)$(slibdir)
|
|
for d in $(INSTALL_FILES) ; do \
|
|
$(INSTALL_DATA) $$d $(DESTDIR)$(slibdir)/$$d || exit 1 ; \
|
|
done
|
|
|
|
else
|
|
|
|
# Do not install shared libraries for any other multilibs. Unless we are
|
|
# putting them in the gcc directory during a build, for compatibility with
|
|
# the pre-top-level layout. In that case we provide symlinks to the FAT lib
|
|
# from the sub-directories.
|
|
|
|
ifeq ($(enable_shared),yes)
|
|
all: install-darwin-libgcc-links
|
|
endif
|
|
|
|
install-darwin-libgcc-links:
|
|
$(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
|
|
for file in $(INSTALL_FILES); do \
|
|
rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
|
|
$(LN_S) ../$$file $(gcc_objdir)$(MULTISUBDIR)/; \
|
|
done
|
|
|
|
endif
|