1 # Copyright (C) 2002-2024 Free Software Foundation, Inc.
3 # This file is part of GCC.
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)
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.
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/>.
19 # Build a shared libgcc library according to --with-aix-soname selection:
21 # libgcc_s.a(shr.o) # traditional (-bnortl)
24 # libgcc_s.a(shr.o) # traditional (-bnortl)
25 # libgcc_s.so.1(shrXX.o,shrXX.imp) # the SONAME (-G)
26 # libgcc_s.so -> libgcc_s.so.1 # the symlink
29 # libgcc_s.so.1(shrXX.o,shrXX.imp) # the SONAME (-G)
30 # libgcc_s.so -> libgcc_s.so.1 # the symlink
34 SHLIB_EXT = $(SHLIB_EXT_$(with_aix_soname))
36 SHLIB_SONAME = @shlib_base_name@.so.$(SHLIB_SOVERSION)
38 if test svr4 != $(with_aix_soname) ; then \
39 $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-bnortl -nodefaultlibs \
40 -Wl,-bE:@shlib_map_file@ -o shr.o \
41 @multilib_flags@ @shlib_objs@ -lc \
42 `case @multilib_dir@ in \
43 *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
44 *) echo -lc ;; esac` ; \
45 rm -f tmp-@shlib_base_name@.a ; \
46 $(AR_CREATE_FOR_TARGET) tmp-@shlib_base_name@.a shr.o ; \
47 mv tmp-@shlib_base_name@.a @shlib_base_name@.a ; \
50 if test aix != $(with_aix_soname) ; then \
51 case @multilib_dir@ in *64*) shr='shr_64' ;; *) shr='shr' ;; esac ; \
52 $(CC) $(LIBGCC2_CFLAGS) -shared -Wl,-G -nodefaultlibs \
53 -Wl,-bE:@shlib_map_file@ -o $$shr.o \
54 @multilib_flags@ @shlib_objs@ -lc \
55 `case @multilib_dir@ in \
56 *pthread*) echo -L$(TARGET_SYSTEM_ROOT)/usr/lib/threads -lpthreads -lc_r $(TARGET_SYSTEM_ROOT)/usr/lib/libc.a ;; \
57 *) echo -lc ;; esac` ; \
58 $(STRIP_FOR_TARGET) -X32_64 -e $$shr.o ; \
59 { echo "\#! $(SHLIB_SONAME)($$shr.o)" ; \
60 case @multilib_dir@ in *64*) echo '\# 64' ;; *) echo '\# 32' ;; esac ; \
61 cat @shlib_map_file@ ; \
63 rm -f tmp-$(SHLIB_SONAME) ; \
64 $(AR_CREATE_FOR_TARGET) tmp-$(SHLIB_SONAME) $$shr.imp $$shr.o ; \
65 mv tmp-$(SHLIB_SONAME) $(SHLIB_SONAME) ; \
66 rm -f @shlib_base_name@.so ; \
67 $(LN_S) $(SHLIB_SONAME) @shlib_base_name@.so ; \
68 rm -f $$shr.imp $$shr.o ; \
71 $(mkinstalldirs) $(DESTDIR)$(slibdir)@shlib_slibdir_qual@; \
72 if test svr4 != $(with_aix_soname) ; then \
73 $(INSTALL_DATA) @shlib_base_name@.a \
74 $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/ ; \
76 if test aix != $(with_aix_soname) ; then \
77 $(INSTALL_DATA) $(SHLIB_SONAME) \
78 $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/ ; \
79 rm -f $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so ; \
80 $(LN_S) $(SHLIB_SONAME) \
81 $(DESTDIR)$(slibdir)@shlib_slibdir_qual@/@shlib_base_name@.so ; \
83 SHLIB_LIBS = -lc `case @multilib_dir@ in *pthread*) echo -lpthread ;; esac`
84 SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk
85 SHLIB_MAPFILES = libgcc-std.ver
86 SHLIB_NM_FLAGS = -Bpg -X32_64
88 # Either 32-bit and 64-bit objects in archives.
89 AR_FLAGS_FOR_TARGET = -X32_64
91 # Build and install AIX-style FAT libraries
92 ifeq ($(MULTIBUILDTOP),)
93 BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
94 echo '64'; else echo '32'; fi)
95 ARX=$(shell echo $(AR) | sed -e 's/-X[^ ]*//g')
97 ifeq ($(enable_shared),yes)
98 $(ARX) -X$(BITS) x ../ppc$(BITS)/libgcc/libgcc_s.a shr.o
99 $(ARX) -X$(BITS) rc ./libgcc_s.a shr.o
101 $(ARX) -X$(BITS) x ../pthread/ppc$(BITS)/libgcc/libgcc_s.a shr.o
102 $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc_s.a shr.o
105 $(ARX) -X$(BITS) rc libgcc.a \
106 $(addprefix ../ppc$(BITS)/libgcc/,$(libgcc-objects))
107 $(ARX) -X$(BITS) rc libgcc_eh.a \
108 $(addprefix ../ppc$(BITS)/libgcc/,$(libgcc-eh-objects))
109 $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc.a \
110 $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcc-objects))
111 $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc_eh.a \
112 $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcc-eh-objects))
113 ifeq ($(enable_gcov),yes)
114 $(ARX) -X$(BITS) rc libgcov.a \
115 $(addprefix ../ppc$(BITS)/libgcc/,$(libgcov-objects))
116 $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcov.a \
117 $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcov-objects))
119 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
120 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
121 cp ../pthread/libgcc/libgcc_s.a ../../gcc/pthread/
122 cp ../pthread/libgcc/libgcc_eh.a ../../gcc/pthread/