1 |
38 |
julius |
# Build a shared libgcc library with the darwin linker.
|
2 |
|
|
SHLIB_SOVERSION = 1
|
3 |
|
|
SHLIB_VERSTRING = -compatibility_version $(SHLIB_SOVERSION) -current_version $(SHLIB_SOVERSION).0
|
4 |
|
|
SHLIB_EXT = .dylib
|
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@
|
12 |
|
|
SHLIB_LC = -lc
|
13 |
|
|
|
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) \
|
22 |
|
|
$(SHLIB_VERSTRING) \
|
23 |
|
|
@multilib_flags@ $(SHLIB_OBJS) $(SHLIB_LC)
|
24 |
|
|
|
25 |
|
|
# $(slibdir) double quoted to protect it from expansion while building
|
26 |
|
|
# libgcc.mk. We want this delayed until actual install time.
|
27 |
|
|
SHLIB_INSTALL = \
|
28 |
|
|
$$(mkinstalldirs) $$(DESTDIR)$$(slibdir); \
|
29 |
|
|
$(INSTALL_DATA) $(SHLIB_SONAME) \
|
30 |
|
|
$$(DESTDIR)$$(slibdir)/$(SHLIB_SONAME)
|
31 |
|
|
|
32 |
|
|
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
|
33 |
|
|
SHLIB_MKMAP_OPTS = -v leading_underscore=1
|
34 |
|
|
SHLIB_MAPFILES += $(srcdir)/libgcc-std.ver
|
35 |
|
|
|
36 |
|
|
# Must use a different directive for hidden visibility in assembly sources.
|
37 |
|
|
ASM_HIDDEN_OP = .private_extern
|
38 |
|
|
|
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.
|
44 |
|
|
#
|
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 ; \
|
54 |
|
|
done
|
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 ; \
|
61 |
|
|
done
|
62 |
|
|
$(LIPO_FOR_TARGET) -output $@ -create $(@)_T*
|
63 |
|
|
rm $(@)_T*
|
64 |
|
|
|
65 |
|
|
libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT): stmp-multilib libgcc_s.10.4.dylib \
|
66 |
|
|
libgcc_s.10.5.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 ; \
|
74 |
|
|
done
|
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*
|
78 |
|
|
|
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
|
83 |
|
|
|
84 |
|
|
INSTALL_FILES=libgcc_s.10.4.dylib libgcc_s.10.5.dylib libgcc_s.1.dylib
|
85 |
|
|
|
86 |
|
|
install-darwin-libgcc-stubs : $(INSTALL_FILES) installdirs
|
87 |
|
|
for d in $(INSTALL_FILES) ; do \
|
88 |
|
|
$(INSTALL_DATA) $$d $(DESTDIR)$(slibdir)/$$d || exit 1 ; \
|
89 |
|
|
done
|
90 |
|
|
if [ -f $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib ]; then \
|
91 |
|
|
rm -f $(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib; \
|
92 |
|
|
else true; fi
|
93 |
|
|
$(LN_S) libgcc_s.1.dylib \
|
94 |
|
|
$(DESTDIR)$(slibdir)/libgcc_s_ppc64.1.dylib
|
95 |
|
|
if [ -f $(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib ]; then \
|
96 |
|
|
rm -f $(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib; \
|
97 |
|
|
else true; fi
|
98 |
|
|
$(LN_S) libgcc_s.1.dylib \
|
99 |
|
|
$(DESTDIR)$(slibdir)/libgcc_s_x86_64.1.dylib
|
100 |
|
|
|
101 |
|
|
INSTALL_LIBGCC = install-darwin-libgcc-stubs install-multilib
|