# HG changeset patch # User "Yann E. MORIN" # Date 1301267251 -7200 # Node ID 482a006e5b187034a22dc5667992f5bc83f23fb3 # Parent d4c9c0071bbbc3c7522427ab8aee433c4464e282 cc/gcc: fix linking with static PPL 0.11+ PPL 0.11+ installs three libs: lippl, libppl_c and libpwl. libppl_c has a dependency on libpwl (at least for watchdog stuff). While gcc correctly links with libppl and libppl_c, it does not pull libpwl in. In case of shared libs, this is not a problem, as libppl_c has a NEEDED dependency on libpwl. But for static libs, that does not work. Although libppl_c.la exists and has a correct dependency on lipwl, somehow gcc misses it. So we have to force pulling libpwl when needed. Signed-off-by: "Yann E. MORIN" diff -r d4c9c0071bbb -r 482a006e5b18 config/companion_libs/ppl.in --- a/config/companion_libs/ppl.in Sat Mar 26 22:04:22 2011 +0100 +++ b/config/companion_libs/ppl.in Mon Mar 28 01:07:31 2011 +0200 @@ -10,16 +10,19 @@ bool prompt "0.11.2 (EXPERIMENTAL)" depends on EXPERIMENTAL + select PPL_0_11 config PPL_V_0_11_1 bool prompt "0.11.1 (EXPERIMENTAL)" depends on EXPERIMENTAL + select PPL_0_11 config PPL_V_0_11 bool prompt "0.11 (EXPERIMENTAL)" depends on EXPERIMENTAL + select PPL_0_11 config PPL_V_0_10_2 bool @@ -35,3 +38,13 @@ default "0.11.1" if PPL_V_0_11_1 default "0.11" if PPL_V_0_11 default "0.10.2" if PPL_V_0_10_2 + +# For PPL 0.11, we need to pull libpwl if configured static +config PPL_0_11 + bool + default n + select PPL_NEEDS_LIBPWL if ! COMPLIBS_SHARED + +config PPL_NEEDS_LIBPWL + bool + default n diff -r d4c9c0071bbb -r 482a006e5b18 scripts/build/cc/gcc.sh --- a/scripts/build/cc/gcc.sh Sat Mar 26 22:04:22 2011 +0100 +++ b/scripts/build/cc/gcc.sh Mon Mar 28 01:07:31 2011 +0200 @@ -117,6 +117,7 @@ local core_prefix_dir local lang_opt local tmp + local -a host_libstdcxx_flags local -a extra_config local -a core_LDFLAGS local -a core_targets @@ -186,7 +187,9 @@ # with the same block in do_cc, below. if [ "${build_staticlinked}" = "yes" ]; then core_LDFLAGS+=("-static") - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") + host_libstdcxx_flags+=("-lm") # Companion libraries are build static (eg !shared), so # the libstdc++ is not pulled automatically, although it # is needed. Shoe-horn it in our LDFLAGS @@ -199,7 +202,9 @@ # build script # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") + host_libstdcxx_flags+=("-lm") elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then # When companion libraries are build static (eg !shared), # the libstdc++ is not pulled automatically, although it @@ -219,6 +224,11 @@ fi if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then extra_config+=("--with-ppl=${CT_COMPLIBS_DIR}") + # With PPL 0.11+, also pull libpwl if needed + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then + host_libstdcxx_flags+=("-L${CT_COMPLIBS_DIR}/lib") + host_libstdcxx_flags+=("-lpwl") + fi extra_config+=("--with-cloog=${CT_COMPLIBS_DIR}") elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then extra_config+=("--with-ppl=no") @@ -232,6 +242,10 @@ extra_config+=("--disable-lto") fi + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") + fi + if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then extra_config+=("--enable-target-optspace") fi @@ -349,6 +363,7 @@ #------------------------------------------------------------------------------ # Build final gcc do_cc() { + local -a host_libstdcxx_flags local -a extra_config local -a final_LDFLAGS local tmp @@ -423,7 +438,9 @@ # with the same block in do_cc_core, above. if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_LDFLAGS+=("-static") - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++ -lm") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++") + host_libstdcxx_flags+=("-lm") # Companion libraries are build static (eg !shared), so # the libstdc++ is not pulled automatically, although it # is needed. Shoe-horn it in our LDFLAGS @@ -436,7 +453,9 @@ # build script # FIXME: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, # see http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01635.html - extra_config+=("--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm") + host_libstdcxx_flags+=("-static-libgcc") + host_libstdcxx_flags+=("-Wl,-Bstatic,-lstdc++,-Bdynamic") + host_libstdcxx_flags+=("-lm") elif [ "${CT_COMPLIBS_SHARED}" != "y" ]; then # When companion libraries are build static (eg !shared), # the libstdc++ is not pulled automatically, although it @@ -456,6 +475,11 @@ fi if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then extra_config+=("--with-ppl=${CT_COMPLIBS_DIR}") + # With PPL 0.11+, also pull libpwl if needed + if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then + host_libstdcxx_flags+=("-L${CT_COMPLIBS_DIR}/lib") + host_libstdcxx_flags+=("-lpwl") + fi extra_config+=("--with-cloog=${CT_COMPLIBS_DIR}") elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then extra_config+=("--with-ppl=no") @@ -467,6 +491,10 @@ extra_config+=("--with-libelf=no") fi + if [ ${#host_libstdcxx_flags[@]} -ne 0 ]; then + extra_config+=("--with-host-libstdcxx=${host_libstdcxx_flags[*]}") + fi + if [ "${CT_THREADS}" = "none" ]; then extra_config+=("--disable-threads") if [ "${CT_CC_GCC_4_2_or_later}" = y ]; then