From cd3d874fced2ee4c950d9964d30c0588fd8772e7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 28 Jul 2015 14:23:37 +0100 Subject: 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. Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-multilib-config.inc | 25 +++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'meta/recipes-devtools/gcc/gcc-multilib-config.inc') 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() { bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir)) bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path)) + pn = d.getVar('PN', True) multilibs = (d.getVar('MULTILIB_VARIANTS', True) or '').split() - if not multilibs: + if not multilibs and pn != "nativesdk-gcc": return mlprefix = d.getVar('MLPREFIX', True) - pn = d.getVar('PN', True) - if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')): + + if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc": return @@ -74,7 +75,7 @@ python gcc_multilib_setup() { def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32): def wrap_libdir(libdir): if libdir.find('SYSTEMLIBS_DIR') != -1: - return libdir + return '"%r"' else: return '"/%s/"' % libdir @@ -135,17 +136,23 @@ python gcc_multilib_setup() { 'powerpc64' : ['gcc/config/rs6000/linux64.h'], } + libdir32 = 'SYSTEMLIBS_DIR' + libdir64 = 'SYSTEMLIBS_DIR' + libdirx32 = 'SYSTEMLIBS_DIR' + libdirn32 = 'SYSTEMLIBS_DIR' + + target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL', True) if mlprefix else d.getVar('TARGET_ARCH', True)) + if pn == "nativesdk-gcc": + header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH", True)] + write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32) + return + if target_arch not in gcc_target_config_files: bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch) return - libdir32 = 'SYSTEMLIBS_DIR' - libdir64 = 'SYSTEMLIBS_DIR' - libdirx32 = 'SYSTEMLIBS_DIR' - libdirn32 = 'SYSTEMLIBS_DIR' - target_config_files = gcc_target_config_files[target_arch] header_config_files = gcc_header_config_files[target_arch] -- cgit 1.2.3-korg