crosstool-ng/scripts
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
..
build gcc: Fix canadian cross building on older hosts 2021-09-06 23:21:21 -07:00
override Add checking for *sum and unzip 2018-04-29 12:06:54 -07:00
upgrade Move GDB build into a common backend function 2019-03-09 18:01:30 -08:00
compile WIP: autotoolization 2018-04-07 12:03:17 -07:00
config.guess Run through 'ct-ng updatetools' 2020-12-04 10:14:53 -06:00
config.rpath Use autoconfig-archve/automake tests 2018-04-07 12:02:33 -07:00
config.sub Run through 'ct-ng updatetools' 2020-12-04 10:14:53 -06:00
crosstool-NG.sh Add EXTRA_CXXFLAGS_FOR_BUILD option 2021-07-06 16:19:17 +01:00
depcomp WIP: autotoolization 2018-04-07 12:03:17 -07:00
functions Support common local patch directory 2021-07-14 00:07:30 +09:00
install-sh WIP: autotoolization 2018-04-07 12:03:17 -07:00
ltmain.sh WIP: autotoolization 2018-04-07 12:03:17 -07:00
missing WIP: autotoolization 2018-04-07 12:03:17 -07:00
populate.in Revert "Determine whether -E/-r option selects extended regexp" 2017-02-26 19:06:35 -08:00
saveSample.sh Support out-of-tree local builds 2018-04-07 14:39:56 -07:00
scripts.mk Fix installation of the license file 2018-11-12 01:19:04 -08:00
show-config.sh Use enhanced framework for 'ct-ng update-samples' 2019-02-09 15:55:16 -08:00
show-tuple.sh Support out-of-tree local builds 2018-04-07 14:39:56 -07:00
toolchain-config.in scripts: simplify and fix the toolchain config script 2011-08-19 00:52:05 +02:00
version-check.sh Use enhanced framework for 'ct-ng update-samples' 2019-02-09 15:55:16 -08:00
xldd.in Doc renames & issue template 2017-04-13 00:07:29 -07:00