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