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/gcc/libgcc_4.7.bb | |
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/gcc/libgcc_4.7.bb')
-rw-r--r-- | meta/recipes-devtools/gcc/libgcc_4.7.bb | 73 |
1 files changed, 73 insertions, 0 deletions
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 | } | ||