1 # Copyright (C) 2004-2022 Free Software Foundation, Inc. 2 # 3 # This file is part of GCC. 4 # 5 # GCC is free software; you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation; either version 3, or (at your option) 8 # any later version. 9 # 10 # GCC is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with GCC; see the file COPYING3. If not see 17 # <http://www.gnu.org/licenses/>. 18 19 # Build libunwind for ELF with the GNU linker. 20 21 SHLIB_SOLINK = @shlib_base_name@.so 22 SHLIB_OBJS = @shlib_objs@ 23 SHLIB_DIR = @multilib_dir@ 24 SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ 25 26 # Use unwind-dw2-fde-dip 27 LIBUNWIND = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-dip.c 28 29 SHLIBUNWIND_SOVERSION = 7 30 SHLIBUNWIND_SONAME = @shlib_base_name@.so.$(SHLIBUNWIND_SOVERSION) 31 32 SHLIBUNWIND_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared \ 33 -nodefaultlibs -Wl,-h,$(SHLIBUNWIND_SONAME) \ 34 -Wl,-z,text -Wl,-z,defs -o $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).tmp \ 35 @multilib_flags@ $(SHLIB_OBJS) -lc && \ 36 rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \ 37 if [ -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) ]; then \ 38 mv -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) \ 39 $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).backup; \ 40 else true; fi && \ 41 mv $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).tmp \ 42 $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) && \ 43 $(LN_S) $(SHLIBUNWIND_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK) 44 45 SHLIBUNWIND_INSTALL = \ 46 $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ 47 $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) \ 48 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIBUNWIND_SONAME); \ 49 rm -f $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \ 50 $(LN_S) $(SHLIBUNWIND_SONAME) \ 51 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) 52