]> code.ossystems Code Review - openembedded-core.git/commitdiff
Introduce multiarch DISTRO_FEATURE
authorJulian Pidancet <julian.pidancet@gmail.com>
Wed, 16 Nov 2011 01:01:59 +0000 (01:01 +0000)
committerSaul Wold <sgw@linux.intel.com>
Tue, 29 Nov 2011 08:20:07 +0000 (00:20 -0800)
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.

v2: - Renamed the feature name from "biarch" to "multiarch". The GCC
installation manual claims that the mips-linux can be made a tri-arch
compiler (http://gcc.gnu.org/install/configure.html)
    - For x86_64, the compiler is made bi-arch by default, so nothing
has to be done in particular.
    - I analyzed the gcc/config.gcc from GCC sources and added in this
patch all the architectures that could be made biarch with the version
of gcc currently used in OE, which are powerpc, and sparc, in addition
to x86. mips and s390 will probably be supported in future versions of
gcc. For x86 and sparc, only the --enable-targets=all option is valid
to make this work (this option doesn't have any other side effects than
making the compiler bi-arch). For powerpc, I used the
--enable-targets=powerpc64 option (although 'all' also works).

Note: - Untested on powerpc and sparc. But I believe it works the same
as with x86.
      - gcc in meta-toolchain is also made multiarch.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
meta/recipes-devtools/binutils/binutils-cross.inc
meta/recipes-devtools/binutils/binutils.inc
meta/recipes-devtools/gcc/gcc-common.inc
meta/recipes-devtools/gcc/gcc-configure-common.inc

index 982224ff2fb8538e48e2b9aa5986d277ba72bff5..f07907ef13d40cb304efb0b3a34aea8f90590905 100644 (file)
@@ -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', 'multiarch', '--enable-64-bit-bfd', '', d)}"
 
 do_install () {
        oe_runmake 'DESTDIR=${D}' install
index 58fee854e3c818ccb129e75fda2a8e961a9788ef..51e425791c4f4b0637d8e4bb4f6f48075a4e3511 100644 (file)
@@ -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', 'multiarch', '--enable-64-bit-bfd', '', d)}"
 
 EXTRA_OECONF_virtclass-native = "--enable-target=all --enable-64-bit-bfd --enable-install-libbfd"
 
index 69e0213e9f5070da6bf36cc1a3ca10480d110e09..7ec2f7e4636a1702924271da037018cd382ada95 100644 (file)
@@ -21,6 +21,16 @@ def get_gcc_mips_plt_setting(bb, d):
         return "--with-mips-plt"
     return ""
 
+def get_gcc_multiarch_setting(bb, d):
+    if 'multiarch' in bb.data.getVar('DISTRO_FEATURES',d,1).split() :
+        if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'i586', 'i686' ] :
+            return "--enable-targets=all"
+        if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'powerpc' ] :
+            return "--enable-targets=powerpc64"
+        if bb.data.getVar('TARGET_ARCH', d, 1) in [ 'sparc' ] :
+            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"
index ae23e8ee49cc22246e3b834bedadf2fa88905732..d0149801dbb26b7de26d5d325addd274d1d77131 100644 (file)
@@ -42,7 +42,8 @@ EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', 1) != 'n
                 ${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_multiarch_setting(bb, d)}"
 
 # Build uclibc compilers without cxa_atexit support
 EXTRA_OECONF_append_linux               = " --enable-__cxa_atexit"