public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] On-target multilib gcc enhacement
@ 2013-01-14 15:16 Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 1/6] gcc: add missing dependency (zlib) Constantin Musca
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

This patchset enables the user to build gcc with configurable multilib options.
The following changes since commit 53cc748b93e8af584557d6db5309c3e955182c5c:

  linux-libc-headers: fix headers install in long path name environments (2013-01-10 23:53:51 +0000)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib cmuscax/gcc_enhan3
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=cmuscax/gcc_enhan3

Constantin Musca (6):
  gcc: add missing dependency (zlib)
  gcc: remove the 64bithack patch
  multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME
  gcc: enable multilib for target gcc
  tune-mips32: add BASE_LIB to mips32 tunes
  tune-ppc603e: add BASE_LIB

 meta/conf/machine/include/tune-mips32.inc          |   4 +
 meta/conf/machine/include/tune-ppc603e.inc         |   1 +
 meta/conf/multilib.conf                            |   2 +-
 meta/recipes-devtools/gcc/gcc-4.7.inc              |   5 +-
 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch  |  63 -------
 meta/recipes-devtools/gcc/gcc-common.inc           |  25 +++
 meta/recipes-devtools/gcc/gcc-configure-common.inc |   3 +-
 meta/recipes-devtools/gcc/gcc-configure-target.inc |   1 +
 meta/recipes-devtools/gcc/gcc-multilib-config.inc  | 200 +++++++++++++++++++++
 meta/recipes-devtools/gcc/libgcc_4.7.bb            |  44 +++++
 10 files changed, 280 insertions(+), 68 deletions(-)
 delete mode 100644 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-multilib-config.inc

-- 
1.7.11.7




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/6] gcc: add missing dependency (zlib)
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 2/6] gcc: remove the 64bithack patch Constantin Musca
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

- add zlib to DEPENDS (it fails otherwise)

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/recipes-devtools/gcc/gcc-4.7.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
index 378caf0..08a0103 100644
--- a/meta/recipes-devtools/gcc/gcc-4.7.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -1,6 +1,6 @@
 require gcc-common.inc
 
-PR = "r13"
+PR = "r14"
 
 # Third digit in PV should be incremented after a minor release
 # happens from this branch on gcc e.g. currently its 4.7.1
@@ -20,7 +20,7 @@ BINV = "4.7.2"
 
 FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/gcc-4.7' ], d)}"
 
-DEPENDS =+ "mpfr gmp libmpc"
+DEPENDS =+ "mpfr gmp libmpc zlib"
 NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
 
 LICENSE="GPL-3.0-with-GCC-exception & GPLv3"
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/6] gcc: remove the 64bithack patch
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 1/6] gcc: add missing dependency (zlib) Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 3/6] multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME Constantin Musca
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/recipes-devtools/gcc/gcc-4.7.inc             |  1 -
 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch | 63 -----------------------
 2 files changed, 64 deletions(-)
 delete mode 100644 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch

diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
index 08a0103..2fad764 100644
--- a/meta/recipes-devtools/gcc/gcc-4.7.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -50,7 +50,6 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
            file://gcc-poison-system-directories.patch \
            file://gcc-poison-dir-extend.patch \
            file://gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
