This patch introduces a distro feature which enables gcc to produce both 32bit and 64bit code, and enables binutils to operate on both 32bit and 64bit binaries. It differs from multilib toolchains in that it does not require to compile a version of the libc for each architecture variant. However, the code produced for the secondary architecture will not be linkable against the libc.
This patch only works with x86 and x86_64 architectures, but can probably be extended to support other architectures as well. One use-case would be when one wants to compile a system which runs 32bit userspace applications with a 64bit kernel without having to deal with two separate libc. Signed-off-by: Julian Pidancet <[email protected]> --- meta/recipes-devtools/binutils/binutils-cross.inc | 3 ++- meta/recipes-devtools/binutils/binutils.inc | 3 ++- meta/recipes-devtools/gcc/gcc-common.inc | 5 +++++ meta/recipes-devtools/gcc/gcc-configure-common.inc | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meta/recipes-devtools/binutils/binutils-cross.inc b/meta/recipes-devtools/binutils/binutils-cross.inc index 982224f..3f76c59 100644 --- a/meta/recipes-devtools/binutils/binutils-cross.inc +++ b/meta/recipes-devtools/binutils/binutils-cross.inc @@ -10,7 +10,8 @@ EXTRA_OECONF = "--with-sysroot=${STAGING_DIR_TARGET} \ --disable-werror \ --disable-nls \ --enable-poison-system-directories \ - ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)}" + ${@base_contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default', '', d)} \ + ${@base_contains('DISTRO_FEATURES', 'biarch', '--enable-64-bit-bfd', '', d)}" do_install () { oe_runmake 'DESTDIR=${D}' install diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc index 58fee85..fe16b18 100644 --- a/meta/recipes-devtools/binutils/binutils.inc +++ b/meta/recipes-devtools/binutils/binutils.inc @@ -49,7 +49,8 @@ B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \ --enable-install-libbfd \ - --enable-shared" + --enable-shared \ + ${@base_contains('DISTRO_FEATURES', 'biarch', '--enable-64-bit-bfd', '', d)}" EXTRA_OECONF_virtclass-native = "--enable-target=all --enable-64-bit-bfd --enable-install-libbfd" diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index f83f4da..fdbb77b 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc @@ -21,6 +21,11 @@ def get_gcc_mips_plt_setting(bb, d): return "--with-mips-plt" return "" +def get_gcc_x86_biarch_setting(bb, d): + if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'i586', 'i686', 'x86_64' ] and 'biarch' in bb.data.getVar('DISTRO_FEATURES',d,1).split() : + return "--enable-targets=all" + return "" + # We really need HOST_SYS here for some packages and TARGET_SYS for others. # For now, libgcc is most important so we fix for that - RP. SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs" diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc index 2ddc3d7..55a0626 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc @@ -42,7 +42,8 @@ EXTRA_OECONF = "${@['--enable-clocale=generic', ''][bb.data.getVar('USE_NLS', d, ${EXTRA_OECONF_BASE} \ ${EXTRA_OECONF_FPU} \ ${EXTRA_OECONF_PATHS} \ - ${@get_gcc_mips_plt_setting(bb, d)}" + ${@get_gcc_mips_plt_setting(bb, d)} \ + ${@get_gcc_x86_biarch_setting(bb, d)}" # Build uclibc compilers without cxa_atexit support EXTRA_OECONF_append_linux = " --enable-__cxa_atexit" -- Julian Pidancet _______________________________________________ Openembedded-core mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
