summaryrefslogtreecommitdiff
path: root/scripts/build/cc
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-06-13 21:38:37 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2010-06-13 21:38:37 (GMT)
commit656dae57eb3a3594644049e2dcb4d0e5b32d73fd (patch)
tree1c9000f6931a4503c5ea1f22ab2924ee8eba0ddd /scripts/build/cc
parentb00d3ef516c0ef9312c05cf1ad552e0149c14142 (diff)
cc/gcc: baremetal requires a two-pass process
Here, we implement a highly ugly hack. I'm not proud of that one... To build the libstdc++ library, the compiler requires the C library. In case we build for non-baremetal, this is normally handled by the final step, later. But in the case of bare-metal, we never go through the final step (because it does not work, and it seems complex enough to make it work), so the baremetal compilers are issued out of the core step.
Diffstat (limited to 'scripts/build/cc')
-rw-r--r--scripts/build/cc/gcc.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 3669e1e..33fadbb 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -47,7 +47,7 @@ do_cc_core_pass_1() {
# In case we're not bare metal, and we're NPTL, build the static core gcc.
# In any other case, do nothing.
case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
- y,*,*) do_cc_core mode=baremetal build_libgcc=yes;;
+ y,*,*) do_cc_core mode=static;;
,y,*) ;;
,,nptl) do_cc_core mode=static;;
*) ;;
@@ -63,8 +63,8 @@ do_cc_core_pass_2() {
# In any other case, build the static core gcc and, if using gcc-4.3+,
# also build the target libgcc.
case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
- y,*,*) ;;
- ,y,*) ;;
+ y,*,*) do_cc_core mode=baremetal build_libgcc=yes build_libstdcxx=yes;;
+ ,y,*) ;;
,,nptl)
do_cc_core mode=shared build_libgcc=yes
;;
@@ -83,10 +83,12 @@ do_cc_core_pass_2() {
# with or without the target libgcc. We need to know wether:
# - we're building static, shared or bare metal: mode=[static|shared|baremetal]
# - we need to build libgcc or not : build_libgcc=[yes|no] (default: no)
+# - we need to build libstdc++ or not : build_libstdcxx=[yes|no] (default: no)
# Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no]
do_cc_core() {
local mode
local build_libgcc=no
+ local build_libstdcxx=no
local core_prefix_dir
local lang_opt
local tmp
@@ -106,7 +108,8 @@ do_cc_core() {
extra_config+=("--with-newlib")
extra_config+=("--enable-threads=no")
extra_config+=("--disable-shared")
- copy_headers=y
+ copy_headers=y # For baremetal, as there's no headers to copy,
+ # we copy an empty directory. So, who cares?
;;
shared)
core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
@@ -257,6 +260,11 @@ do_cc_core() {
else # build_libgcc
core_targets=( gcc )
fi # ! build libgcc
+ if [ "${build_libstdcxx}" = "yes" \
+ -a "${CT_CC_LANG_CXX}" = "y" \
+ ]; then
+ core_targets+=( target-libstdc++-v3 )
+ fi
CT_DoLog EXTRA "Building ${mode} core C compiler"
CT_DoExecLog ALL make ${PARALLELMFLAGS} "${core_targets[@]/#/all-}"