summaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-03-27 23:07:31 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-03-27 23:07:31 (GMT)
commit784d534d28c55871dacb6d985047a5066ab147c8 (patch)
tree5a5dda6230f94b753a8842bc4f150d8e9e74cd6b /scripts/build
parent99d7ec8a842648a3cfc4d7760954ec3ee3d473f5 (diff)
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" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'scripts/build')
-rw-r--r--scripts/build/cc/gcc.sh36
1 files changed, 32 insertions, 4 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index a740d39..ce393ee 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -117,6 +117,7 @@ do_cc_core() {
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 @@ do_cc_core() {
# 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 @@ do_cc_core() {
# 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 @@ do_cc_core() {
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 @@ do_cc_core() {
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 @@ do_cc_core() {
#------------------------------------------------------------------------------
# Build final gcc
do_cc() {
+ local -a host_libstdcxx_flags
local -a extra_config
local -a final_LDFLAGS
local tmp
@@ -423,7 +438,9 @@ do_cc() {
# 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 @@ do_cc() {
# 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 @@ do_cc() {
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 @@ do_cc() {
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