-	   file://64bithack.patch \
 	   file://optional_libstdc.patch \
 	   file://disable_relax_pic_calls_flag.patch \
 	   file://COLLECT_GCC_OPTIONS.patch \
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch b/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
deleted file mode 100644
index f475669..0000000
--- a/meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Upstream-Status: Inappropriate [embedded specific]
-
-GCC has internal multilib handling code but it assumes a very specific rigid directory
-layout. The build system implementation of multilib layout is very generic and allows
-complete customisation of the library directories.
-
-This patch is a partial solution to allow any custom directories to be passed into gcc
-and handled correctly. It forces gcc to use the base_libdir (which is the current 
-directory, "."). We need to do this for each multilib that is configured as we don't
-know which compiler options may be being passed into the compiler. Since we have a compiler
-per mulitlib at this point that isn't an issue.
-
-The one problem is the target compiler is only going to work for the default multlilib at
-this point. Ideally we'd figure out which multilibs were being enabled with which paths
-and be able to patch these entries with a complete set of correct paths but this we
-don't have such code at this point. This is something the target gcc recipe should do 
-and override these platform defaults in its build config.
-
-RP 15/8/11
-
-Index: trunk/gcc/config/i386/t-linux64
-===================================================================
---- trunk.orig/gcc/config/i386/t-linux64	2012-02-22 09:44:48.000000000 -0800
-+++ trunk/gcc/config/i386/t-linux64	2012-02-22 12:31:01.836462957 -0800
-@@ -33,7 +33,6 @@
- #
- comma=,
- MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
--MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
--MULTILIB_OSDIRNAMES = m64=../lib64
--MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
--MULTILIB_OSDIRNAMES+= mx32=../libx32
-+MULTILIB_DIRNAMES = . .
-+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
-+
-Index: trunk/gcc/config/mips/t-linux64
-===================================================================
---- trunk.orig/gcc/config/mips/t-linux64	2012-02-22 09:44:58.000000000 -0800
-+++ trunk/gcc/config/mips/t-linux64	2012-02-22 12:32:01.132465823 -0800
-@@ -17,5 +17,5 @@
- # <http://www.gnu.org/licenses/>.
- 
- MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
--MULTILIB_DIRNAMES = n32 32 64
--MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
-+MULTILIB_DIRNAMES = . . .
-+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
-Index: trunk/gcc/config/rs6000/t-linux64
-===================================================================
---- trunk.orig/gcc/config/rs6000/t-linux64	2012-02-22 09:44:54.000000000 -0800
-+++ trunk/gcc/config/rs6000/t-linux64	2012-02-22 12:28:17.960454968 -0800
-@@ -27,9 +27,9 @@
- # MULTILIB_OSDIRNAMES according to what is found on the target.
- 
- MULTILIB_OPTIONS        = m64/m32 msoft-float
--MULTILIB_DIRNAMES       = 64 32 nof
-+MULTILIB_DIRNAMES       = . . .
- MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
- MULTILIB_EXCEPTIONS     = m64/msoft-float
- MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
--MULTILIB_OSDIRNAMES	= ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib) nof
-+MULTILIB_OSDIRNAMES	= ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
- MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/6] multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 1/6] gcc: add missing dependency (zlib) Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 2/6] gcc: remove the 64bithack patch Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 4/6] gcc: enable multilib for target gcc Constantin Musca
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/conf/multilib.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index 97b53ec..daa569c 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -2,7 +2,7 @@
 baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) or 'INVALID'), True) or 'lib'}"
 
 MULTILIB_VARIANTS = "${@extend_variants(d,'MULTILIBS','multilib')}"
-MULTILIB_SAVE_VARNAME = "DEFAULTTUNE"
+MULTILIB_SAVE_VARNAME = "DEFAULTTUNE TARGET_ARCH"
 
 MULTILIBS ??= "multilib:lib32"
 
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/6] gcc: enable multilib for target gcc
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
                   ` (2 preceding siblings ...)
  2013-01-14 15:16 ` [PATCH v2 3/6] multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 5/6] tune-mips32: add BASE_LIB to mips32 tunes Constantin Musca
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

- add a task to setup multilib configuration for target gcc
- this commit adapts Nitin Kamble's work to gcc 4.7
- gcc_multilib_setup creates the same patch for all gcc variants
- use a hash for storing the multilib default options
- use a hash for storing arch-dependent multilib options

Tests:
root@qemux86-64:~# gcc -m64 t.c -o t
root@qemux86-64:~# file t
t: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
root@qemux86-64:~# ./t
Hello World !
root@qemux86-64:~# gcc -m32 t.c -o t
root@qemux86-64:~# file t
t: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
root@qemux86-64:~# ./t
Hello World !

