diff options
author | Constantin Musca <constantinx.musca@intel.com> | 2012-12-17 13:46:20 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-01 15:54:31 +0000 |
commit | 703b70c98a86771a891b46382f3ee20c4ef93f39 (patch) | |
tree | b4a64935644ce22b6f58d47e3dea56c0ee38af90 /meta/recipes-devtools | |
parent | 62285873e2a6b9375a96a3de7a500205aeb18fb3 (diff) | |
download | poky-703b70c98a86771a891b46382f3ee20c4ef93f39.tar.gz |
gcc: enable multilib for target gcc
- add a task to setup multilib configuration for target gcc
- this commit adapts Nitin Kamble's work to gcc 4.7
- use a hash for storing arch-dependent multilib options
- patch gcc in order to use the multilib config files from the
build directory
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]
(From OE-Core rev: b26819c85881e82ee1b5c68840011e78c321f18e)
Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.7.inc | 3 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch | 87 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-common.inc | 24 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-configure-common.inc | 3 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-configure-target.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-multilib-config.inc | 190 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/libgcc_4.7.bb | 73 |
7 files changed, 379 insertions, 2 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.7.inc b/meta/recipes-devtools/gcc/gcc-4.7.inc index 2548f84087..d4caf619a7 100644 --- a/meta/recipes-devtools/gcc/gcc-4.7.inc +++ b/meta/recipes-devtools/gcc/gcc-4.7.inc | |||
@@ -1,6 +1,6 @@ | |||
1 | require gcc-common.inc | 1 | require gcc-common.inc |
2 | 2 | ||
3 | PR = "r14" | 3 | PR = "r15" |
4 | 4 | ||
5 | # Third digit in PV should be incremented after a minor release | 5 | # Third digit in PV should be incremented after a minor release |
6 | # happens from this branch on gcc e.g. currently its 4.7.1 | 6 | # happens from this branch on gcc e.g. currently its 4.7.1 |
@@ -74,6 +74,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \ | |||
74 | file://ppc_no_crtsavres.patch \ | 74 | file://ppc_no_crtsavres.patch \ |
75 | file://0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch \ | 75 | file://0001-crtstuff.c-USE_PT_GNU_EH_FRAME-Define-for-systems-us.patch \ |
76 | file://0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch \ | 76 | file://0001-Makefile.in-vis_hide-gen-hide-list-Do-not-make-defin.patch \ |
77 | file://use-ml-conf-files-from-B.patch \ | ||
77 | " | 78 | " |
78 | SRC_URI[md5sum] = "cc308a0891e778cfda7a151ab8a6e762" | 79 | SRC_URI[md5sum] = "cc308a0891e778cfda7a151ab8a6e762" |
79 | SRC_URI[sha256sum] = "8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084" | 80 | SRC_URI[sha256sum] = "8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084" |
diff --git a/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch b/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch new file mode 100644 index 0000000000..4d229247a4 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.7/use-ml-conf-files-from-B.patch | |||
@@ -0,0 +1,87 @@ | |||
1 | Use the multilib config files from ${B} instead of using the ones from ${S} | ||
2 | so that the source can be shared between gcc-cross-initial, | ||
3 | gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build. | ||
4 | |||
5 | Upstream-Status: Inappropriate [configuration] | ||
6 | Signed-off-by: Constantin Musca <constantinx.musca@intel.com> | ||
7 | |||
8 | Index: gcc-4.7.2/gcc/configure | ||
9 | =================================================================== | ||
10 | --- gcc-4.7.2.orig/gcc/configure | ||
11 | +++ gcc-4.7.2/gcc/configure | ||
12 | @@ -11717,10 +11717,20 @@ done | ||
13 | tmake_file_= | ||
14 | for f in ${tmake_file} | ||
15 | do | ||
16 | - if test -f ${srcdir}/config/$f | ||
17 | - then | ||
18 | - tmake_file_="${tmake_file_} \$(srcdir)/config/$f" | ||
19 | - fi | ||
20 | + case $f in | ||
21 | + */t-linux64 ) | ||
22 | + if test -f ./config/$f | ||
23 | + then | ||
24 | + tmake_file_="${tmake_file_} ./config/$f" | ||
25 | + fi | ||
26 | + ;; | ||
27 | + * ) | ||
28 | + if test -f ${srcdir}/config/$f | ||
29 | + then | ||
30 | + tmake_file_="${tmake_file_} \$(srcdir)/config/$f" | ||
31 | + fi | ||
32 | + ;; | ||
33 | + esac | ||
34 | done | ||
35 | tmake_file="${tmake_file_}" | ||
36 | |||
37 | @@ -11731,6 +11741,10 @@ tm_file_list="options.h" | ||
38 | tm_include_list="options.h insn-constants.h" | ||
39 | for f in $tm_file; do | ||
40 | case $f in | ||
41 | + */linux64.h ) | ||
42 | + tm_file_list="${tm_file_list} ./config/$f" | ||
43 | + tm_include_list="${tm_include_list} ./config/$f" | ||
44 | + ;; | ||
45 | ./* ) | ||
46 | f=`echo $f | sed 's/^..//'` | ||
47 | tm_file_list="${tm_file_list} $f" | ||
48 | Index: gcc-4.7.2/gcc/configure.ac | ||
49 | =================================================================== | ||
50 | --- gcc-4.7.2.orig/gcc/configure.ac | ||
51 | +++ gcc-4.7.2/gcc/configure.ac | ||
52 | @@ -1701,10 +1701,20 @@ done | ||
53 | tmake_file_= | ||
54 | for f in ${tmake_file} | ||
55 | do | ||
56 | - if test -f ${srcdir}/config/$f | ||
57 | - then | ||
58 | - tmake_file_="${tmake_file_} \$(srcdir)/config/$f" | ||
59 | - fi | ||
60 | + case $f in | ||
61 | + */t-linux64 ) | ||
62 | + if test -f ./config/$f | ||
63 | + then | ||
64 | + tmake_file_="${tmake_file_} ./config/$f" | ||
65 | + fi | ||
66 | + ;; | ||
67 | + * ) | ||
68 | + if test -f ${srcdir}/config/$f | ||
69 | + then | ||
70 | + tmake_file_="${tmake_file_} \$(srcdir)/config/$f" | ||
71 | + fi | ||
72 | + ;; | ||
73 | + esac | ||
74 | done | ||
75 | tmake_file="${tmake_file_}" | ||
76 | |||
77 | @@ -1715,6 +1725,10 @@ tm_file_list="options.h" | ||
78 | tm_include_list="options.h insn-constants.h" | ||
79 | for f in $tm_file; do | ||
80 | case $f in | ||
81 | + */linux64.h ) | ||
82 | + tm_file_list="${tm_file_list} ./config/$f" | ||
83 | + tm_include_list="${tm_include_list} ./config/$f" | ||
84 | + ;; | ||
85 | ./* ) | ||
86 | f=`echo $f | sed 's/^..//'` | ||
87 | tm_file_list="${tm_file_list} $f" | ||
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index 6e64441c3d..ad96989573 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc | |||
@@ -34,6 +34,30 @@ def get_gcc_multiarch_setting(bb, d): | |||
34 | return multiarch_options[target_arch] | 34 | return multiarch_options[target_arch] |
35 | return "" | 35 | return "" |
36 | 36 | ||
37 | # this is used by the multilib setup of gcc | ||
38 | def get_tune_parameters(tune, d): | ||
39 | availtunes = d.getVar('AVAILTUNES', True) | ||
40 | if tune not in availtunes.split(): | ||
41 | bb.error('The tune: %s is not one of the available tunes: %s', tune, availtunes) | ||
42 | |||
43 | localdata = bb.data.createCopy(d) | ||
44 | override = ':tune-' + tune | ||
45 | localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override) | ||
46 | bb.data.update_data(localdata) | ||
47 | |||
48 | retdict = {} | ||
49 | retdict['tune'] = tune | ||
50 | retdict['ccargs'] = localdata.getVar('TUNE_CCARGS', True) | ||
51 | retdict['features'] = localdata.getVar('TUNE_FEATURES', True) | ||
52 | # BASELIB is used by the multilib code to change library paths | ||
53 | retdict['baselib'] = localdata.getVar('BASE_LIB', True) or localdata.getVar('BASELIB', True) | ||
54 | retdict['arch'] = localdata.getVar('TUNE_ARCH', True) | ||
55 | retdict['abiextension'] = localdata.getVar('ABIEXTENSION', True) | ||
56 | retdict['target_fpu'] = localdata.getVar('TARGET_FPU', True) | ||
57 | retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH', True) | ||
58 | retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS', True) | ||
59 | return retdict | ||
60 | |||
37 | # We really need HOST_SYS here for some packages and TARGET_SYS for others. | 61 | # We really need HOST_SYS here for some packages and TARGET_SYS for others. |
38 | # For now, libgcc is most important so we fix for that - RP. | 62 | # For now, libgcc is most important so we fix for that - RP. |
39 | SHLIBSDIR = "${STAGING_DIR_TARGET}/shlibs" | 63 | 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 4eb59fd583..b87ea62570 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc | |||
@@ -1,3 +1,4 @@ | |||
1 | require gcc-multilib-config.inc | ||
1 | # | 2 | # |
2 | # Build the list of lanaguages to build. | 3 | # Build the list of lanaguages to build. |
3 | # | 4 | # |
@@ -25,7 +26,7 @@ EXTRA_OECONF_PATHS ?= "" | |||
25 | EXTRA_OECONF_INITIAL ?= "" | 26 | EXTRA_OECONF_INITIAL ?= "" |
26 | EXTRA_OECONF_INTERMEDIATE ?= "" | 27 | EXTRA_OECONF_INTERMEDIATE ?= "" |
27 | 28 | ||
28 | GCCMULTILIB = "--disable-multilib" | 29 | GCCMULTILIB ?= "--disable-multilib" |
29 | GCCTHREADS ?= "posix" | 30 | GCCTHREADS ?= "posix" |
30 | 31 | ||
31 | EXTRA_OECONF = "${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \ | 32 | 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 f41301f2fe..6cc374b76d 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-target.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-target.inc | |||
@@ -1,3 +1,4 @@ | |||
1 | GCCMULTILIB = "--enable-multilib" | ||
1 | require gcc-configure-common.inc | 2 | require gcc-configure-common.inc |
2 | 3 | ||
3 | EXTRA_OECONF_PATHS = " \ | 4 | 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 0000000000..9403aab0bd --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc | |||
@@ -0,0 +1,190 @@ | |||
1 | # following code modifies these definitions in the gcc config | ||
2 | # MULTILIB_OPTIONS | ||
3 | # MULTILIB_DIRNAMES | ||
4 | # MULTILIB_OSDIRNAMES | ||
5 | # GLIBC_DYNAMIC_LINKER32 | ||
6 | # GLIBC_DYNAMIC_LINKER64 | ||
7 | # GLIBC_DYNAMIC_LINKERX32 | ||
8 | # GLIBC_DYNAMIC_LINKERN32 | ||
9 | # For more information on use of these variables look at these files in the gcc source code | ||
10 | # gcc/config/i386/t-linux64 | ||
11 | # gcc/config/mips/t-linux64 | ||
12 | # gcc/config/rs6000/t-linux64 | ||
13 | # gcc/config/i386/linux64.h | ||
14 | # gcc/config/mips/linux64.h | ||
15 | # gcc/config/rs6000/linux64.h | ||
16 | |||
17 | python gcc_multilib_setup() { | ||
18 | import re | ||
19 | import shutil | ||
20 | import glob | ||
21 | |||
22 | srcdir = d.getVar('S', True) | ||
23 | builddir = d.getVar('B', True) | ||
24 | src_conf_dir = '%s/gcc/config' % srcdir | ||
25 | build_conf_dir = '%s/gcc/config' % builddir | ||
26 | |||
27 | bb.utils.remove(build_conf_dir, True) | ||
28 | ml_globs = ('%s/*/t-linux64' % src_conf_dir, | ||
29 | '%s/*/linux64.h' % src_conf_dir) | ||
30 | |||
31 | # copy the target multilib config files to ${B} | ||
32 | for ml_glob in ml_globs: | ||
33 | for fn in glob.glob(ml_glob): | ||
34 | rel_path = os.path.relpath(fn, src_conf_dir) | ||
35 | parent_dir = os.path.dirname(rel_path) | ||
36 | bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir)) | ||
37 | bb.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path)) | ||
38 | |||
39 | multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split() | ||
40 | if not multilibs: | ||
41 | return | ||
42 | |||
43 | mlprefix = d.getVar('MLPREFIX', True) | ||
44 | if ('%sgcc' % mlprefix) != d.getVar('PN', True): | ||
45 | return | ||
46 | |||
47 | |||
48 | def write_config(root, files, options, dirnames, osdirnames): | ||
49 | for ml_conf_file in files: | ||
50 | with open(root + '/' + ml_conf_file, 'r') as f: | ||
51 | filelines = f.readlines() | ||
52 | # recreate multilib configuration variables | ||
53 | substs = [ | ||
54 | (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)), | ||
55 | (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''), | ||
56 | (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)), | ||
57 | (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''), | ||
58 | (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)), | ||
59 | (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''), | ||
60 | ] | ||
61 | |||
62 | for (i, line) in enumerate(filelines): | ||
63 | for subst in substs: | ||
64 | line = re.sub(subst[0], subst[1], line) | ||
65 | filelines[i] = line | ||
66 | |||
67 | with open(root + '/' + ml_conf_file, 'w') as f: | ||
68 | f.write(''.join(filelines)) | ||
69 | |||
70 | def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32): | ||
71 | def wrap_libdir(libdir): | ||
72 | if libdir.find('SYSTEMLIBS_DIR') != -1: | ||
73 | return libdir | ||
74 | else: | ||
75 | return '"/%s/"' % libdir | ||
76 | |||
77 | for ml_conf_file in files: | ||
78 | with open(root + '/' + ml_conf_file, 'r') as f: | ||
79 | filelines = f.readlines() | ||
80 | |||
81 | # replace lines like | ||
82 | # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2" | ||
83 | # by | ||
84 | # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2" | ||
85 | # this is needed to put the correct dynamic loader path in the generated binaries | ||
86 | substs = [ | ||
87 | (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$', | ||
88 | r'\1' + wrap_libdir(libdir32) + r'\3'), | ||
89 | (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$', | ||
90 | r'\1' + wrap_libdir(libdir64) + r'\3'), | ||
91 | (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$', | ||
92 | r'\1' + wrap_libdir(libdirx32) + r'\3'), | ||
93 | (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$', | ||
94 | r'\1' + wrap_libdir(libdirn32) + r'\3'), | ||
95 | ] | ||
96 | |||
97 | for (i, line) in enumerate(filelines): | ||
98 | for subst in substs: | ||
99 | line = re.sub(subst[0], subst[1], line) | ||
100 | filelines[i] = line | ||
101 | |||
102 | with open(root + '/' + ml_conf_file, 'w') as f: | ||
103 | f.write(''.join(filelines)) | ||
104 | |||
105 | |||
106 | gcc_target_config_files = { | ||
107 | 'x86_64' : ['gcc/config/i386/t-linux64'], | ||
108 | 'i586' : ['gcc/config/i386/t-linux64'], | ||
109 | 'mips' : ['gcc/config/mips/t-linux64'], | ||
110 | 'powerpc' : ['gcc/config/rs6000/t-linux64'], | ||
111 | } | ||
112 | |||
113 | gcc_header_config_files = { | ||
114 | 'x86_64' : ['gcc/config/i386/linux64.h'], | ||
115 | 'i586' : ['gcc/config/i386/linux64.h'], | ||
116 | 'mips' : ['gcc/config/mips/linux64.h'], | ||
117 | 'powerpc' : ['gcc/config/rs6000/linux64.h'], | ||
118 | } | ||
119 | |||
120 | target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix | ||
121 | else d.getVar('TARGET_ARCH', True)) | ||
122 | if target_arch not in gcc_target_config_files: | ||
123 | bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch) | ||
124 | return | ||
125 | |||
126 | libdir32 = 'SYSTEMLIBS_DIR' | ||
127 | libdir64 = 'SYSTEMLIBS_DIR' | ||
128 | libdirx32 = 'SYSTEMLIBS_DIR' | ||
129 | libdirn32 = 'SYSTEMLIBS_DIR' | ||
130 | |||
131 | target_config_files = gcc_target_config_files[target_arch] | ||
132 | header_config_files = gcc_header_config_files[target_arch] | ||
133 | |||
134 | ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE'] | ||
135 | mltunes = [('DEFAULTTUNE_virtclass-multilib-%s' % ml) for ml in multilibs] | ||
136 | if mlprefix: | ||
137 | mlindex = 0 | ||
138 | for ml in multilibs: | ||
139 | if mlprefix.startswith(ml): | ||
140 | break | ||
141 | mlindex += 1 | ||
142 | |||
143 | ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):]) | ||
144 | else: | ||
145 | ml_list.extend(mltunes) | ||
146 | |||
147 | options = [] | ||
148 | dirnames = [] | ||
149 | osdirnames = [] | ||
150 | |||
151 | for ml in ml_list: | ||
152 | tune = d.getVar(ml, True) | ||
153 | if not tune: | ||
154 | bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml) | ||
155 | continue | ||
156 | tune_parameters = get_tune_parameters(tune, d) | ||
157 | |||
158 | tune_baselib = tune_parameters['baselib'] | ||
159 | if not tune_baselib: | ||
160 | bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune) | ||
161 | continue | ||
162 | |||
163 | if tune_baselib == 'lib64': | ||
164 | libdir64 = tune_baselib | ||
165 | elif tune_baselib == 'libx32': | ||
166 | libdirx32 = tune_baselib | ||
167 | elif tune_baselib == 'lib32': | ||
168 | libdirn32 = tune_baselib | ||
169 | elif tune_baselib == 'lib': | ||
170 | libdir32 = tune_baselib | ||
171 | else: | ||
172 | bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune)) | ||
173 | |||
174 | # take out '-' and march='s from parameters | ||
175 | options.append(re.sub(r'march=[^ ]+ *', '', | ||
176 | re.sub(r' +\-+', ' ', | ||
177 | re.sub(r'^ *\-+', '', tune_parameters['ccargs'])))) | ||
178 | if tune_baselib == 'lib': | ||
179 | dirnames.append('32') # /lib => 32bit lib | ||
180 | else: | ||
181 | dirnames.append(tune_baselib.replace('lib', '')) | ||
182 | osdirnames.append('../' + tune_baselib) | ||
183 | |||
184 | write_config(builddir, target_config_files, options, dirnames, osdirnames) | ||
185 | write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32) | ||
186 | } | ||
187 | |||
188 | gcc_multilib_setup[cleandirs] = "${B}/gcc/config" | ||
189 | |||
190 | EXTRACONFFUNCS += "gcc_multilib_setup" | ||
diff --git a/meta/recipes-devtools/gcc/libgcc_4.7.bb b/meta/recipes-devtools/gcc/libgcc_4.7.bb index c12aeefa25..550a3c9c9d 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.*" | |||
15 | FILES_${PN}-dev = " \ | 15 | FILES_${PN}-dev = " \ |
16 | ${base_libdir}/libgcc*.so \ | 16 | ${base_libdir}/libgcc*.so \ |
17 | ${libdir}/${TARGET_SYS}/${BINV}/*crt* \ | 17 | ${libdir}/${TARGET_SYS}/${BINV}/*crt* \ |
18 | ${libdir}/${TARGET_SYS}/${BINV}/64 \ | ||
19 | ${libdir}/${TARGET_SYS}/${BINV}/32 \ | ||
20 | ${libdir}/${TARGET_SYS}/${BINV}/x32 \ | ||
21 | ${libdir}/${TARGET_SYS}/${BINV}/n32 \ | ||
18 | ${libdir}/${TARGET_SYS}/${BINV}/libgcc*" | 22 | ${libdir}/${TARGET_SYS}/${BINV}/libgcc*" |
19 | FILES_libgcov-dev = " \ | 23 | FILES_libgcov-dev = " \ |
20 | ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \ | 24 | ${libdir}/${TARGET_SYS}/${BINV}/libgcov.a \ |
@@ -70,3 +74,72 @@ BBCLASSEXTEND = "nativesdk" | |||
70 | 74 | ||
71 | INSANE_SKIP_${PN}-dev = "staticdev" | 75 | INSANE_SKIP_${PN}-dev = "staticdev" |
72 | INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev" | 76 | INSANE_SKIP_${MLPREFIX}libgcov-dev = "staticdev" |
77 | |||
78 | addtask multilib_install after do_install before do_package do_populate_sysroot | ||
79 | # this makes multilib gcc files findable for target gcc | ||
80 | # e.g. | ||
81 | # /usr/lib/i586-pokymllib32-linux/4.7/ | ||
82 | # by creating this symlink to it | ||
83 | # /usr/lib64/x86_64-poky-linux/4.7/32 | ||
84 | |||
85 | python do_multilib_install() { | ||
86 | import re | ||
87 | |||
88 | multilibs = d.getVar('MULTILIB_VARIANTS', True) | ||
89 | if not multilibs: | ||
90 | return | ||
91 | |||
92 | binv = d.getVar('BINV', True) | ||
93 | |||
94 | mlprefix = d.getVar('MLPREFIX', True) | ||
95 | if ('%slibgcc' % mlprefix) != d.getVar('PN', True): | ||
96 | return | ||
97 | |||
98 | if mlprefix: | ||
99 | orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL', True) | ||
100 | orig_tune_params = get_tune_parameters(orig_tune, d) | ||
101 | orig_tune_baselib = orig_tune_params['baselib'] | ||
102 | orig_tune_bitness = orig_tune_baselib.replace('lib', '') | ||
103 | if not orig_tune_bitness: | ||
104 | orig_tune_bitness = '32' | ||
105 | |||
106 | src = '../../../' + orig_tune_baselib + '/' + \ | ||
107 | d.getVar('TARGET_SYS_MULTILIB_ORIGINAL', True) + '/' + binv + '/' | ||
108 | |||
109 | dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \ | ||
110 | d.getVar('TARGET_SYS', True) + '/' + binv + '/' + orig_tune_bitness | ||
111 | |||
112 | if os.path.lexists(dest): | ||
113 | os.unlink(dest) | ||
114 | os.symlink(src, dest) | ||
115 | return | ||
116 | |||
117 | |||
118 | for ml in multilibs.split(): | ||
119 | tune = d.getVar('DEFAULTTUNE_virtclass-multilib-' + ml, True) | ||
120 | if not tune: | ||
121 | bb.warn('DEFAULTTUNE_virtclass-multilib-%s is not defined. Skipping...' % ml) | ||
122 | continue | ||
123 | |||
124 | tune_parameters = get_tune_parameters(tune, d) | ||
125 | tune_baselib = tune_parameters['baselib'] | ||
126 | if not tune_baselib: | ||
127 | bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune) | ||
128 | continue | ||
129 | |||
130 | tune_arch = tune_parameters['arch'] | ||
131 | tune_bitness = tune_baselib.replace('lib', '') | ||
132 | if not tune_bitness: | ||
133 | tune_bitness = '32' # /lib => 32bit lib | ||
134 | |||
135 | src = '../../../' + tune_baselib + '/' + \ | ||
136 | tune_arch + d.getVar('TARGET_VENDOR', True) + 'ml' + ml + \ | ||
137 | '-' + d.getVar('TARGET_OS', True) + '/' + binv + '/' | ||
138 | |||
139 | dest = d.getVar('D', True) + d.getVar('libdir', True) + '/' + \ | ||
140 | d.getVar('TARGET_SYS', True) + '/' + binv + '/' + tune_bitness | ||
141 | |||
142 | if os.path.lexists(dest): | ||
143 | os.unlink(dest) | ||
144 | os.symlink(src, dest) | ||
145 | } | ||