crosstool-ng/scripts/build
Alexey Brodkin 5c5b4df6d3 gcc: Fix canadian cross building on older hosts
GCC 11+ requires compiler being used to support C++11 standard [1].
And while GCC starting from 6.x has C++11 support enabled by default [2],
older versions need to be forced to implement it with "-std=gnu++11" and luckily
GCC's build-system takes care of that:

 1. For ${host} compiler - [1]
 2. For ${build} compiler - [3, 4]

In a nutshell the configure script tries a couple of options and the one which
helps to build a test source gets appended to CXX (not CXXFLAGS!),
so on say CentOS 7.x with GCC 4.8.5 during cross-compilation of GCC
CXX="x86_64-build_pc-linux-gnu-g++ -std=gnu++11". And all is good.

But in case of canadian cross due to [5] we for some reason* force set
CXX_FOR_BUILD with just a compiler name, effectively overriding all the
magic done by GCC's internals described above.

This leads to a compilation failures like that:
------------------------------------->8----------------------------------
[ALL  ]    In file included from /usr/include/c++/4.8.2/type_traits:35:0,
[ALL  ]                     from .../HOST-x86_64-apple-darwin14/arc-gcc11-elf/src/gcc/gcc/system.h:244,
[ALL  ]                     from .../HOST-x86_64-apple-darwin14/arc-gcc11-elf/src/gcc/gcc/gengtype.c:26:
[ERROR]    /usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
[ALL  ]     #error This file requires compiler and library support for the   ^
------------------------------------->8----------------------------------

* my guess that [5] was done because back in the day indeed we used to have
"--build=${CT_BUILD} --host=${CT_HOST}" in do_cc_core(). But now after [6]
this is no longer necessary as we use "--build=${CT_BUILD} --host=${CT_BUILD}"
and all is safe and clean. So yet another old quirk goes away - hooray!

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5329b59a2e13dabbe2038af0fe2e3cf5fc7f98ed
[2] https://gcc.gnu.org/gcc-6/changes.html
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96612
[4] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=7ffcf5d61174dda1f39a623e15f7e5d6b98bbafc
[5] 9c6c090d7b
[6] 08161250ed

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2021-09-06 23:21:21 -07:00
..
arch ARC: No more fiddling with uClibc's CONFIG_ARC_HAS_ATOMICS 2021-08-24 09:48:56 -07:00
binutils Add EXTRA_CXXFLAGS_FOR_BUILD option 2021-07-06 16:19:17 +01:00
cc gcc: Fix canadian cross building on older hosts 2021-09-06 23:21:21 -07:00
companion_libs gnuprumcu: Bump to v0.6.0 2021-08-22 18:08:13 +03:00
companion_tools m4: fix build for mingw32 host 2020-10-06 09:32:40 +02:00
debug gdb: Add gdb-10.2 2021-08-25 10:12:56 +12:00
kernel Add support for no-mmu microblaze 2021-08-25 17:36:47 +10:00
libc Fix build of older Glibc using GCC >=10 2021-06-24 00:58:32 -07:00
test_suite Fix the references to old config variables 2017-07-08 10:57:56 -07:00
arch.sh Add config flags for omitting 'arch' and 'vendor' 2018-12-10 01:10:01 -08:00
companion_libs.sh Build companion libs for target. 2015-11-13 10:24:22 -08:00
companion_tools.sh Some locations were missed while renaming kconfig symbols 2017-07-08 10:57:57 -07:00
debug.sh Some locations were missed while renaming kconfig symbols 2017-07-08 10:57:57 -07:00
internals.sh build/internals.sh: Handle pie executables 2019-09-14 22:21:11 +12:00
libc.sh Use "package ksym" when fetching/extracting 2018-12-14 18:50:51 -08:00
test_suite.sh Some locations were missed while renaming kconfig symbols 2017-07-08 10:57:57 -07:00