[YOCTO #1369]

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/recipes-devtools/gcc/gcc-4.7.inc              |   2 +-
 meta/recipes-devtools/gcc/gcc-common.inc           |  25 +++
 meta/recipes-devtools/gcc/gcc-configure-common.inc |   3 +-
 meta/recipes-devtools/gcc/gcc-configure-target.inc |   1 +
 meta/recipes-devtools/gcc/gcc-multilib-config.inc  | 200 +++++++++++++++++++++
 meta/recipes-devtools/gcc/libgcc_4.7.bb            |  44 +++++
 6 files changed, 273 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/gcc/gcc-multilib-config.inc

diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc
index 2fad764..13a1e7e 100644
--- a/meta/recipes-devtools/gcc/gcc-4.7.inc
+++ b/meta/recipes-devtools/gcc/gcc-4.7.inc
@@ -1,6 +1,6 @@
 require gcc-common.inc
 
-PR = "r14"
+PR = "r15"
 
 # Third digit in PV should be incremented after a minor release
 # happens from this branch on gcc e.g. currently its 4.7.1
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc
index 6e64441..8c8168f 100644
--- a/meta/recipes-devtools/gcc/gcc-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-common.inc
@@ -34,6 +34,29 @@ def get_gcc_multiarch_setting(bb, d):
             return multiarch_options[target_arch]
     return ""
 
+# this is used by the multilib setup of gcc
+def get_tune_parameters(tune, d):
+    availtunes = d.getVar('AVAILTUNES', True)
+    if tune not in availtunes.split():
+        bb.error('The tune: %s is not one of the available tunes: %s', tune, availtunes)
+
+    localdata = bb.data.createCopy(d)
+    override = ':tune-' + tune
+    localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
+    bb.data.update_data(localdata)
+
+    retdict = {}
+    retdict['tune'] = tune
+    retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True)
+    retdict['features'] = localdata.getVar('TUNE_FEATURES', True)
+    retdict['baselib'] = localdata.getVar('BASE_LIB', True)
+    retdict['arch'] = localdata.getVar('TUNE_ARCH', True)
+    retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True)
+    retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True)
+    retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True)
+    retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True)
+    return retdict
+
 # 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"
@@ -62,10 +85,12 @@ SS = "${TMPDIR}/stamps/work-shared/gcc-${PV}-${PR}"
 do_fetch[stamp-base] = "${SS}"
 do_unpack[stamp-base] = "${SS}"
 do_patch[stamp-base] = "${SS}"
+do_gcc_multilib_setup[stamp-base] = "${SS}"
 SSCLEAN = "${TMPDIR}/stamps/work-shared/gcc-[0-9]*-*"
 do_fetch[stamp-base-clean] = "${SSCLEAN}"
 do_unpack[stamp-base-clean] = "${SSCLEAN}"
 do_patch[stamp-base-clean] = "${SSCLEAN}"
+do_gcc_multilib_setup[stamp-base-clean] = "${SSCLEAN}"
 
 # SW means Shared Work directory
 SW = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index 4eb59fd..b87ea62 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -1,3 +1,4 @@
+require gcc-multilib-config.inc
 #
 # Build the list of lanaguages to build.
 #
@@ -25,7 +26,7 @@ EXTRA_OECONF_PATHS ?= ""
 EXTRA_OECONF_INITIAL ?= ""
 EXTRA_OECONF_INTERMEDIATE ?= ""
 
-GCCMULTILIB = "--disable-multilib"
+GCCMULTILIB ?= "--disable-multilib"
 GCCTHREADS ?= "posix"
 
 EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
