0004-64-bit-multilib-hack.patch 5.8 KB

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