summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-multilib-config.inc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-28 14:23:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-31 10:32:37 +0100
commitdab511c36dc455d3ada0c058e20ac42c71e3c8b7 (patch)
tree0bd73809bebdaab8fa42c8024bfd594de3bb8b9f /meta/recipes-devtools/gcc/gcc-multilib-config.inc
parent3b7c38458856805588d552508de10944ed38d9f2 (diff)
downloadpoky-dab511c36dc455d3ada0c058e20ac42c71e3c8b7.tar.gz
gcc: Add support for nativesdk-gcc
Being able to build a nativesdk gcc is useful, particularly in cases where the host compiler may be of an incompatible version (or a 32 bit compiler is needed). Sadly, building nativesdk-gcc is not straight forward. We install nativesdk-gcc into a relocatable location and this means that its library locations can change. "Normal" sysroot support doesn't help in this case since the values of paths like "libdir" change, not just base root directory of the system. In order to handle this we do two things: a) Add %r into spec file markup which can be used for injected paths such as SYSTEMLIBS_DIR (see gcc_multilib_setup()). b) Add other paths which need relocation into a .gccrelocprefix section which the relocation code will notice and adjust automatically. This patch adds tweaks to the relocation script to handle the new section too. (From OE-Core rev: cd3d874fced2ee4c950d9964d30c0588fd8772e7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-multilib-config.inc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-multilib-config.inc25
1 files changed, 16 insertions, 9 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
index dcd08190b1..8c07c2d5f8 100644
--- a/meta/recipes-devtools/gcc/gcc-multilib-config.inc
+++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -39,13 +39,14 @@ python gcc_multilib_setup() {
39 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir)) 39 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
40 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path)) 40 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
41 41
42 pn = d.getVar('PN', True)
42 multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split() 43 multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split()
43 if not multilibs: 44 if not multilibs and pn != "nativesdk-gcc":
44 return 45 return
45 46
46 mlprefix = d.getVar('MLPREFIX', True) 47 mlprefix = d.getVar('MLPREFIX', True)
47 pn = d.getVar('PN', True) 48
48 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')): 49 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc":
49 return 50 return
50 51
51 52
@@ -74,7 +75,7 @@ python gcc_multilib_setup() {
74 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32): 75 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
75 def wrap_libdir(libdir): 76 def wrap_libdir(libdir):
76 if libdir.find('SYSTEMLIBS_DIR') != -1: 77 if libdir.find('SYSTEMLIBS_DIR') != -1:
77 return libdir 78 return '"%r"'
78 else: 79 else:
79 return '"/%s/"' % libdir 80 return '"/%s/"' % libdir
80 81
@@ -135,17 +136,23 @@ python gcc_multilib_setup() {
135 'powerpc64' : ['gcc/config/rs6000/linux64.h'], 136 'powerpc64' : ['gcc/config/rs6000/linux64.h'],
136 } 137 }
137 138
139 libdir32 = 'SYSTEMLIBS_DIR'
140 libdir64 = 'SYSTEMLIBS_DIR'
141 libdirx32 = 'SYSTEMLIBS_DIR'
142 libdirn32 = 'SYSTEMLIBS_DIR'
143
144
138 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix 145 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix
139 else d.getVar('TARGET_ARCH', True)) 146 else d.getVar('TARGET_ARCH', True))
147 if pn == "nativesdk-gcc":
148 header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH", True)]
149 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
150 return
151
140 if target_arch not in gcc_target_config_files: 152 if target_arch not in gcc_target_config_files:
141 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch) 153 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
142 return 154 return
143 155
144 libdir32 = 'SYSTEMLIBS_DIR'
145 libdir64 = 'SYSTEMLIBS_DIR'
146 libdirx32 = 'SYSTEMLIBS_DIR'
147 libdirn32 = 'SYSTEMLIBS_DIR'
148
149 target_config_files = gcc_target_config_files[target_arch] 156 target_config_files = gcc_target_config_files[target_arch]
150 header_config_files = gcc_header_config_files[target_arch] 157 header_config_files = gcc_header_config_files[target_arch]
151 158