diff --git a/meta/recipes-devtools/gcc/gcc-configure-target.inc b/meta/recipes-devtools/gcc/gcc-configure-target.inc
index f41301f..6cc374b 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-target.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-target.inc
@@ -1,3 +1,4 @@
+GCCMULTILIB = "--enable-multilib"
 require gcc-configure-common.inc
 
 EXTRA_OECONF_PATHS = " \
diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
new file mode 100644
index 0000000..3c1e248
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -0,0 +1,200 @@
+addtask gcc_multilib_setup after do_patch before do_configure
+
+# following code modifies these definitions in the gcc config
+#    MULTILIB_OPTIONS
+#    MULTILIB_DIRNAMES
+#    MULTILIB_OSDIRNAMES
+#    GLIBC_DYNAMIC_LINKER32
+#    GLIBC_DYNAMIC_LINKER64
+#    GLIBC_DYNAMIC_LINKERX32
+#    GLIBC_DYNAMIC_LINKERN32
+#  For more information on use of these variables look at these files in the gcc source code
+#    gcc/config/i386/t-linux64
+#    gcc/config/mips/t-linux64
+#    gcc/config/rs6000/t-linux64
+#    gcc/config/i386/linux64.h
+#    gcc/config/mips/linux64.h
+#    gcc/config/rs6000/linux64.h
+
+python do_gcc_multilib_setup() {
+    import re
+
+    srcdir = d.getVar('S', True)
+
+    def write_config(files, options, dirnames, osdirnames):
+        for ml_conf_file in files:
+            with open(srcdir + '/' + ml_conf_file, 'r') as f:
+                filelines = f.read()
+                # recreate multilib configuration variables
+
+                filelines = re.sub(r'^\s*MULTILIB_OPTIONS\s*=.*$',
+                            'MULTILIB_OPTIONS = ' + '/'.join(options),
+                            filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^\s*MULTILIB_DIRNAMES\s*=.*$',
+                            'MULTILIB_DIRNAMES = ' + ' '.join(dirnames),
+                            filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^\s*MULTILIB_OSDIRNAMES\s*=.*$',
+                            'MULTILIB_OSDIRNAMES = ' + ' '.join(osdirnames),
+                            filelines, flags=re.MULTILINE)
+
+                filelines = re.sub(r'^\s*MULTILIB_OPTIONS\s*\+=.*$',
+                            '', filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^\s*MULTILIB_DIRNAMES\s*\+=.*$',
+                            '', filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^\s*MULTILIB_OSDIRNAMES\s*\+=.*$',
+                            '', filelines, flags=re.MULTILINE)
+
+                with open(srcdir + '/' + ml_conf_file, 'w') as f:
+                    f.write(filelines)
+
+    def write_headers(files, libdir32, libdir64, libdirx32, libdirn32):
+        def wrap_libdir(libdir):
+            if libdir.find('SYSTEMLIBS_DIR') != -1:
+                return libdir
+            else:
+                return '"/%s/"' % libdir
+
+        for ml_conf_file in files:
+            with open(srcdir + '/' + ml_conf_file, 'r') as f:
+                filelines = f.read()
+
+                # replace lines like
+                # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+                # by
+                # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
+                # this is needed to put the correct dynamic loader path in the generated binaries
+
+                filelines = re.sub(r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
+                    r'\1' + wrap_libdir(libdir32) + r'\3',
+                    filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
+                    r'\1' + wrap_libdir(libdir64) + r'\3',
+                    filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
+                    r'\1' + wrap_libdir(libdirx32) + r'\3',
+                    filelines, flags=re.MULTILINE)
+                filelines = re.sub(r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
+                    r'\1' + wrap_libdir(libdirn32) + r'\3',
+                    filelines, flags=re.MULTILINE)
+
+                with open(srcdir + '/' + ml_conf_file, 'w') as f:
+                    f.write(filelines)
+
+    gcc_target_config_files = {
+        'x86_64'    : ['gcc/config/i386/t-linux64'],
+        'i586'      : ['gcc/config/i386/t-linux64'],
+        'mips'      : ['gcc/config/mips/t-linux64'],
+        'powerpc'   : ['gcc/config/rs6000/t-linux64'],
+    }
+
+    gcc_header_config_files = {
+        'x86_64'    : ['gcc/config/i386/linux64.h'],
+        'i586'      : ['gcc/config/i386/linux64.h'],
+        'mips'      : ['gcc/config/mips/linux64.h'],
+        'powerpc'   : ['gcc/config/rs6000/linux64.h'],
+    }
+
+    default_ml_config = {
+        'gcc/config/i386/t-linux64' : {
+            'options'      : ['$(subst $(comma),/,$(TM_MULTILIB_CONFIG))'],
+            'dirnames'     : ['.'] * 2,
+            'osdirnames'   : ['../$(shell basename $(base_libdir))'] * 2,
+        },
+        'gcc/config/mips/t-linux64' : {
+            'options'      : ['mabi=n32', 'mabi=32', 'mabi=64'],
+            'dirnames'     : ['.'] * 3,
+            'osdirnames'   : ['../$(shell basename $(base_libdir))'] * 3,
+        },
+        'gcc/config/rs6000/t-linux64' : {
+            'options'      : ['m64/m32 msoft-float'],
+            'dirnames'     : ['.'] * 3,
+            'osdirnames'   : ['../$(shell basename $(base_libdir))'] * 3,
+        },
+    }
+
+    multilibs = (d.getVar('MULTILIB_VARIANTS', True) or "").split()
+    default_ml = False if multilibs else True
+
+    mlvariant = False
+    mlindex = 0
+    pn = d.getVar('PN', True)
+    for ml in multilibs:
+        if pn.startswith(ml):
+            mlvariant = True
+            break
+        mlindex += 1
+
+    target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlvariant
+                    else d.getVar('TARGET_ARCH', True))
+
+    if target_arch not in gcc_target_config_files:
+        if multilibs:
+            bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
+        default_ml = True
+
+    libdir32 = 'SYSTEMLIBS_DIR'
+    libdir64 = 'SYSTEMLIBS_DIR'
+    libdirx32 = 'SYSTEMLIBS_DIR'
+    libdirn32 = 'SYSTEMLIBS_DIR'
+
+    if default_ml:
+        for fn in default_ml_config:
+            write_config([fn],
+                default_ml_config[fn]['options'],
+                default_ml_config[fn]['dirnames'],
+                default_ml_config[fn]['osdirnames'])
+
+        write_headers([item for sublist in gcc_header_config_files.values()
+                            for item in sublist],
+                    libdir32, libdir64, libdirx32, libdirn32)
+        return
+
+    target_config_files = gcc_target_config_files[target_arch]
+    header_config_files = gcc_header_config_files[target_arch]
+    ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlvariant else 'DEFAULTTUNE']
+
+    mltunes = ['DEFAULTTUNE_virtclass-multilib-%s' % ml for ml in multilibs]
+    if multilibs:
+        if mlvariant:
+            ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
+        else:
+            ml_list.extend(mltunes)
+
+    options = []
+    dirnames = []
+    osdirnames = []
+
+    for ml in ml_list:
+        tune = d.getVar(ml, True)
+        if not tune:
+            bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
+            continue
+        tune_parameters = get_tune_parameters(tune, d)
+
+        tune_baselib = tune_parameters['baselib']
+        if not tune_baselib:
+            bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
+            continue
+
+        if tune_baselib == 'lib64':
+            libdir64 = tune_baselib
+        elif tune_baselib == 'libx32':
+            libdirx32 = tune_baselib
+        elif tune_baselib == 'lib32':
+            libdirn32 = tune_baselib
+        elif tune_baselib == 'lib':
+            libdir32 = tune_baselib
+        else:
+            bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
+
+        # take out '-' in parameters
+        options.append(re.sub(r' +\-+', ' ', re.sub(r'^ *\-+', '', tune_parameters['ccargs'])))
+        if tune_baselib == 'lib':
+            dirnames.append('32')  # /lib => 32bit lib
+        else:
+            dirnames.append(tune_baselib.replace('lib', ''))
+        osdirnames.append('../' + tune_baselib)
+
+    write_config(target_config_files, options, dirnames, osdirnames)
+    write_headers(header_config_files, libdir32, libdir64, libdirx32, libdirn32)
+}
diff --git a/meta/recipes-devtools/gcc/libgcc_4.7.bb b/meta/recipes-devtools/gcc/libgcc_4.7.bb
index 5eaa515..c17c78a 100644
--- a/meta/recipes-devtools/gcc/libgcc_4.7.bb
+++ b/meta/recipes-devtools/gcc/libgcc_4.7.bb
@@ -15,6 +15,10 @@ FILES_${PN} = "${base_libdir}/libgcc*.so.*"
 FILES_${PN}-dev = " \
   ${base_libdir}/libgcc*.so \
   ${libdir}/${TARGET_SYS}/${BINV}/*crt* \
+  ${libdir}/${TARGET_SYS}/${BINV}/64 \
+  ${libdir}/${TARGET_SYS}/${BINV}/32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/x32 \
+  ${libdir}/${TARGET_SYS}/${BINV}/n32 \
   ${libdir}/${TARGET_SYS}/${BINV}/libgcc*"
 FILES_libgcov-dev = " \
   ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \
@@ -70,3 +74,43 @@ BBCLASSEXTEND = "nativesdk"
 
 INSANE_SKIP_${PN}-dev = "staticdev"
 INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev"
