Workaround for static uClibc-ng issue with -lpthread

Also, preserve .config when running test-package.sh.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-08-31 12:13:51 -07:00
parent e83a2e2333
commit 1e4eeb5c3b
5 changed files with 73 additions and 37 deletions

View File

@ -189,6 +189,8 @@ EOF
CT_EndStep
}
mv .config .config-saved
. maintainer/package-versions
mv .config-saved .config
rm -rf ${CT_TARBALLS_DIR} ${CT_COMMON_SRC_DIR}

View File

@ -233,7 +233,11 @@ do_cc_core_pass_2() {
# later, we need to build libgcc
case "${CT_THREADS}" in
nptl)
if [ "${CT_SHARED_LIBS}" = "y" ]; then
core_opts+=( "mode=shared" )
else
core_opts+=( "mode=static" )
fi
core_opts+=( "build_libgcc=yes" )
;;
win32)
@ -873,10 +877,13 @@ do_gcc_backend() {
fi
done
[ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared")
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
if [ "${CT_SHARED_LIBS}" != "y" ]; then
extra_config+=("--disable-shared")
fi
case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in
y) extra_config+=("--enable-sjlj-exceptions");;
m) ;;

View File

@ -150,6 +150,9 @@ do_libc_backend_once() {
;;
esac
# FIXME static version of glibc seems to be broken:
# build tries to use libc-modules.h which is generated from
# soversions.i, which is only created for builds with shared libs.
case "${CT_SHARED_LIBS}" in
y) extra_config+=("--enable-shared");;
*) extra_config+=("--disable-shared");;
@ -308,8 +311,6 @@ do_libc_backend_once() {
"${extra_make_args[@]}" \
install-headers
# For glibc, a few headers need to be manually installed
if [ "${CT_LIBC}" = "glibc" ]; then
# Two headers -- stubs.h and features.h -- aren't installed by install-headers,
# so do them by hand. We can tolerate an empty stubs.h for the moment.
# See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
@ -343,7 +344,6 @@ do_libc_backend_once() {
fi
;;
esac
fi
elif [ "${libc_mode}" = "final" -a -r "${multi_root}/.libc_headers_installed" ]; then
CT_DoExecLog ALL rm -f "${multi_root}/.libc_headers_installed"
fi # installing headers

View File

@ -164,9 +164,22 @@ CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )"
# Put user-supplied flags at the end, so that they take precedence.
CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
# FIXME move to gcc.sh
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" )
CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
# Starting with 1.0.20, applications using uClibc-ng do not link with
# the default libgcc_c_spec used by GCC if only static libc.a exists - unless
# -static is thrown in. The difference is that with -static, gcc passes
# "--start-group -lgcc -lc --end-group" and without -static, it passes
# "-lgcc -lc -lgcc" instead. The latter leaves a symbol from 2nd libgcc
# (dl_iterate_phdr) unresolved because -lc is already done at this point.
# Force static link on the target.
if [ "${CT_SHARED_LIBS}" != "y" ]; then
CT_TARGET_LDFLAGS+=" -static"
fi
# Compute the package version string
if [ "${CT_SHOW_CT_VERSION}" = "y" ]; then
CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}"

View File

@ -318,10 +318,24 @@ CT_DoExecLog() {
local level="$1"
local cur_cmd
local ret
local cmd_seen
shift
(
for i in "$@"; do
cur_cmd+="'${i}' "
case "${i}" in
*=*)
if [ -z "${cmd_seen}" ]; then
cur_cmd+=" ${i%%=*}='${i#*=}'"
else
cur_cmd+=" '${i}'"
fi
;;
*)
cur_cmd+=" '${i}'"
cmd_seen=y
;;
esac
done
while true; do
case "${1}" in