Debian Codegraph @

libgcc/Makefile.in

raw
1 # Makefile.in
2
3 # Copyright (C) 2005-2025 Free Software Foundation, Inc.
4 #
5 # This file is part of GCC.
6 #
7 # GCC is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU Library General Public License as published by the Free
9 # Software Foundation; either version 3 of the License, or (at your option)
10 # any later version.
11 #
12 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with GCC; see the file COPYING3. If not see
19 # <http://www.gnu.org/licenses/>.
20 #
21
22 libgcc_topdir = @libgcc_topdir@
23 host_subdir = @host_subdir@
24
25 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
26
27 srcdir = @srcdir@
28
29 prefix = @prefix@
30
31 exec_prefix = @exec_prefix@
32 libdir = @libdir@
33 shlib_slibdir = @slibdir@
34
35 SHELL = @SHELL@
36
37 cpu_type = @cpu_type@
38 enable_shared = @enable_shared@
39 enable_gcov = @enable_gcov@
40 double_type_size = @double_type_size@
41 long_double_type_size = @long_double_type_size@
42 decimal_float = @decimal_float@
43 enable_vtable_verify = @enable_vtable_verify@
44 enable_decimal_float = @enable_decimal_float@
45 fixed_point = @fixed_point@
46 with_aix_soname = @with_aix_soname@
47 solaris_ld_v2_maps = @solaris_ld_v2_maps@
48 enable_execute_stack = @enable_execute_stack@
49 unwind_header = @unwind_header@
50 md_unwind_def_header = @md_unwind_def_header@
51 md_unwind_header = @md_unwind_header@
52 sfp_machine_header = @sfp_machine_header@
53 thread_header = @thread_header@
54
55 host_noncanonical = @host_noncanonical@
56 real_host_noncanonical = @real_host_noncanonical@
57 target_noncanonical = @target_noncanonical@
58
59 # List of extra object files that should be compiled for this target machine.
60 # The rules for compiling them should be in the t-* file for the machine.
61 EXTRA_PARTS = @extra_parts@
62
63 FORCE_EXPLICIT_EH_REGISTRY = @force_explicit_eh_registry@
64
65 extra-parts = libgcc-extra-parts
66
67 # Multilib support variables.
68 MULTISRCTOP =
69 MULTIBUILDTOP =
70 MULTIDIRS =
71 MULTISUBDIR =
72 MULTIDO = true
73 MULTICLEAN = true
74
75 INSTALL = @INSTALL@
76 INSTALL_PROGRAM = @INSTALL_PROGRAM@
77 INSTALL_DATA = @INSTALL_DATA@
78 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
79 INSTALL_PARTS = $(EXTRA_PARTS)
80
81 objext = .o
82
83 AR = @AR@
84 AR_FLAGS = rc
85
86 CC = @CC@
87 CFLAGS = @CFLAGS@
88 RANLIB = @RANLIB@
89 LN_S = @LN_S@
90 WERROR = @WERROR@
91
92 PWD_COMMAND = $${PWDCMD-pwd}
93
94 # Flags to pass to a recursive make.
95 FLAGS_TO_PASS = \
96 "AR=$(AR)" \
97 "AR_FLAGS=$(AR_FLAGS)" \
98 "CC=$(CC)" \
99 "CFLAGS=$(CFLAGS)" \
100 "DESTDIR=$(DESTDIR)" \
101 "EXTRA_OFILES=$(EXTRA_OFILES)" \
102 "HDEFINES=$(HDEFINES)" \
103 "INSTALL=$(INSTALL)" \
104 "INSTALL_DATA=$(INSTALL_DATA)" \
105 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
106 "LDFLAGS=$(LDFLAGS)" \
107 "LOADLIBES=$(LOADLIBES)" \
108 "RANLIB=$(RANLIB)" \
109 "SHELL=$(SHELL)" \
110 "prefix=$(prefix)" \
111 "exec_prefix=$(exec_prefix)" \
112 "libdir=$(libdir)" \
113 "libsubdir=$(libsubdir)" \
114 "tooldir=$(tooldir)"
115
116 # Dependencies for "all" are set later in the file.
117 all: all-multi
118 # Now that we have built all the objects, we need to copy
119 # them back to the GCC directory. Too many things (other
120 # in-tree libraries, and DejaGNU) know about the layout
121 # of the build tree, for now.
122 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
123 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
124
125 .PHONY: all-multi
126 all-multi:
127 # If this is the top-level multilib, build all the other
128 # multilibs.
129 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
130
131 .PHONY: check installcheck
132 check:
133 installcheck:
134
135 .PHONY: all clean
136
137 clean:
138 -rm -f libgcc_tm.h libgcc.map
139 -rm -f libgcc_tm.stamp stmp-ldirs
140 -rm -f *$(objext)
141 -rm -f *.dep
142 -rm -f *.a
143 -rm -f libunwind$(SHLIB_EXT)
144 -rm -f libgcc_s*
145 @$(MULTICLEAN) multi-clean DO=clean
146 distclean: clean
147 @$(MULTICLEAN) multi-clean DO=distclean
148 -rm -f auto-target.h
149 -rm -f stamp-h
150 -rm -f *~ Makefile config.cache config.status multilib.out
151 -rm -f config.log
152 maintainer-clean realclean: distclean
153
154 Makefile: $(srcdir)/Makefile.in config.status
155 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
156
157 # Depending on Makefile makes sure that config.status has been re-run
158 # if needed. This prevents problems with parallel builds.
159 auto-target.h: stamp-h ; @true
160 stamp-h: $(srcdir)/config.in config.status Makefile
161 CONFIG_FILES= CONFIG_HEADERS=auto-target.h:$(srcdir)/config.in $(SHELL) ./config.status
162
163 config.status: $(srcdir)/configure $(srcdir)/config.host
164 $(SHELL) ./config.status --recheck
165
166 AUTOCONF = autoconf
167 configure_deps = \
168 $(srcdir)/../config/enable.m4 \
169 $(srcdir)/../config/tls.m4 \
170 $(srcdir)/../config/toolexeclibdir.m4 \
171 $(srcdir)/../config/acx.m4 \
172 $(srcdir)/../config/no-executables.m4 \
173 $(srcdir)/../config/lib-ld.m4 \
174 $(srcdir)/../config/override.m4 \
175 $(srcdir)/../config/picflag.m4 \
176 $(srcdir)/../config/dfp.m4 \
177 $(srcdir)/../config/unwind_ipinfo.m4 \
178 $(srcdir)/../config/gthr.m4 \
179 $(srcdir)/../config/sjlj.m4 \
180 $(srcdir)/../config/cet.m4
181
182 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
183 cd $(srcdir) && $(AUTOCONF)
184
185 include $(gcc_objdir)/libgcc.mvars
186
187 # Flags to pass to recursive makes.
188
189 AR_FOR_TARGET = $(AR)
190 AR_FLAGS_FOR_TARGET =
191 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
192 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
193 AWK = @AWK@
194 GCC_FOR_TARGET = $(CC)
195 LIPO = @LIPO@
196 LIPO_FOR_TARGET = $(LIPO)
197 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
198 NM = @NM@
199 NM_FOR_TARGET = $(NM)
200 RANLIB_FOR_TARGET = $(RANLIB)
201 STRIP = @STRIP@
202 STRIP_FOR_TARGET = $(STRIP)
203
204 # Directory in which the compiler finds libraries etc.
205 libsubdir = $(libdir)/gcc/$(real_host_noncanonical)/$(version)@accel_dir_suffix@
206 # Used to install the shared libgcc.
207 slibdir = @slibdir@
208 # Maybe used for DLLs on Windows targets.
209 toolexecdir = @toolexecdir@
210 toolexeclibdir = @toolexeclibdir@
211
212 export AR_FOR_TARGET
213 export AR_CREATE_FOR_TARGET
214 export AR_FLAGS_FOR_TARGET
215 export AR_EXTRACT_FOR_TARGET
216 export AWK
217 export DESTDIR
218 export GCC_FOR_TARGET
219 export INCLUDES
220 export INSTALL_DATA
221 export LIB1ASMSRC
222 export LIBGCC2_CFLAGS
223 export LIPO_FOR_TARGET
224 export MACHMODE_H
225 export NM_FOR_TARGET
226 export STRIP_FOR_TARGET
227 export RANLIB_FOR_TARGET
228 export libsubdir
229 export slibdir
230 export toolexecdir
231 export toolexeclibdir
232
233 version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER)
234
235 ifeq ($(decimal_float),yes)
236 ifeq ($(enable_decimal_float),bid)
237 DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
238 else
239 DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
240 -I$(srcdir)/../libdecnumber
241 endif
242 else
243 DECNUMINC =
244 endif
245
246 # Options to use when compiling libgcc2.a.
247 #
248 LIBGCC2_DEBUG_CFLAGS = -g
249 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
250 $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
251 -fbuilding-libgcc -fno-stack-protector \
252 $(INHIBIT_LIBC_CFLAGS)
253
254 # Additional options to use when compiling libgcc2.a.
255 # Some targets override this to -isystem include
256 LIBGCC2_INCLUDES =
257
258 # Additional target-dependent options for compiling libgcc2.a.
259 HOST_LIBGCC2_CFLAGS =
260
261 PICFLAG = @PICFLAG@
262
263 CET_FLAGS = @CET_FLAGS@
264
265 USE_TM_CLONE_REGISTRY = @use_tm_clone_registry@
266
267 # Defined in libgcc2.c, included only in the static library.
268 LIB2FUNCS_ST = _eprintf __gcc_bcmp
269
270 # List of functions not to build from libgcc2.c.
271 LIB2FUNCS_EXCLUDE =
272
273 # List of extra C and assembler files to add to static and shared libgcc2.
274 # Assembler files should have names ending in `.S'.
275 LIB2ADD =
276
277 # List of extra C and assembler files to add to static libgcc2.
278 # Assembler files should have names ending in `.S'.
279 LIB2ADD_ST =
280
281 # Specify the directories to be searched for header files.
282 # Both . and srcdir are used, in that order,
283 # so that *config.h will be found in the compilation
284 # subdirectory rather than in the source directory.
285 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
286 # currently being compiled, in both source trees, to be examined as well.
287 INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
288 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
289 -I$(srcdir)/../include $(DECNUMINC)
290
291 # Forcibly remove any profiling-related flags. There is no point
292 # in supporting profiled bootstrap in this library.
293 override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
294
295 # CFLAGS first is not perfect; normally setting CFLAGS should override any
296 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
297 # will usually contain -g, so for the moment CFLAGS goes first. We must
298 # include CFLAGS - that's where multilib options live. If CC or CFLAGS
299 # specify -Os or -Oz, we want that to override our local options as that
300 # could be a multilib flag.
301 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
302 $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ \
303 $(filter -Os -Oz,$(CC) $(CFLAGS))
304
305 # Options to use when compiling crtbegin/end.
306 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
307 $(NO_PIE_CFLAGS) -finhibit-size-directive -fno-inline -fno-exceptions \
308 -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
309 -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
310 $(INHIBIT_LIBC_CFLAGS) $(USE_TM_CLONE_REGISTRY) \
311 $(filter -Os -Oz,$(CC) $(CFLAGS))
312
313 # Extra flags to use when compiling crt{begin,end}.o.
314 CRTSTUFF_T_CFLAGS =
315
316 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
317 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
318
319 MULTIOSSUBDIR := $(shell if test "$(MULTIOSDIR)" != .; then echo /$(MULTIOSDIR); fi)
320 inst_libdir = $(libsubdir)$(MULTISUBDIR)
321 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
322
323 gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) $(CFLAGS-$(<F))
324 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
325 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
326 gcc_s_compile = $(gcc_compile) -DSHARED
327
328 objects = $(filter %$(objext),$^)
329
330 # Collect any host-specific information from Makefile fragments.
331
332 LIBGCC_VER_GNU_PREFIX = __
333 LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
334 LIBGCC_VER_SYMBOLS_PREFIX =
335
336 FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
337 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
338 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
339 _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf
340
341 DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
342 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
343 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
344 _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
345
346 TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
347 _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
348 _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
349 _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
350
351 # Additional sources to handle exceptions; overridden by targets as needed.
352 LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
353 $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
354 LIB2ADDEHSTATIC = $(LIB2ADDEH)
355 LIB2ADDEHSHARED = $(LIB2ADDEH)
356
357 # nm flags to list global symbols in libgcc object files.
358 SHLIB_NM_FLAGS = -pg
359
360 # Don't build libunwind by default.
361 LIBUNWIND =
362 SHLIBUNWIND_LINK =
363 SHLIBUNWIND_INSTALL =
364
365
366 # Create links to files specified in config.host.
367 LIBGCC_LINKS = enable-execute-stack.c \
368 unwind.h md-unwind-def.h md-unwind-support.h \
369 sfp-machine.h gthr-default.h
370
371 enable-execute-stack.c: $(srcdir)/$(enable_execute_stack)
372 -$(LN_S) $< $@
373 unwind.h: $(srcdir)/$(unwind_header)
374 -$(LN_S) $< $@
375 md-unwind-def.h: $(srcdir)/config/$(md_unwind_def_header)
376 -$(LN_S) $< $@
377 md-unwind-support.h: $(srcdir)/config/$(md_unwind_header)
378 -$(LN_S) $< $@
379 sfp-machine.h: $(srcdir)/config/$(sfp_machine_header)
380 -$(LN_S) $< $@
381 gthr-default.h: $(srcdir)/$(thread_header)
382 -$(LN_S) $< $@
383
384 tmake_file = @tmake_file@
385 -include $(tmake_file)
386
387 # Collect target defines and headers from config.host.
388 libgcc_tm_defines = @tm_defines@
389 libgcc_tm_file = @tm_file@
390 libgcc_tm.h: libgcc_tm.stamp; @true
391 libgcc_tm.stamp:
392 DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \
393 $(srcdir)/mkheader.sh > tmp-libgcc_tm.h
394 $(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
395 echo timestamp > $@
396
397 # Only handle shared libraries if both:
398 # - the user requested them
399 # - we know how to build them
400 ifeq ($(SHLIB_LINK),)
401 enable_shared := no
402 endif
403
404 ifeq ($(enable_shared),yes)
405 iterator = $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
406
407 install-shared = install-shared
408
409 ifneq ($(LIBUNWIND),)
410 install-libunwind = install-libunwind
411 endif
412 endif
413
414 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
415 # the command line, and a #define to prevent libgcc2.h etc from
416 # overriding that with #pragmas.
417 vis_hide = @vis_hide@
418
419 ifneq (,$(vis_hide))
420
421 # If we have -fvisibility=hidden, then we need to generate hide
422 # lists for object files implemented in assembly.
423 ASM_HIDDEN_OP = @asm_hidden_op@
424
425 define gen-hide-list
426 $(NM) -pg $< | \
427 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
428 && $$3 !~ /.*@.*/ \
429 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
430 mv -f $@T $@
431 endef
432 else
433 gen-hide-list = echo > $@
434 endif
435
436 ifneq ($(enable_shared),yes)
437 iterator = $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
438 endif
439
440 LIB2ADD += enable-execute-stack.c
441
442 # Control Flow Redundancy hardening out-of-line checker.
443 LIB2ADD += $(srcdir)/hardcfr.c
444
445 # Stack scrubbing infrastructure.
446 @HAVE_STRUB_SUPPORT@LIB2ADD += $(srcdir)/strub.c
447
448 # While emutls.c has nothing to do with EH, it is in LIB2ADDEH*
449 # instead of LIB2ADD because that's the way to be sure on some targets
450 # (e.g. *-*-darwin*) only one copy of it is linked.
451 LIB2ADDEH += $(srcdir)/emutls.c
452 LIB2ADDEHSTATIC += $(srcdir)/emutls.c
453 LIB2ADDEHSHARED += $(srcdir)/emutls.c
454
455 # Library members defined in libgcc2.c.
456 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
457 _clear_cache _trampoline __main _absvsi2 \
458 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
459 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
460 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
461 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
462 _mulhc3 _mulsc3 _muldc3 _mulxc3 _multc3 _divhc3 _divsc3 \
463 _divdc3 _divxc3 _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 \
464 _clrsbdi2 _mulbitint3
465
466 # The floating-point conversion routines that involve a single-word integer.
467 # XX stands for the integer mode.
468 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
469
470 # Likewise double-word routines.
471 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
472 $(patsubst %,_fixuns%XX,sf df xf tf) \
473 $(patsubst %,_floatXX%,sf df xf tf) \
474 $(patsubst %,_floatunXX%,sf df xf tf)
475
476 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
477 lib2funcs += $(subst XX,si,$(swfloatfuncs))
478 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
479 endif
480
481 # These might cause a divide overflow trap and so are compiled with
482 # unwinder info.
483 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _divmoddi4 \
484 _udivdi3 _umoddi3 _udivmoddi4 _udiv_w_sdiv \
485 _divmodbitint4
486
487 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
488 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
489 # in LIB2FUNCS_EXCLUDE.
490 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
491 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
492 $(LIB2_DIVMOD_FUNCS))
493
494 LIB2FUNCS_ST := $(filter-out $(LIB2FUNCS_EXCLUDE),$(LIB2FUNCS_ST))
495
496 # Build "libgcc1" (assembly) components.
497
498 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
499 $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
500 $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
501 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
502 $(gen-hide-list)
503 libgcc-objects += $(lib1asmfuncs-o)
504
505 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
506 $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
507 $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
508 ifeq ($(enable_shared),yes)
509
510 libgcc-s-objects += $(lib1asmfuncs-s-o)
511
512 endif
513
514 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
515 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
516 $(lib2funcs-o): %$(objext): $(srcdir)/libgcc2.c
517 $(gcc_compile) -DL$* -c $< $(vis_hide)
518 libgcc-objects += $(lib2funcs-o)
519
520 ifeq ($(enable_shared),yes)
521 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
522 $(lib2funcs-s-o): %_s$(objext): $(srcdir)/libgcc2.c
523 $(gcc_s_compile) -DL$* -c $<
524 libgcc-s-objects += $(lib2funcs-s-o)
525 endif
526
527 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
528 # Build libgcc2.c for each conversion function, with a specific
529 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
530 # functions are built with a wordsize of 4; the TImode functions are
531 # built with the same labels, but a wordsize of 8.
532
533 sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
534 difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
535 tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))
536
537 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
538 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
539 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
540
541 -include $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
542
543 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
544 ifeq ($(enable_shared),yes)
545 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
546 endif
547 endif
548
549 ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
550 # Provide default flags for compiling divmod functions, if they haven't been
551 # set already by a target-specific Makefile fragment.
552 LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
553 endif
554
555 # Build LIB2_DIVMOD_FUNCS.
556 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
557 $(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
558 $(gcc_compile) -DL$* -c $< \
559 $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
560 libgcc-objects += $(lib2-divmod-o)
561
562 ifeq ($(enable_shared),yes)
563 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
564 $(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
565 $(gcc_s_compile) -DL$* -c $< \
566 $(LIB2_DIVMOD_EXCEPTION_FLAGS)
567 libgcc-s-objects += $(lib2-divmod-s-o)
568 endif
569
570 ifeq ($(TPBIT),)
571 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
572 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
573 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
574 endif
575
576 FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
577 DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
578 TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
579
580 fpbit-src := $(srcdir)/fp-bit.c
581
582 # Build FPBIT.
583 ifneq ($(FPBIT),)
584 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
585 $(fpbit-o): %$(objext): $(fpbit-src)
586 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide)
587 libgcc-objects += $(fpbit-o)
588
589 ifeq ($(enable_shared),yes)
590 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
591 $(fpbit-s-o): %_s$(objext): $(fpbit-src)
592 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $<
593 libgcc-s-objects += $(fpbit-s-o)
594 endif
595 endif
596
597 # Build DPBIT.
598 ifneq ($(DPBIT),)
599 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
600 $(dpbit-o): %$(objext): $(fpbit-src)
601 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide)
602 libgcc-objects += $(dpbit-o)
603
604 ifeq ($(enable_shared),yes)
605 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
606 $(dpbit-s-o): %_s$(objext): $(fpbit-src)
607 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $<
608 libgcc-s-objects += $(dpbit-s-o)
609 endif
610 endif
611
612 # Build TPBIT.
613 ifneq ($(TPBIT),)
614 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
615 $(tpbit-o): %$(objext): $(fpbit-src)
616 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide)
617 libgcc-objects += $(tpbit-o)
618
619 ifeq ($(enable_shared),yes)
620 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
621 $(tpbit-s-o): %_s$(objext): $(fpbit-src)
622 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $<
623 libgcc-s-objects += $(tpbit-s-o)
624 endif
625 endif
626
627 # Build decimal floating point support.
628 ifeq ($(decimal_float),yes)
629
630 # If $DFP_ENABLE is set, then we want all data type sizes.
631 ifneq ($(DFP_ENABLE),)
632 D32PBIT = 1
633 D64PBIT = 1
634 D128PBIT = 1
635 endif
636
637 dfp-filenames =
638 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
639 ifeq ($(enable_decimal_float),bid)
640 dfp-filenames += bid_decimal_globals bid_decimal_data \
641 bid_binarydecimal bid_convert_data \
642 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
643 bid128_noncomp bid128_fma bid_round bid_from_int \
644 bid64_add bid128_add bid64_div bid128_div \
645 bid64_mul bid128_mul bid64_compare bid128_compare \
646 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
647 bid64_to_int32 bid64_to_int64 \
648 bid64_to_uint32 bid64_to_uint64 \
649 bid128_to_int32 bid128_to_int64 \
650 bid128_to_uint32 bid128_to_uint64
651 else
652 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
653 endif
654 endif
655
656 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
657 ifeq ($(enable_decimal_float),bid)
658 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
659 else
660 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
661 endif
662 $(gcc_compile) -c $<
663 libgcc-objects += $(dfp-objects)
664
665 decbits-filenames =
666 ifneq ($(enable_decimal_float),bid)
667 ifneq ($(D32PBIT),)
668 decbits-filenames += decimal32
669 endif
670
671 ifneq ($(D64PBIT),)
672 decbits-filenames += decimal64
673 endif
674
675 ifneq ($(D128PBIT),)
676 decbits-filenames += decimal128
677 endif
678 endif
679
680 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
681 ifeq ($(enable_decimal_float),bid)
682 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
683 else
684 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
685 endif
686 $(gcc_compile) -c $<
687 libgcc-objects += $(decbits-objects)
688
689 # Next build individual support functions.
690 D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
691 _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
692 _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
693 _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
694 _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
695 _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
696 _sd_to_dd _sd_to_td _unord_sd _conv_sd \
697 _hf_to_sd _sd_to_hf
698
699 D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
700 _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
701 _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
702 _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
703 _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
704 _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
705 _dd_to_sd _dd_to_td _unord_dd _conv_dd \
706 _hf_to_dd _dd_to_hf
707
708 D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
709 _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
710 _td_to_si _td_to_di _td_to_usi _td_to_udi \
711 _si_to_td _di_to_td _usi_to_td _udi_to_td \
712 _td_to_sf _td_to_df _td_to_xf _td_to_tf \
713 _sf_to_td _df_to_td _xf_to_td _tf_to_td \
714 _td_to_sd _td_to_dd _unord_td _conv_td \
715 _hf_to_td _td_to_hf
716
717 ifeq ($(enable_decimal_float),bid)
718 ifneq ($(D32PBIT),)
719 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
720 endif
721
722 ifneq ($(D64PBIT),)
723 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
724 endif
725
726 ifneq ($(D128PBIT),)
727 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
728 endif
729 endif
730
731 ifneq ($(D32PBIT),)
732 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
733 ifeq ($(enable_decimal_float),bid)
734 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
735 else
736 $(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
737 endif
738 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
739 libgcc-objects += $(d32pbit-o)
740 endif
741
742 ifneq ($(D64PBIT),)
743 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
744 ifeq ($(enable_decimal_float),bid)
745 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
746 else
747 $(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
748 endif
749 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
750 libgcc-objects += $(d64pbit-o)
751 endif
752
753 ifneq ($(D128PBIT),)
754 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
755 ifeq ($(enable_decimal_float),bid)
756 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
757 else
758 $(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
759 endif
760 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
761 libgcc-objects += $(d128pbit-o)
762 endif
763
764 endif
765
766 ifeq ($(SYNC),yes)
767 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
768 sync_fetch_and_$(op) \
769 sync_$(op)_and_fetch) \
770 sync_bool_compare_and_swap \
771 sync_val_compare_and_swap \
772 sync_lock_test_and_set
773
774 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
775 $(foreach suffix, 1 2 4 8 16, \
776 $(prefix)_$(suffix)))
777
778 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
779 $(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
780 $(gcc_compile) $(SYNC_CFLAGS) \
781 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
782 -DSIZE=`echo "$*" | sed 's/.*_//'` \
783 -c $< $(vis_hide)
784 libgcc-objects += $(libgcc-sync-size-funcs-o)
785
786 libgcc-sync-funcs := sync_synchronize
787
788 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
789 $(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
790 $(gcc_compile) $(SYNC_CFLAGS) \
791 -DL$* \
792 -c $< $(vis_hide)
793 libgcc-objects += $(libgcc-sync-funcs-o)
794
795 ifeq ($(enable_shared),yes)
796 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
797 $(libgcc-sync-size-funcs))
798 $(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
799 $(gcc_s_compile) $(SYNC_CFLAGS) \
800 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
801 -DSIZE=`echo "$*" | sed 's/.*_//'` \
802 -c $<
803 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
804
805 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
806 $(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
807 $(gcc_s_compile) $(SYNC_CFLAGS) \
808 -DL$* \
809 -c $<
810 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
811 endif
812 endif
813
814 # Build fixed-point support.
815 ifeq ($(fixed_point),yes)
816
817 # Generate permutations of function name and mode
818 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
819 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
820 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
821
822 # Generate the rules for each arithmetic function
823 iter-items := $(fixed-funcs)
824 iter-labels := $(fixed-labels)
825 iter-from := $(fixed-modes)
826 iter-to := $(fixed-modes)
827 -include $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
828
829 # Add arithmetic functions to list of objects to be built
830 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
831 ifeq ($(enable_shared),yes)
832 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
833 endif
834
835 # Convert from or to fractional
836 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
837 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
838 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
839 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
840
841 # Generate the make rules for each conversion function
842 iter-items := $(fixed-conv-funcs)
843 iter-labels := $(fixed-conv-labels)
844 iter-from := $(fixed-conv-from)
845 iter-to := $(fixed-conv-to)
846 -include $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
847
848 # Add conversion functions to list of objects to be built
849 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
850 ifeq ($(enable_shared),yes)
851 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
852 endif
853
854 endif
855
856 # Build LIB2ADD and LIB2ADD_ST.
857 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
858 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
859 endif
860
861 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
862 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
863
864 c_flags :=
865 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
866 -include $(iterator)
867
868 ifeq ($(enable_shared),yes)
869 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
870 endif
871
872 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
873 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
874 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
875
876 c_flags := -fexceptions
877
878 ifeq ($(enable_shared),yes)
879
880 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
881 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
882
883 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
884 -include $(iterator)
885
886 else
887 # Not shared. LIB2ADDEH are added to libgcc.a.
888
889 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
890
891 iter-items := $(LIB2ADDEH)
892 -include $(iterator)
893
894 endif
895
896 # Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
897 # not generate calls to __gcc_personality_v0.
898
899 c_flags := -fno-exceptions
900
901 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
902
903 ifeq ($(enable_shared),yes)
904 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
905 endif
906
907 iter-items := $(LIBUNWIND)
908 -include $(iterator)
909
910 # Build libgcov components.
911
912 LIBGCOV_MERGE = _gcov_merge_add _gcov_merge_topn \
913 _gcov_merge_ior _gcov_merge_time_profile
914 LIBGCOV_PROFILER = _gcov_interval_profiler \
915 _gcov_interval_profiler_atomic \
916 _gcov_pow2_profiler \
917 _gcov_pow2_profiler_atomic \
918 _gcov_topn_values_profiler \
919 _gcov_topn_values_profiler_atomic \
920 _gcov_average_profiler \
921 _gcov_average_profiler_atomic \
922 _gcov_ior_profiler \
923 _gcov_ior_profiler_atomic \
924 _gcov_indirect_call_profiler_v4 \
925 _gcov_time_profiler
926 LIBGCOV_INTERFACE = _gcov_dump _gcov_fork \
927 _gcov_execl _gcov_execlp \
928 _gcov_execle _gcov_execv _gcov_execvp _gcov_execve _gcov_reset \
929 _gcov_lock_unlock
930 LIBGCOV_DRIVER = _gcov _gcov_info_to_gcda
931
932 libgcov-merge-objects = $(patsubst %,%$(objext),$(LIBGCOV_MERGE))
933 libgcov-profiler-objects = $(patsubst %,%$(objext),$(LIBGCOV_PROFILER))
934 libgcov-interface-objects = $(patsubst %,%$(objext),$(LIBGCOV_INTERFACE))
935 libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER))
936 libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \
937 $(libgcov-interface-objects) $(libgcov-driver-objects)
938
939 $(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
940 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c
941 $(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
942 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c
943 $(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
944 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c
945 $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \
946 $(srcdir)/libgcov-driver-system.c $(srcdir)/gcov.h $(srcdir)/libgcov.h
947 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c
948
949
950 # Static libraries.
951 libgcc.a: $(libgcc-objects)
952 libgcov.a: $(libgcov-objects)
953 libunwind.a: $(libunwind-objects)
954 libgcc_eh.a: $(libgcc-eh-objects)
955
956 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
957 -rm -f $@
958
959 objects="$(objects)"; \
960 if test -z "$$objects"; then \
961 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
962 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
963 -o eh_dummy$(objext); \
964 objects=eh_dummy$(objext); \
965 fi; \
966 $(AR_CREATE_FOR_TARGET) $@ $$objects
967
968 $(RANLIB) $@
969
970 all: libgcc.a
971 ifeq ($(enable_gcov),yes)
972 all: libgcov.a
973 endif
974
975 ifneq ($(LIBUNWIND),)
976 all: libunwind.a
977 endif
978
979 ifeq ($(enable_shared),yes)
980 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
981 ifneq ($(LIBUNWIND),)
982 all: libunwind$(SHLIB_EXT)
983 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
984 endif
985
986 # Map-file generation.
987 ifneq ($(SHLIB_MKMAP),)
988 libgcc.map.in: $(SHLIB_MAPFILES)
989 { cat $(SHLIB_MAPFILES) \
990 | sed -e '/^[ ]*#/d' \
991 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
992 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
993 } > tmp-$@
994 mv tmp-$@ $@
995 libgcc.map: $(SHLIB_MKMAP) libgcc.map.in $(libgcc-s-objects)
996 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
997 cat libgcc.map.in; \
998 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
999 mv tmp-$@ $@
1000 libgcc_s$(SHLIB_EXT): libgcc.map
1001 mapfile = libgcc.map
1002 endif
1003
1004 libgcc-std.ver: $(srcdir)/libgcc-std.ver.in
1005 sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \
1006 -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@
1007
1008 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts) libgcc.a
1009 # @multilib_flags@ is still needed because this may use
1010 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
1011 # @multilib_dir@ is not really necessary, but sometimes it has
1012 # more uses than just a directory name.
1013 $(mkinstalldirs) $(MULTIDIR)
1014 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
1015 @multilib_dir@,$(MULTIDIR),$(subst \
1016 @shlib_objs@,$(objects) libgcc.a,$(subst \
1017 @shlib_base_name@,libgcc_s,$(subst \
1018 @shlib_map_file@,$(mapfile),$(subst \
1019 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
1020 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
1021
1022 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
1023 # @multilib_flags@ is still needed because this may use
1024 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
1025 # @multilib_dir@ is not really necessary, but sometimes it has
1026 # more uses than just a directory name.
1027 $(mkinstalldirs) $(MULTIDIR)
1028 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
1029 @multilib_dir@,$(MULTIDIR),$(subst \
1030 @shlib_objs@,$(objects),$(subst \
1031 @shlib_base_name@,libunwind,$(subst \
1032 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
1033
1034 endif
1035
1036 # Build the standard GCC startfiles and endfiles.
1037 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
1038 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
1039
1040 ifeq ($(CUSTOM_CRTSTUFF),)
1041 # Compile two additional files that are linked with every program
1042 # linked using GCC on systems using COFF or ELF, for the sake of C++
1043 # constructors.
1044 crtbegin$(objext): $(srcdir)/crtstuff.c
1045 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
1046
1047 crtend$(objext): $(srcdir)/crtstuff.c
1048 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
1049
1050 # These are versions of crtbegin and crtend for shared libraries.
1051 crtbeginS$(objext): $(srcdir)/crtstuff.c
1052 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_BEGIN -DCRTSTUFFS_O
1053
1054 crtendS$(objext): $(srcdir)/crtstuff.c
1055 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O
1056
1057 # This is a version of crtbegin for -static links.
1058 crtbeginT$(objext): $(srcdir)/crtstuff.c
1059 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
1060
1061 # crtoffloadbegin and crtoffloadend contain symbols, that mark the begin and
1062 # the end of tables with addresses, required for offloading. crtoffloadtable
1063 # contains the array with addresses of those symbols.
1064 crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
1065 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
1066
1067 crtoffloadend$(objext): $(srcdir)/offloadstuff.c
1068 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
1069
1070 crtoffloadtable$(objext): $(srcdir)/offloadstuff.c
1071 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_TABLE
1072
1073 crtoffloadtableS$(objext): $(srcdir)/offloadstuff.c
1074 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_TABLE
1075 endif
1076
1077 ifeq ($(enable_vtable_verify),yes)
1078 # These are used in vtable verification; see comments in source files for
1079 # more details.
1080
1081 # Override -finhibit-size-directive to avoid mismatch between libgcc and libvtv
1082 # compilations.
1083 VTV_CFLAGS = $(CRTSTUFF_T_CFLAGS_S) -fno-inhibit-size-directive
1084
1085 vtv_start$(objext): $(srcdir)/vtv_start.c
1086 $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_start.c
1087
1088 vtv_end$(objext): $(srcdir)/vtv_end.c
1089 $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_end.c
1090
1091 vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
1092 $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_start_preinit.c
1093
1094 vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
1095 $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_end_preinit.c
1096 endif
1097
1098 ifeq ($(CUSTOM_CRTIN),)
1099 # -x assembler-with-cpp is only needed on case-insensitive filesystem.
1100 crti$(objext): $(srcdir)/config/$(cpu_type)/crti.S
1101 $(crt_compile) -c -x assembler-with-cpp $<
1102
1103 crtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S
1104 $(crt_compile) -c -x assembler-with-cpp $<
1105 endif
1106
1107 # Build extra startfiles in the libgcc directory.
1108 .PHONY: libgcc-extra-parts
1109 libgcc-extra-parts: $(EXTRA_PARTS)
1110
1111 # Early copyback; see "all" above for the rationale. The
1112 # early copy is necessary so that the gcc -B options find
1113 # the right startup files when linking shared libgcc.
1114 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
1115 parts="$(EXTRA_PARTS)"; \
1116 for file in $$parts; do \
1117 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
1118 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
1119 case $$file in \
1120 *.a) \
1121 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1122 esac; \
1123 done
1124
1125 all: $(extra-parts)
1126
1127 $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \
1128 $(libgcov-objects) \
1129 $(libunwind-objects) $(libunwind-s-objects) \
1130 $(EXTRA_PARTS): $(LIBGCC_LINKS) libgcc_tm.h
1131
1132 # Copy unwind.h to the place where gcc will look for it at build-time
1133 install-unwind_h-forbuild: unwind.h
1134 dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
1135 cp unwind.h $$dest; \
1136 chmod a+r $$dest; \
1137 sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
1138
1139 # Copy unwind.h to the place where gcc will look at run-time, once installed
1140 #
1141 # This is redundant with the internal copy above when using a regular toplevel
1142 # "install" target, because gcc's install will copy to the destination as well.
1143 #
1144 # This is however useful for "install-no-fixincludes" case, when only the gcc
1145 # internal headers are copied by gcc's install.
1146 install-unwind_h:
1147 $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1148 $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include
1149
1150 all: install-unwind_h-forbuild
1151
1152 install-gcov_h:
1153 $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1154 $(INSTALL_DATA) $(srcdir)/gcov.h $(DESTDIR)$(libsubdir)/include
1155
1156 # Documentation targets (empty).
1157 .PHONY: info html dvi pdf install-info install-html install-pdf
1158
1159 info:
1160 install-info:
1161 html:
1162 install-html:
1163 dvi:
1164 pdf:
1165 install-pdf:
1166
1167 # Install rules. These do not depend on "all", so that they can be invoked
1168 # recursively from it.
1169 install-libunwind:
1170 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
1171
1172 # NOTE: Maybe this should go into $(inst_libdir), but this
1173 # is where the old mklibgcc.in put it.
1174 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
1175 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
1176 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
1177
1178 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1179 @shlib_base_name@,libunwind,$(subst \
1180 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
1181
1182 install-shared:
1183 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1184
1185 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
1186 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1187 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1188
1189 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1190 @shlib_base_name@,libgcc_s,$(subst \
1191 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
1192
1193 install-leaf: $(install-shared) $(install-libunwind)
1194 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1195
1196 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
1197 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
1198 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
1199 ifeq ($(enable_gcov),yes)
1200 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
1201 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
1202 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
1203 endif
1204
1205 parts="$(INSTALL_PARTS)"; \
1206 for file in $$parts; do \
1207 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
1208 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
1209 case $$file in \
1210 *.a) \
1211 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1212 esac; \
1213 done
1214
1215 install: install-leaf install-unwind_h install-gcov_h
1216 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
1217
1218 install-strip: install
1219
1220 .PHONY: install install-shared install-libunwind install-strip
1221 .PHONY: install-unwind_h install-unwind_h-forbuild
1222 .PHONY: install-gcov_h
1223
1224 # Don't export variables to the environment, in order to not confuse
1225 # configure.
1226 .NOEXPORT:
1227
1228 -include $(wildcard *.dep)