+
+addtask multilib_install after do_install before do_package
+# this makes multilib gcc files findable for target gcc
+# e.g.
+#    /usr/lib/i586-pokymllib32-linux/4.7/
+# by creating this symlink to it
+#    /usr/lib64/x86_64-poky-linux/4.7/32
+
+python do_multilib_install() {
+    import re
+    # do this only for multilib extended recipe
+    if d.getVar('PN', True) != 'libgcc':
+        return
+
+    multilibs = d.getVar('MULTILIB_VARIANTS', True) or ''
+    if multilibs == '':
+        return
+
+    binv = d.getVar('BINV', True) or ''
+
+    for ml in multilibs.split(' '):
+        tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True) or ''
+        tune_parameters = get_tune_parameters(tune, d)
+        tune_baselib = tune_parameters['baselib']
+        tune_arch = tune_parameters['arch']
+        tune_bitness = tune_baselib.replace('lib', '')
+        if tune_bitness == '' :
+            tune_bitness = '32' # /lib => 32bit lib
+
+        src = '../../../' + tune_baselib + '/' + \
+            tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \
+            '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/'
+
+        dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \
+            d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness
+
+        if os.path.lexists(dest):
+            os.unlink(dest)
+        os.symlink(src, dest)
+}
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/6] tune-mips32: add BASE_LIB to mips32 tunes
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
                   ` (3 preceding siblings ...)
  2013-01-14 15:16 ` [PATCH v2 4/6] gcc: enable multilib for target gcc Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-14 15:16 ` [PATCH v2 6/6] tune-ppc603e: add BASE_LIB Constantin Musca
  2013-01-15  7:40 ` [PATCH v2 0/6] On-target multilib gcc enhacement Saul Wold
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/conf/machine/include/tune-mips32.inc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/conf/machine/include/tune-mips32.inc b/meta/conf/machine/include/tune-mips32.inc
index 03cd411..ffbaecf 100644
--- a/meta/conf/machine/include/tune-mips32.inc
+++ b/meta/conf/machine/include/tune-mips32.inc
@@ -9,17 +9,21 @@ TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "mips32", "-march=mips32",
 AVAILTUNES += "mips32 mips32el mips32-nf mips32el-nf"
 
 TUNE_FEATURES_tune-mips32 = "${TUNE_FEATURES_tune-mips} mips32"
