blob: 5f14dd2a58acae686c98b64ab09786be7e0d9e64 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 2fa5c93641b75a662839c1b6eee172b6c481c70e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22Do same for riscv64, aarch64 & arc
23
24RP 15/8/11
25
26Upstream-Status: Inappropriate [OE-Specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
30Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
31---
32 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
33 gcc/config/arc/t-multilib-linux | 4 ++--
34 gcc/config/i386/t-linux64 | 6 ++----
35 gcc/config/mips/t-linux64 | 10 +++-------
36 gcc/config/riscv/t-linux | 6 ++++--
37 gcc/config/rs6000/t-linux64 | 5 ++---
38 6 files changed, 17 insertions(+), 22 deletions(-)
39
40diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
41index 241b0ef20b6..a7dadb2d64f 100644
42--- a/gcc/config/aarch64/t-aarch64-linux
43+++ b/gcc/config/aarch64/t-aarch64-linux
44@@ -21,8 +21,8 @@
45 LIB1ASMSRC = aarch64/lib1funcs.asm
46 LIB1ASMFUNCS = _aarch64_sync_cache_range
47
48-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
49-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
50-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
51+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
52+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
53+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
54
55-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
56+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
57diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
58index fc3fff640a2..d58e28f6df8 100644
59--- a/gcc/config/arc/t-multilib-linux
60+++ b/gcc/config/arc/t-multilib-linux
61@@ -16,9 +16,9 @@
62 # along with GCC; see the file COPYING3. If not see
63 # <http://www.gnu.org/licenses/>.
64
65-MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
66+#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
67
68-MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
69+#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
70
71 # Aliases:
72 MULTILIB_MATCHES += mcpu?arc700=mA7
73diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
74index d288b093522..7b5980a9d21 100644
75--- a/gcc/config/i386/t-linux64
76+++ b/gcc/config/i386/t-linux64
77@@ -32,7 +32,5 @@
78 #
79 comma=,
80 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
81-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
82-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
83-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
84-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
85+MULTILIB_DIRNAMES = . .
86+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
87diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
88index 130e1f04707..3b7eb6b2a2f 100644
89--- a/gcc/config/mips/t-linux64
90+++ b/gcc/config/mips/t-linux64
91@@ -17,10 +17,6 @@
92 # <http://www.gnu.org/licenses/>.
93
94 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
95-MULTILIB_DIRNAMES = n32 32 64
96-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
97-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
98-MULTILIB_OSDIRNAMES = \
99- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
100- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
101- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
102+MULTILIB_DIRNAMES = . . .
103+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
104+
105diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
106index 216d2776a18..e4d817621fc 100644
107--- a/gcc/config/riscv/t-linux
108+++ b/gcc/config/riscv/t-linux
109@@ -1,3 +1,5 @@
110 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
111-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
112-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
113+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
114+MULTILIB_DIRNAMES := . .
115+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
116+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
117diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
118index e11a118cb5f..4eaffb416fe 100644
119--- a/gcc/config/rs6000/t-linux64
120+++ b/gcc/config/rs6000/t-linux64
121@@ -26,10 +26,9 @@
122 # MULTILIB_OSDIRNAMES according to what is found on the target.
123
124 MULTILIB_OPTIONS := m64/m32
125-MULTILIB_DIRNAMES := 64 32
126+MULTILIB_DIRNAMES := . .
127 MULTILIB_EXTRA_OPTS :=
128-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
129-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
130+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
131
132 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
133 $(COMPILE) $<