summaryrefslogtreecommitdiff
path: root/gcc/config/mips
diff options
context:
space:
mode:
authorYunQiang Su <yunqiang.su@cipunited.com>2022-09-21 11:13:03 +0000
committerYunQiang Su <yunqiang.su@cipunited.com>2022-10-25 16:06:20 +0800
commit354c97ee05b23707efbfc7ff6640dcec7336ac7a (patch)
tree4c8687c1d9db07128edc44eb14fb11abf43dc355 /gcc/config/mips
parent19295e8607da2f743368fe6f5708146616aafa91 (diff)
downloadgcc-354c97ee05b23707efbfc7ff6640dcec7336ac7a.tar.gz
MIPS: fix building on multiarch platform
On platforms that support multiarch, such as Debian, the filesystem hierarchy doesn't fellow the old Irix style: lib & lib/<multiarch> for native lib64 for N64 on N32/O32 systems lib32 for N32 on N64/O32 systems libo32 for O32 on N64/N32 systems Thus we cannot #define STANDARD_STARTFILE_PREFIX_1 #define STANDARD_STARTFILE_PREFIX_2 on N32 or N64 systems, else collect2 won't look for libraries on /lib/<multiarch>. gcc/ChangeLog: * configure.ac: AC_DEFINE(ENABLE_MULTIARCH, 1) * configure: Regenerated. * config.in: Regenerated. * config/mips/mips.h: don't define STANDARD_STARTFILE_PREFIX_1 if ENABLE_MULTIARCH is defined. * config/mips/t-linux64: define correct multiarch path when multiarch is enabled.
Diffstat (limited to 'gcc/config/mips')
-rw-r--r--gcc/config/mips/mips.h2
-rw-r--r--gcc/config/mips/t-linux6421
2 files changed, 22 insertions, 1 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 74b6e11aabb..fe7f5b274b9 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3427,6 +3427,7 @@ struct GTY(()) machine_function {
/* If we are *not* using multilibs and the default ABI is not ABI_32 we
need to change these from /lib and /usr/lib. */
+#ifndef ENABLE_MULTIARCH
#if MIPS_ABI_DEFAULT == ABI_N32
#define STANDARD_STARTFILE_PREFIX_1 "/lib32/"
#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/"
@@ -3434,6 +3435,7 @@ struct GTY(()) machine_function {
#define STANDARD_STARTFILE_PREFIX_1 "/lib64/"
#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/"
#endif
+#endif
/* Load store bonding is not supported by micromips and fix_24k. The
performance can be degraded for those targets. Hence, do not bond for
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
index 2fdd8e00407..37d176ea309 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -20,7 +20,26 @@ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
MULTILIB_DIRNAMES = n32 32 64
MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
-MULTILIB_OSDIRNAMES = \
+ifeq (yes,$(enable_multiarch))
+ ifneq (,$(findstring gnuabi64,$(target)))
+ MULTILIB_OSDIRNAMES = \
+ ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+ ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+ ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+ else ifneq (,$(findstring gnuabin32,$(target)))
+ MULTILIB_OSDIRNAMES = \
+ ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+ ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+ ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+ else
+ MULTILIB_OSDIRNAMES = \
+ ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+ ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+ ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+ endif
+else
+ MULTILIB_OSDIRNAMES = \
../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
+endif