+BASE_LIB_tune-mips32 = "lib"
 MIPSPKGSFX_VARIANT_tune-mips32 = "mips32"
 PACKAGE_EXTRA_ARCHS_tune-mips32 = "mips mips32"
 
 TUNE_FEATURES_tune-mips32el = "${TUNE_FEATURES_tune-mipsel} mips32"
+BASE_LIB_tune-mips32el = "lib"
 MIPSPKGSFX_VARIANT_tune-mips32el = "mips32el"
 PACKAGE_EXTRA_ARCHS_tune-mips32el = "mipsel mips32el"
 
 TUNE_FEATURES_tune-mips32-nf = "${TUNE_FEATURES_tune-mips-nf} mips32"
+BASE_LIB_tune-mips32-nf = "lib"
 MIPSPKGSFX_VARIANT_tune-mips32-nf = "mips32"
 PACKAGE_EXTRA_ARCHS_tune-mips32-nf = "mips-nf mips32-nf"
 
 TUNE_FEATURES_tune-mips32el-nf = "${TUNE_FEATURES_tune-mipsel-nf} mips32"
+BASE_LIB_tune-mips32el-nf = "lib"
 MIPSPKGSFX_VARIANT_tune-mips32el-nf = "mips32el"
 PACKAGE_EXTRA_ARCHS_tune-mips32el-nf = "mipsel-nf mips32el-nf"
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 6/6] tune-ppc603e: add BASE_LIB
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
                   ` (4 preceding siblings ...)
  2013-01-14 15:16 ` [PATCH v2 5/6] tune-mips32: add BASE_LIB to mips32 tunes Constantin Musca
