diff options
author | Alexey Neyman <stilor@att.net> | 2017-08-31 19:13:51 (GMT) |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2017-09-03 19:12:14 (GMT) |
commit | 1e4eeb5c3b0f9156ed679c4aed50ba5f97c3939b (patch) | |
tree | c29bd1a8c1f569b93b01f43f3607a5b30a828e75 /scripts/crosstool-NG.sh.in | |
parent | e83a2e233326f183766b78e579332880339cb5e7 (diff) |
Workaround for static uClibc-ng issue with -lpthread
Also, preserve .config when running test-package.sh.
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/crosstool-NG.sh.in')
-rw-r--r-- | scripts/crosstool-NG.sh.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 9c09b5e..cc216f9 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -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}}" |