From ddd344e9acef88d614473581266569ce14716ccc Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 8 Jul 2012 11:34:52 -0700 Subject: gcc: Convert do_headerfix into a definitive patch do_headerfix task is essentially editing configuration headers in sources which can well be maintained as a patch which is easier to spot errors (if any) than dynamically edited source tree Signed-off-by: Khem Raj Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-4.7.inc | 1 + .../gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch | 165 +++++++++++++++++++++ meta/recipes-devtools/gcc/gcc-common.inc | 18 --- 3 files changed, 166 insertions(+), 18 deletions(-) create mode 100644 meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc index a2e9ae0994..7a0d231bd8 100644 --- a/meta/recipes-devtools/gcc/gcc-4.7.inc +++ b/meta/recipes-devtools/gcc/gcc-4.7.inc @@ -65,6 +65,7 @@ SRC_URI = "svn://gcc.gnu.org/svn/gcc/branches;module=${BRANCH};protocol=http \ file://libgcc-sjlj-check.patch \ file://cpp-honor-sysroot.patch \ file://mips64-default-n64.patch \ + file://GLIBC_DYNAMIC_LINKER.patch \ file://arm-hard-float-loader.patch \ file://gcc-argument-list-too-long.patch \ file://fix-g++-sysroot.patch \ diff --git a/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch new file mode 100644 index 0000000000..38c361e085 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.7/GLIBC_DYNAMIC_LINKER.patch @@ -0,0 +1,165 @@ +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 @@ + . */ + + #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 + . */ + +-#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 + diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index 0a9324aa3c..72180db2a8 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc @@ -62,7 +62,6 @@ B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}" do_fetch[stamp-base] = "${SS}" do_unpack[stamp-base] = "${SS}" -do_headerfix[stamp-base] = "${SS}" do_patch[stamp-base] = "${SS}" # SW means Shared Work directory @@ -91,23 +90,6 @@ python workshared_clean () { oe.path.remove(dir) } -do_headerfix () { - # Change the default dynamic linker path, in case $base_liddir is non-standard - # (e.g. in multilib or sdk cases) - # - # We want something like the following: - # #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" - # becomes - # #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2" - # - sed -i ${S}/gcc/config/*/linux*.h -e \ - 's#\(GLIBC_DYNAMIC_LINKER[^ ]*\) \( *"/lib.*\)/\(.*\)#\1 SYSTEMLIBS_DIR "\3#' -} - -addtask headerfix after do_unpack before do_patch - -do_headerfix[vardepvalue] = "PATH" - # We need to ensure that for the shared work directory, the do_patch singatures match # The real WORKDIR location isn't a dependency for the shared workdir. src_patches[vardepsexclude] = "WORKDIR" -- cgit 1.2.3-korg