@ 2013-01-14 15:16 ` Constantin Musca
  2013-01-15  7:40 ` [PATCH v2 0/6] On-target multilib gcc enhacement Saul Wold
  6 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-14 15:16 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
---
 meta/conf/machine/include/tune-ppc603e.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/conf/machine/include/tune-ppc603e.inc b/meta/conf/machine/include/tune-ppc603e.inc
index 6557c1d..2cfd342 100644
--- a/meta/conf/machine/include/tune-ppc603e.inc
+++ b/meta/conf/machine/include/tune-ppc603e.inc
@@ -7,6 +7,7 @@ TUNE_CCARGS += "${@bb.utils.contains("TUNE_FEATURES", "ppc603e", "-mcpu=603e", "
 
 AVAILTUNES += "ppc603e"
 TUNE_FEATURES_tune-ppc603e = "m32 fpu-hard ppc603e"
+BASE_LIB_tune-ppc603e = "lib"
 TUNE_PKGARCH_tune-ppc603e = "ppc603e"
 PACKAGE_EXTRA_ARCHS_tune-ppc603e = "${PACKAGE_EXTRA_ARCHS_tune-powerpc} ppc603e"
 
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/6] On-target multilib gcc enhacement
  2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
                   ` (5 preceding siblings ...)
  2013-01-14 15:16 ` [PATCH v2 6/6] tune-ppc603e: add BASE_LIB Constantin Musca
@ 2013-01-15  7:40 ` Saul Wold
  2013-01-15  9:13   ` Constantin Musca
  6 siblings, 1 reply; 9+ messages in thread
From: Saul Wold @ 2013-01-15  7:40 UTC (permalink / raw)
  To: Constantin Musca; +Cc: openembedded-core

On 01/14/2013 07:16 AM, Constantin Musca wrote:
> This patchset enables the user to build gcc with configurable multilib options.
> The following changes since commit 53cc748b93e8af584557d6db5309c3e955182c5c:
>
>    linux-libc-headers: fix headers install in long path name environments (2013-01-10 23:53:51 +0000)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib cmuscax/gcc_enhan3
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=cmuscax/gcc_enhan3
>
> Constantin Musca (6):
>    gcc: add missing dependency (zlib)
>    gcc: remove the 64bithack patch
>    multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME
>    gcc: enable multilib for target gcc
>    tune-mips32: add BASE_LIB to mips32 tunes
>    tune-ppc603e: add BASE_LIB
>
This patch set caused a number of failures on the Autobuilder today. 
please check the AB results.

Thanks

	Sau!

>   meta/conf/machine/include/tune-mips32.inc          |   4 +
>   meta/conf/machine/include/tune-ppc603e.inc         |   1 +
>   meta/conf/multilib.conf                            |   2 +-
>   meta/recipes-devtools/gcc/gcc-4.7.inc              |   5 +-
>   meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch  |  63 -------
>   meta/recipes-devtools/gcc/gcc-common.inc           |  25 +++
>   meta/recipes-devtools/gcc/gcc-configure-common.inc |   3 +-
>   meta/recipes-devtools/gcc/gcc-configure-target.inc |   1 +
>   meta/recipes-devtools/gcc/gcc-multilib-config.inc  | 200 +++++++++++++++++++++
>   meta/recipes-devtools/gcc/libgcc_4.7.bb            |  44 +++++
>   10 files changed, 280 insertions(+), 68 deletions(-)
>   delete mode 100644 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
>   create mode 100644 meta/recipes-devtools/gcc/gcc-multilib-config.inc
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/6] On-target multilib gcc enhacement
  2013-01-15  7:40 ` [PATCH v2 0/6] On-target multilib gcc enhacement Saul Wold
@ 2013-01-15  9:13   ` Constantin Musca
  0 siblings, 0 replies; 9+ messages in thread
