1.1 --- a/scripts/build/cc/gcc.sh Sat Apr 10 23:43:08 2010 +0200
1.2 +++ b/scripts/build/cc/gcc.sh Sun Apr 11 00:47:23 2010 +0200
1.3 @@ -95,6 +95,7 @@
1.4 local lang_opt
1.5 local tmp
1.6 local -a extra_config
1.7 + local core_LDFLAGS
1.8
1.9 eval $1
1.10 eval $2
1.11 @@ -162,10 +163,17 @@
1.12
1.13 CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
1.14
1.15 + # When companion libraries are build static (eg !shared),
1.16 + # the libstdc++ is not pulled automatically, although it
1.17 + # is needed. Shoe-horn it in our LDFLAGS
1.18 + if [ -z "${CT_COMPLIBS_SHARED}" ]; then
1.19 + core_LDFLAGS='-lstdc++'
1.20 + fi
1.21 +
1.22 # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
1.23 CC_FOR_BUILD="${CT_BUILD}-gcc" \
1.24 CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.25 - LDFLAGS="-lstdc++" \
1.26 + LDFLAGS="${core_LDFLAGS}" \
1.27 CT_DoExecLog ALL \
1.28 "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \
1.29 --build=${CT_BUILD} \
1.30 @@ -257,6 +265,7 @@
1.31 do_cc() {
1.32 local -a extra_config
1.33 local tmp
1.34 + local final_LDFLAGS
1.35
1.36 # If building for bare metal, nothing to be done here, the static core conpiler is enough!
1.37 [ "${CT_BARE_METAL}" = "y" ] && return 0
1.38 @@ -325,13 +334,20 @@
1.39
1.40 CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
1.41
1.42 + # When companion libraries are build static (eg !shared),
1.43 + # the libstdc++ is not pulled automatically, although it
1.44 + # is needed. Shoe-horn it in our LDFLAGS
1.45 + if [ -z "${CT_COMPLIBS_SHARED}" ]; then
1.46 + final_LDFLAGS='-lstdc++'
1.47 + fi
1.48 +
1.49 # --enable-symvers=gnu really only needed for sh4 to work around a
1.50 # detection problem only matters for gcc-3.2.x and later, I think.
1.51 # --disable-nls to work around crash bug on ppc405, but also because
1.52 # embedded systems don't really need message catalogs...
1.53 CC_FOR_BUILD="${CT_BUILD}-gcc" \
1.54 CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.55 - LDFLAGS="-lstdc++" \
1.56 + LDFLAGS="${final_LDFLAGS}" \
1.57 CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
1.58 CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
1.59 LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \