This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
relative to SYSTEMLIBS_DIR which can be set in generated headers
This breaks the assumption of hardcoded multilib in gcc
Change is only for the supported architectures in OE including
SH, spart, alpha for possible future support (if any)

Removes the do_headerfix task in metadata

Signed-off-by: Khem Raj
Upstream-Status: Inappropriate [OE configuration]

Index: git/gcc/config/alpha/linux-elf.h
===================================================================
--- git.orig/gcc/config/alpha/linux-elf.h	2012-07-08 11:16:26.199320624 -0700
+++ git/gcc/config/alpha/linux-elf.h	2012-07-08 11:19:51.059330624 -0700
@@ -24,8 +24,8 @@
 #define EXTRA_SPECS \
 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
 
-#define GLIBC_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER	SYSTEMLIBS_DIR "ld-linux.so.2"
+#define UCLIBC_DYNAMIC_LINKER  SYSTEMLIBS_DIR "ld-uClibc.so.0"
 #if DEFAULT_LIBC == LIBC_UCLIBC
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
 #elif DEFAULT_LIBC == LIBC_GLIBC
Index: git/gcc/config/arm/linux-eabi.h
===================================================================
--- git.orig/gcc/config/arm/linux-eabi.h	2012-07-08 11:16:26.000000000 -0700
+++ git/gcc/config/arm/linux-eabi.h	2012-07-08 11:20:40.947333288 -0700
@@ -62,7 +62,7 @@
 /* Use ld-linux.so.3 so that it will be possible to run "classic"
    GNU/Linux binaries on an EABI system.  */
 #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.3"
 
 /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
    use the GNU/Linux version, not the generic BPABI version.  */
Index: git/gcc/config/arm/linux-elf.h
===================================================================
--- git.orig/gcc/config/arm/linux-elf.h	2012-07-08 11:16:31.903320900 -0700
+++ git/gcc/config/arm/linux-elf.h	2012-07-08 11:21:37.619335646 -0700
@@ -59,7 +59,7 @@
 
 #define LIBGCC_SPEC "-lgcc"
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
 
 #define LINUX_TARGET_LINK_SPEC  "%{h*} \
    %{static:-Bstatic} \
Index: git/gcc/config/i386/linux.h
===================================================================
--- git.orig/gcc/config/i386/linux.h	2012-07-08 11:16:26.267320627 -0700
+++ git/gcc/config/i386/linux.h	2012-07-08 11:23:26.727340361 -0700
@@ -21,4 +21,4 @@
 <http://www.gnu.org/licenses/>.  */
 
 #define GNU_USER_LINK_EMULATION "elf_i386"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
Index: git/gcc/config/i386/linux64.h
===================================================================
--- git.orig/gcc/config/i386/linux64.h	2012-07-08 11:16:26.267320627 -0700
+++ git/gcc/config/i386/linux64.h	2012-07-08 11:23:13.255340316 -0700
@@ -28,6 +28,6 @@
 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
Index: git/gcc/config/mips/linux.h
===================================================================
--- git.orig/gcc/config/mips/linux.h	2012-07-08 11:16:26.307320629 -0700
+++ git/gcc/config/mips/linux.h	2012-07-08 11:23:56.063342214 -0700
@@ -18,4 +18,4 @@
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
Index: git/gcc/config/mips/linux64.h
===================================================================
--- git.orig/gcc/config/mips/linux64.h	2012-07-08 11:16:26.307320629 -0700
+++ git/gcc/config/mips/linux64.h	2012-07-08 11:24:52.207345073 -0700
@@ -23,10 +23,10 @@
 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld.so.1"
-#define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
-#define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld.so.1"
+#define GLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld.so.1"
+#define UCLIBC_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
 #define GNU_USER_DYNAMIC_LINKERN32 \
   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
Index: git/gcc/config/rs6000/linux64.h
===================================================================
--- git.orig/gcc/config/rs6000/linux64.h	2012-07-08 11:16:26.335320630 -0700
+++ git/gcc/config/rs6000/linux64.h	2012-07-08 11:26:05.867348369 -0700
@@ -358,10 +358,10 @@
 #undef	LINK_OS_DEFAULT_SPEC
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
 #if DEFAULT_LIBC == LIBC_UCLIBC
 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
 #elif DEFAULT_LIBC == LIBC_GLIBC
Index: git/gcc/config/sh/linux.h
===================================================================
--- git.orig/gcc/config/sh/linux.h	2012-07-08 11:16:26.363320632 -0700
+++ git/gcc/config/sh/linux.h	2012-07-08 11:26:29.375350165 -0700
@@ -45,7 +45,7 @@
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
 
 #undef SUBTARGET_LINK_EMUL_SUFFIX
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
Index: git/gcc/config/sparc/linux.h
===================================================================
--- git.orig/gcc/config/sparc/linux.h	2012-07-08 11:16:26.371320632 -0700
+++ git/gcc/config/sparc/linux.h	2012-07-08 11:27:00.439351163 -0700
@@ -84,7 +84,7 @@
    When the -shared link option is used a final link is not being
    done.  */
 
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
 
 #undef  LINK_SPEC
 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
Index: git/gcc/config/sparc/linux64.h
===================================================================
--- git.orig/gcc/config/sparc/linux64.h	2012-07-08 11:16:26.371320632 -0700
+++ git/gcc/config/sparc/linux64.h	2012-07-08 11:27:23.571352396 -0700
@@ -93,8 +93,8 @@
    When the -shared link option is used a final link is not being
    done.  */
 
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
 
 #ifdef SPARC_BI_ARCH
 
