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>
This commit is contained in:
Yann E. MORIN"
2011-03-28 01:07:31 +02:00
parent 99d7ec8a84
commit 784d534d28
2 changed files with 45 additions and 4 deletions

View File

@ -10,16 +10,19 @@ config PPL_V_0_11_2
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 @@ config PPL_VERSION
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

View File

@ -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