From: Constantin Musca @ 2013-01-15  9:13 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core

On 01/15/2013 09:40 AM, Saul Wold wrote:
> On 01/14/2013 07:16 AM, Constantin Musca wrote:
>> This patchset enables the user to build gcc with configurable 
>> multilib options.
>> The following changes since commit 
>> 53cc748b93e8af584557d6db5309c3e955182c5c:
>>
>>    linux-libc-headers: fix headers install in long path name 
>> environments (2013-01-10 23:53:51 +0000)
>>
>> are available in the git repository at:
>>
>>    git://git.pokylinux.org/poky-contrib cmuscax/gcc_enhan3
>> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=cmuscax/gcc_enhan3
>>
>> Constantin Musca (6):
>>    gcc: add missing dependency (zlib)
>>    gcc: remove the 64bithack patch
>>    multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME
>>    gcc: enable multilib for target gcc
>>    tune-mips32: add BASE_LIB to mips32 tunes
>>    tune-ppc603e: add BASE_LIB
>>
> This patch set caused a number of failures on the Autobuilder today. 
> please check the AB results.
>
> Thanks
>
>     Sau!
The re.sub flags argument doesn't exist in python 2.6 or in a lower 
version. Should I adapt my patch for 2.6 or do we need to update
python on the AB systems ?

Cheers,
Constantin
>
>> meta/conf/machine/include/tune-mips32.inc          |   4 +
>>   meta/conf/machine/include/tune-ppc603e.inc         |   1 +
>>   meta/conf/multilib.conf                            |   2 +-
>>   meta/recipes-devtools/gcc/gcc-4.7.inc              |   5 +-
>>   meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch  |  63 -------
>>   meta/recipes-devtools/gcc/gcc-common.inc           |  25 +++
>>   meta/recipes-devtools/gcc/gcc-configure-common.inc |   3 +-
>>   meta/recipes-devtools/gcc/gcc-configure-target.inc |   1 +
>>   meta/recipes-devtools/gcc/gcc-multilib-config.inc  | 200 
>> +++++++++++++++++++++
>>   meta/recipes-devtools/gcc/libgcc_4.7.bb            |  44 +++++
>>   10 files changed, 280 insertions(+), 68 deletions(-)
>>   delete mode 100644 meta/recipes-devtools/gcc/gcc-4.7/64bithack.patch
>>   create mode 100644 meta/recipes-devtools/gcc/gcc-multilib-config.inc
>>




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-01-15  9:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 15:16 [PATCH v2 0/6] On-target multilib gcc enhacement Constantin Musca
2013-01-14 15:16 ` [PATCH v2 1/6] gcc: add missing dependency (zlib) Constantin Musca
2013-01-14 15:16 ` [PATCH v2 2/6] gcc: remove the 64bithack patch Constantin Musca
2013-01-14 15:16 ` [PATCH v2 3/6] multilib.conf: add TARGET_ARCH to MULTILIB_SAVE_VARNAME Constantin Musca
2013-01-14 15:16 ` [PATCH v2 4/6] gcc: enable multilib for target gcc Constantin Musca
2013-01-14 15:16 ` [PATCH v2 5/6] tune-mips32: add BASE_LIB to mips32 tunes Constantin Musca
2013-01-14 15:16 ` [PATCH v2 6/6] tune-ppc603e: add BASE_LIB Constantin Musca
2013-01-15  7:40 ` [PATCH v2 0/6] On-target multilib gcc enhacement Saul Wold
2013-01-15  9:13   ` Constantin Musca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox