1 # Build a shared libgcc library with the darwin linker.
3 SHLIB_VERSTRING = -compatibility_version $(SHLIB_SOVERSION) -current_version $(SHLIB_SOVERSION).0
5 SHLIB_SUFFIX = `if test @multilib_dir@ = ppc64 ; then echo _@multilib_dir@ ; fi`
6 SHLIB_INSTALL_NAME = @shlib_base_name@$(SHLIB_SUFFIX).$(SHLIB_SOVERSION)$(SHLIB_EXT)
7 SHLIB_SONAME = @shlib_base_name@.$(SHLIB_SOVERSION)$(SHLIB_EXT)
8 SHLIB_SOLINK = @shlib_base_name@.so
9 SHLIB_MAP = @shlib_map_file@
10 SHLIB_OBJS = @shlib_objs@
11 SHLIB_DIR = @multilib_dir@
14 # Darwin only searches in /usr/lib for shared libraries, not in subdirectories,
15 # so the libgcc variants have different names not different locations.
16 # Note that this version is used for the loader, not the linker; the linker
17 # uses the stub versions named by $(LIBGCC).
18 SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -dynamiclib -nodefaultlibs \
19 -Wl,-install_name,$(slibdir)/$(SHLIB_INSTALL_NAME) \
20 -single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \
21 -Wl,-exported_symbols_list,$(SHLIB_MAP) \
23 @multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC)
25 # $(slibdir) double quoted to protect it from expansion while building
26 # libgcc.mk. We want this delayed until actual install time.
28 $$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
29 $(INSTALL_DATA) $(SHLIB_SONAME) \
30 $$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME)
32 SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
33 SHLIB_MKMAP_OPTS = -v leading_underscore=1
34 SHLIB_MAPFILES += $(srcdir)/libgcc-std.ver
36 # Must use a different directive for hidden visibility in assembly sources.
37 ASM_HIDDEN_OP = .private_extern
39 # In order to support -mmacosx-version-min, you need to have multiple
40 # different libgcc_s libraries that actually get linked against, one for
41 # each system version supported. They are 'stub' libraries that
42 # contain no code, just a list of exported symbols.
43 # The actual use of the libraries is controlled by REAL_LIBGCC_SPEC.
45 # This assumes each multilib corresponds to a different architecture.
46 libgcc_s.%.dylib : $(SHLIB_VERPFX).%.ver stmp-multilib
47 # When building multilibbed target libraries, all the required
48 # libraries are expected to exist in the multilib directory.
49 MLIBS=`$(GCC_FOR_TARGET) --print-multi-lib \
50 | sed -e 's/;.*$$//' -e '/^\.$$/d'` ; \
51 for mlib in $$MLIBS ; do \
52 rm -f $${mlib}/$@ || exit 1 ; \
53 $(LN_S) ../$@ $${mlib}/$@ || exit 1 ; \
55 MLIBS=`$(GCC_FOR_TARGET) --print-multi-lib \
56 | sed -e 's/;.*$$//' -e '/^\.$$/d'` ; \
57 for mlib in '' $$MLIBS ; do \
58 $(STRIP_FOR_TARGET) -o $(@)_T$${mlib} \
59 -s $(SHLIB_VERPFX).$(*).ver -c -u \
60 ./$${mlib}/libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT).tmp || exit 1 ; \
62 $(LIPO_FOR_TARGET) -output $@ -create $(@)_T*
65 libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT): stmp-multilib libgcc_s.10.4.dylib \
67 # When building multilibbed target libraries, all the required
68 # libraries are expected to exist in the multilib directory.
69 MLIBS=`$(GCC_FOR_TARGET) --print-multi-lib \
70 | sed -e 's/;.*$$//' -e '/^\.$$/d'` ; \
71 for mlib in '' $$MLIBS ; do \
72 cp ./$${mlib}/libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT).tmp \
73 ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \
75 $(LIPO_FOR_TARGET) -output libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \
76 -create libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
77 rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T*
79 # From the point-of-view of the Makefiles, libgcc is built by the 'strip'
80 # and 'lipo' commands above.
81 LIBGCC=libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) libgcc_s.10.4.dylib \
82 libgcc_s.10.5.dylib stmp-multilib
84 INSTALL_FILES=libgcc_s.10.4.dylib libgcc_s.10.5.dylib libgcc_s.1.dylib
86 install-darwin-libgcc-stubs : $(INSTALL_FILES) installdirs
87 for d in $(INSTALL_FILES) ; do \
88 $(INSTALL_DATA) $$d $(DESTDIR)$(slibdir)/$$d || exit 1 ; \
90 if [ -f $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib ]; then \
91 rm -f $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib; \
93 $(LN_S) libgcc_s.1.dylib \
94 $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib
96 INSTALL_LIBGCC = install-darwin-libgcc-stubs install-multilib