]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/loongarch/t-linux
9997596d722a0ba0af10d91f250507c3c0cef381
[thirdparty/gcc.git] / gcc / config / loongarch / t-linux
1 # Copyright (C) 2021-2023 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 # Multilib
20 MULTILIB_OPTIONS = mabi=lp64d/mabi=lp64f/mabi=lp64s
21 MULTILIB_DIRNAMES = base/lp64d base/lp64f base/lp64s
22
23 # The GCC driver always gets all abi-related options on the command line.
24 # (see loongarch-driver.c:driver_get_normalized_m_opts)
25 comma=,
26 MULTILIB_REQUIRED = $(foreach mlib,$(subst $(comma), ,$(TM_MULTILIB_CONFIG)),\
27 $(firstword $(subst /, ,$(mlib))))
28
29 SPECS = specs.install
30
31 # temporary self_spec when building libraries (e.g. libgcc)
32 gen_mlib_spec = $(if $(word 2,$1),\
33 %{$(firstword $1):$(patsubst %,-%,$(wordlist 2,$(words $1),$1))})
34
35 # clean up the result of DRIVER_SELF_SPEC to avoid conflict
36 lib_build_self_spec = %<march=* %<mtune=* %<mcmodel=* %<mfpu=* %<msimd=*
37
38 # append user-specified build options from --with-multilib-list
39 lib_build_self_spec += $(foreach mlib,\
40 $(subst $(comma), ,$(TM_MULTILIB_CONFIG)),\
41 $(call gen_mlib_spec,$(subst /, ,$(mlib))))
42
43 specs: specs.install
44 sed '/^*self_spec:$$/{ n;s/^$$/$(lib_build_self_spec)/g; }' $< > $@
45
46 # Do some preparation before regression tests:
47 # remove lib-build-specs / make symlinks for the toplevel multilib variant
48
49 LA_DEFAULT_MULTISUBDIR = $(shell $(GCC_FOR_TARGET) --print-multi-dir)
50 .PHONY: remove-lib-specs
51 check check-host check-target $(CHECK_TARGETS) $(lang_checks): remove-lib-specs
52 remove-lib-specs:
53 -mv -f specs.install specs 2>/dev/null
54 -mv $(LA_DEFAULT_MULTISUBDIR)/* ./
55 -mkdir -p ../$(target_noncanonical)/`dirname $(LA_DEFAULT_MULTISUBDIR)`
56 -$(LN_S) .. ../$(target_noncanonical)/$(LA_DEFAULT_MULTISUBDIR)
57
58 # Multiarch
59 ifneq ($(call if_multiarch,yes),yes)
60 # Define LA_DISABLE_MULTIARCH if multiarch is disabled.
61 tm_defines += LA_DISABLE_MULTIARCH
62 else
63 # Only define MULTIARCH_DIRNAME when multiarch is enabled,
64 # or it would always introduce ${target} into the search path.
65 MULTIARCH_DIRNAME = $(LA_MULTIARCH_TRIPLET)
66 endif
67
68 # Don't define MULTILIB_OSDIRNAMES if multilib is disabled.
69 ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
70
71 MULTILIB_OSDIRNAMES = \
72 mabi.lp64d=../lib64$\
73 $(call if_multiarch,:loongarch64-linux-gnu)
74
75 MULTILIB_OSDIRNAMES += \
76 mabi.lp64f=../lib64/f32$\
77 $(call if_multiarch,:loongarch64-linux-gnuf32)
78
79 MULTILIB_OSDIRNAMES += \
80 mabi.lp64s=../lib64/sf$\
81 $(call if_multiarch,:loongarch64-linux-gnusf)
82
83 endif