diff options
author | Daniel McGregor <daniel.mcgregor@vecima.com> | 2022-09-28 16:13:19 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-29 21:15:50 +0100 |
commit | beea1db008dc668185c71703cd9a3ef7d0b768f4 (patch) | |
tree | b71744dea586021280ff636c78664c6176da0979 /meta/recipes-devtools/gcc/gcc-common.inc | |
parent | 92527cdb76fb858ae63c7178258da35f779a2086 (diff) | |
download | poky-beea1db008dc668185c71703cd9a3ef7d0b768f4.tar.gz |
gcc: set the default target arch
The default x86-64 architecture for target gcc (ie, the one in poky
build appliances) is native. Since we have a variety of build systems
it will occasionally produce instructions that don't work on all of
our development system.
Instead, set gcc's default architecture to the one specified in
TUNE_CC_ARCH, that guarantees that gcc-runtime and any binaries
produced are compatible with the target machine type.
(From OE-Core rev: 52b952e474e655f8b4b6501813d57e20c9f02ba2)
Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-common.inc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-common.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index 2abc0e355d..d3b36937bf 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc | |||
@@ -32,6 +32,16 @@ def get_gcc_float_setting(bb, d): | |||
32 | 32 | ||
33 | get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" | 33 | get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}" |
34 | 34 | ||
35 | def get_gcc_x86_64_arch_setting(bb, d): | ||
36 | import re | ||
37 | march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS')) | ||
38 | if march: | ||
39 | return "--with-arch=%s " % march.group(1) | ||
40 | # The earliest supported x86-64 CPU | ||
41 | return "--with-arch=core2" | ||
42 | |||
43 | get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}" | ||
44 | |||
35 | def get_gcc_mips_plt_setting(bb, d): | 45 | def get_gcc_mips_plt_setting(bb, d): |
36 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): | 46 | if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): |
37 | return "--with-mips-plt" | 47 | return "--with-mips-plt" |