1# Build a shared libgcc library for ELF with symbol versioning
2# with the Solaris linker.
3
4SHLIB_LDFLAGS = -Wl,-h,$(SHLIB_SONAME) -Wl,-z,text -Wl,-z,defs \
5	-Wl,-M,$(SHLIB_MAP)
6
7ifeq ($(enable_shared),yes)
8
9# Linker mapfile to enforce direct binding to libgcc_s unwinder
10# (PR target/59788).
11# Emit v2 mapfile syntax if possible, otherwise ld -z guidance complains
12# every time the mapfile is used.
13libgcc-unwind.map: libgcc-std.ver
14ifeq ($(solaris_ld_v2_maps),yes)
15	@(echo '$$mapfile_version 2';		\
16	echo "SYMBOL_SCOPE {";			\
17	for f in `grep _Unwind_ $< | sort`; do	\
18	  echo "	$$f { FLAGS = EXTERN DIRECT };"; \
19	done;					\
20	echo "};" ) > $@
21else
22	@(echo "{";				\
23	for f in `grep _Unwind_ $< | sort`; do	\
24	  echo "	$$f = EXTERN DIRECT;";	\
25	done;					\
26	echo "};" ) > $@
27endif
28
29# Copy libgcc-unwind.map to the place where gcc will look for it at build-time.
30install-libgcc-unwind-map-forbuild: libgcc-unwind.map
31	dest=$(gcc_objdir)/tmp$$$$-$<; \
32	cp $< $$dest; \
33	chmod a+r $$dest; \
34	sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/$<
35
36all: install-libgcc-unwind-map-forbuild
37
38install-libgcc-unwind-map: libgcc-unwind.map
39	$(INSTALL_DATA) $< $(DESTDIR)$(slibdir)
40
41install: install-libgcc-unwind-map
42
43endif
44