Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 1 | From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 29 Mar 2013 09:10:06 +0400 |
| 4 | Subject: [PATCH] 64-bit multilib hack. |
| 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, aarch64 & arc |
| 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> |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 31 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 32 | --- |
| 33 | gcc/config/aarch64/t-aarch64-linux | 8 ++++---- |
| 34 | gcc/config/arc/t-multilib-linux | 4 ++-- |
| 35 | gcc/config/i386/t-linux64 | 6 ++---- |
| 36 | gcc/config/mips/t-linux64 | 10 +++------- |
| 37 | gcc/config/riscv/t-linux | 6 ++++-- |
| 38 | gcc/config/rs6000/t-linux64 | 5 ++--- |
| 39 | 6 files changed, 17 insertions(+), 22 deletions(-) |
| 40 | |
| 41 | diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 42 | index d0cd546002a..f4056d68372 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 43 | --- a/gcc/config/aarch64/t-aarch64-linux |
| 44 | +++ b/gcc/config/aarch64/t-aarch64-linux |
| 45 | @@ -21,8 +21,8 @@ |
| 46 | LIB1ASMSRC = aarch64/lib1funcs.asm |
| 47 | LIB1ASMFUNCS = _aarch64_sync_cache_range |
| 48 | |
| 49 | -AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) |
| 50 | -MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) |
| 51 | -MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) |
| 52 | +#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be) |
| 53 | +#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu) |
| 54 | +#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) |
| 55 | |
| 56 | -MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) |
| 57 | +#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) |
| 58 | diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 59 | index ecb9ae6859f..12a164028d4 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 60 | --- a/gcc/config/arc/t-multilib-linux |
| 61 | +++ b/gcc/config/arc/t-multilib-linux |
| 62 | @@ -16,9 +16,9 @@ |
| 63 | # along with GCC; see the file COPYING3. If not see |
| 64 | # <http://www.gnu.org/licenses/>. |
| 65 | |
| 66 | -MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400 |
| 67 | +#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400 |
| 68 | |
| 69 | -MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400 |
| 70 | +#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400 |
| 71 | |
| 72 | # Aliases: |
| 73 | MULTILIB_MATCHES += mcpu?arc700=mA7 |
| 74 | diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 75 | index 5526ad0e6cc..fa51c88912b 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 76 | --- a/gcc/config/i386/t-linux64 |
| 77 | +++ b/gcc/config/i386/t-linux64 |
| 78 | @@ -32,7 +32,5 @@ |
| 79 | # |
| 80 | comma=, |
| 81 | MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG)) |
| 82 | -MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS))) |
| 83 | -MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu) |
| 84 | -MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu) |
| 85 | -MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) |
| 86 | +MULTILIB_DIRNAMES = . . |
| 87 | +MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) |
| 88 | diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 89 | index 2fdd8e00407..04f2099250f 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 90 | --- a/gcc/config/mips/t-linux64 |
| 91 | +++ b/gcc/config/mips/t-linux64 |
| 92 | @@ -17,10 +17,6 @@ |
| 93 | # <http://www.gnu.org/licenses/>. |
| 94 | |
| 95 | MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64 |
| 96 | -MULTILIB_DIRNAMES = n32 32 64 |
| 97 | -MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el) |
| 98 | -MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft) |
| 99 | -MULTILIB_OSDIRNAMES = \ |
| 100 | - ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \ |
| 101 | - ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \ |
| 102 | - ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT)) |
| 103 | +MULTILIB_DIRNAMES = . . . |
| 104 | +MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) |
| 105 | + |
| 106 | diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux |
| 107 | index 216d2776a18..e4d817621fc 100644 |
| 108 | --- a/gcc/config/riscv/t-linux |
| 109 | +++ b/gcc/config/riscv/t-linux |
| 110 | @@ -1,3 +1,5 @@ |
| 111 | # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ |
| 112 | -MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) |
| 113 | -MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) |
| 114 | +#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) |
| 115 | +MULTILIB_DIRNAMES := . . |
| 116 | +#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) |
| 117 | +MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) |
| 118 | diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 119 | index 47e0efd5764..05f5a3f188e 100644 |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 120 | --- a/gcc/config/rs6000/t-linux64 |
| 121 | +++ b/gcc/config/rs6000/t-linux64 |
| 122 | @@ -26,10 +26,9 @@ |
| 123 | # MULTILIB_OSDIRNAMES according to what is found on the target. |
| 124 | |
| 125 | MULTILIB_OPTIONS := m64/m32 |
| 126 | -MULTILIB_DIRNAMES := 64 32 |
| 127 | +MULTILIB_DIRNAMES := . . |
| 128 | MULTILIB_EXTRA_OPTS := |
| 129 | -MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu) |
| 130 | -MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu) |
| 131 | +MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) |
| 132 | |
Andrew Geissler | ea144b0 | 2023-01-27 16:03:57 -0600 | [diff] [blame] | 133 | rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc |
Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 134 | $(COMPILE) $< |