summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/arch/arc.sh36
-rw-r--r--scripts/build/arch/sparc.sh37
-rw-r--r--scripts/build/binutils/binutils.sh5
-rw-r--r--scripts/build/cc/gcc.sh4
-rw-r--r--scripts/build/companion_tools/500-dtc.sh6
-rw-r--r--scripts/build/internals.sh2
-rw-r--r--scripts/build/libc/glibc.sh5
-rw-r--r--scripts/build/libc/musl.sh3
-rw-r--r--scripts/build/libc/newlib.sh5
-rw-r--r--scripts/crosstool-NG.sh1
-rw-r--r--scripts/functions46
11 files changed, 119 insertions, 31 deletions
diff --git a/scripts/build/arch/arc.sh b/scripts/build/arch/arc.sh
index b13ef0e..d15f73f 100644
--- a/scripts/build/arch/arc.sh
+++ b/scripts/build/arch/arc.sh
@@ -29,3 +29,39 @@ CT_DoArchUClibcCflags()
esac
done
}
+
+# Multilib: Adjust configure arguments for GLIBC
+# Usage: CT_DoArchGlibcAdjustConfigure <configure-args-array-name> <cflags>
+#
+# From GCC's standpoint ARC's multilib items are defined by "mcpu" values
+# which we have quite a few and for all of them might be built optimized
+# cross-toolchain.
+#
+# From Glibc's standpoint multilib is multi-ABI and so very limited
+# versions are supposed to co-exist.
+#
+# Here we force Glibc to install libraries in per-multilib folder to create
+# a universal cross-toolchain that has libs optimized for multiple CPU types.
+CT_DoArchGlibcAdjustConfigure() {
+ local -a add_args
+ local array="${1}"
+ local cflags="${2}"
+ local opt
+ local mcpu
+
+ # If building for multilib, set proper installation paths
+ if [ "${CT_MULTILIB}" = "y" ]; then
+ for opt in ${cflags}; do
+ case "${opt}" in
+ -mcpu=*)
+ mcpu="${opt#*=}"
+ add_args+=( "libc_cv_rtlddir=/lib/${mcpu}" )
+ add_args+=( "libc_cv_slibdir=/lib/${mcpu}" )
+ add_args+=( "--libdir=/usr/lib/${mcpu}" )
+ ;;
+ esac
+ done
+ fi
+
+ eval "${array}+=( \"\${add_args[@]}\" )"
+}
diff --git a/scripts/build/arch/sparc.sh b/scripts/build/arch/sparc.sh
index 7433c4d..97c9b9d 100644
--- a/scripts/build/arch/sparc.sh
+++ b/scripts/build/arch/sparc.sh
@@ -3,17 +3,32 @@ CT_DoArchTupleValues() {
# That's the only thing to override
CT_TARGET_ARCH="sparc${target_bits_64}${CT_ARCH_SUFFIX}"
- # By default, sparc64-*-linux is configured with -mcpu=v9. However,
- # according to https://sourceware.org/ml/libc-alpha/2005-12/msg00027.html,
- # "There is no Linux sparc64 port that runs on non-UltraSPARC-I+ ISA CPUs."
- # There is a patch that would change the default to -mcpu=ultrasparc for
- # sparc64-*-linux configuration: https://patchwork.ozlabs.org/patch/409424/
- # but that patch has not been integrated (yet). One concern raised about
- # this patch was that -mcpu=ultrasparc can suboptimally schedule instructions
- # for newer SPARC CPUs. So, override to -mcpu=ultrasparc and warn the user.
- if [ "${CT_KERNEL}" = "linux" -a "${CT_ARCH_64}" = "y" -a -z "${CT_ARCH_CPU}" ]; then
- CT_DoLog WARN "Setting CPU to UltraSPARC-I for sparc64-linux. Set CT_ARCH_CPU if a different CPU is desired."
- CT_ARCH_WITH_CPU="--with-cpu=ultrasparc"
+ if [ "${CT_KERNEL}" = "linux" -a -z "${CT_ARCH_CPU}" ]; then
+ if [ "${CT_ARCH_64}" = "y" ]; then
+ # By default, sparc64-*-linux is configured with -mcpu=v9. However,
+ # according to https://sourceware.org/ml/libc-alpha/2005-12/msg00027.html,
+ # "There is no Linux sparc64 port that runs on non-UltraSPARC-I+ ISA CPUs."
+ # There is a patch that would change the default to -mcpu=ultrasparc for
+ # sparc64-*-linux configuration: https://patchwork.ozlabs.org/patch/409424/
+ # but that patch has not been integrated (yet). One concern raised about
+ # this patch was that -mcpu=ultrasparc can suboptimally schedule instructions
+ # for newer SPARC CPUs. So, override to -mcpu=ultrasparc and warn the user.
+ CT_DoLog WARN "Setting CPU to UltraSPARC-I for sparc64-linux. Set CT_ARCH_CPU if a different CPU is desired."
+ CT_ARCH_WITH_CPU="--with-cpu=ultrasparc"
+ if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then
+ CT_ARCH_WITH_CPU_32="--with-cpu-32=ultrasparc"
+ CT_ARCH_WITH_CPU_64="--with-cpu-64=ultrasparc"
+ fi
+ else
+ # Similarly, sparc-*-linux defaults to v7. GLIBC 2.31 started to reject
+ # pre-v8 configurations with 2.31, and default v8 fails a subsequent test for
+ # using atomics (which are presumably, only available on some v8 CPUs).
+ # Therefore, default to v9.
+ if [ -z "${CT_GLIBC_SPARC_ALLOW_V7}" ]; then
+ CT_DoLog WARN "Setting CPU to V9 for sparc-linux. Set CT_ARCH_CPU if a different CPU is desired."
+ CT_ARCH_WITH_CPU="--with-cpu=v9"
+ fi
+ fi
fi
}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 2a738de..a79bb7e 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -153,11 +153,14 @@ do_binutils_backend() {
if [ "${CT_BINUTILS_PLUGINS}" = "y" ]; then
extra_config+=( --enable-plugins )
fi
- if [ "${CT_BINUTILES_RELRO}" = "y" ]; then
+ if [ "${CT_BINUTILS_RELRO}" = "y" ]; then
extra_config+=( --enable-relro )
elif [ "${CT_BINUTILS_RELRO}" != "m" ]; then
extra_config+=( --disable-relro )
fi
+ if [ "${CT_BINUTILS_DETERMINISTIC_ARCHIVES}" = "y" ]; then
+ extra_config+=( --enable-deterministic-archives )
+ fi
if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 60f259d..3d4db35 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -351,7 +351,7 @@ do_gcc_core_backend() {
;;
esac
- for tmp in ARCH ABI CPU TUNE FPU FLOAT ENDIAN; do
+ for tmp in ARCH ABI CPU CPU_32 CPU_64 TUNE FPU FLOAT ENDIAN; do
eval tmp="\${CT_ARCH_WITH_${tmp}}"
if [ -n "${tmp}" ]; then
extra_config+=("${tmp}")
@@ -905,7 +905,7 @@ do_gcc_backend() {
# Enable selected languages
extra_config+=("--enable-languages=${lang_list}")
- for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
+ for tmp in ARCH ARCH_32 ARCH_64 ABI CPU CPU_32 CPU_64 TUNE TUNE_32 TUNE_64 FPU FLOAT; do
eval tmp="\${CT_ARCH_WITH_${tmp}}"
if [ -n "${tmp}" ]; then
extra_config+=("${tmp}")
diff --git a/scripts/build/companion_tools/500-dtc.sh b/scripts/build/companion_tools/500-dtc.sh
index ce0b303..a16ff62 100644
--- a/scripts/build/companion_tools/500-dtc.sh
+++ b/scripts/build/companion_tools/500-dtc.sh
@@ -48,11 +48,17 @@ do_dtc_backend()
eval "${arg// /\\ }"
done
+ # Override PKG_CONFIG: if pkg-config is not installed, DTC's makefile
+ # misinterprets the error code and tries to enable YAML support while
+ # not linking against libyaml. NO_YAML=1 is sufficient to make the build
+ # pass; PKG_CONFIG=/bin/true just suppresses some scary error messages.
extra_opts=( \
CC="${host}-gcc" \
AR="${host}-ar" \
PREFIX="${prefix}" \
+ PKG_CONFIG=/bin/true \
NO_PYTHON=1 \
+ NO_YAML=1 \
BIN=dtc \
)
if [ -n "${CT_DTC_VERBOSE}" ]; then
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index 5d35997..821761c 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -83,7 +83,7 @@ do_finish() {
case "${_type}" in
*script*executable*)
;;
- *executable*)
+ *executable*|*shared*object*)
CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
;;
esac
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 221752d..31fa067 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -199,7 +199,7 @@ glibc_backend_once()
printf "%s\n" "${CT_GLIBC_CONFIGPARMS}" > configparms
# glibc can't be built without -O2 (reference needed!)
- glibc_cflags+=" -O2"
+ glibc_cflags+=" -g -O2"
case "${CT_GLIBC_ENABLE_FORTIFIED_BUILD}" in
y) ;;
@@ -260,9 +260,12 @@ glibc_backend_once()
# CFLAGS are only applied when compiling .c files. .S files are compiled with ASFLAGS,
# but they are not passed by configure. Thus, pass everything in CC instead.
+ # The CFLAGS variable needs to be cleared, else the default "-g -O2"
+ # would override previous flags.
CT_DoExecLog CFG \
BUILD_CC=${CT_BUILD}-gcc \
CC="${CT_TARGET}-${CT_CC} ${glibc_cflags}" \
+ CFLAGS="" \
AR=${CT_TARGET}-ar \
RANLIB=${CT_TARGET}-ranlib \
"${CONFIG_SHELL}" \
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index 807b3bd..05da1d4 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -98,7 +98,8 @@ musl_backend_once() {
# host : same as --target
# target : the machine musl runs on
CT_DoExecLog CFG \
- CFLAGS="${extra_cflags[*]}" \
+ CFLAGS="${CT_TARGET_CFLAGS} ${extra_cflags[*]}" \
+ LDFLAGS="${CT_TARGET_LDFLAGS}" \
CROSS_COMPILE="${CT_TARGET}-" \
${CONFIG_SHELL} \
${src_dir}/configure \
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 95ab791..ddecdb1 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -55,7 +55,7 @@ newlib_main()
yn_args="IO_POS_ARGS:newlib-io-pos-args
IO_C99FMT:newlib-io-c99-formats
IO_LL:newlib-io-long-long
-NEWLIB_REGISTER_FINI:newlib-register-fini
+REGISTER_FINI:newlib-register-fini
NANO_MALLOC:newlib-nano-malloc
NANO_FORMATTED_IO:newlib-nano-formatted-io
ATEXIT_DYNAMIC_ALLOC:newlib-atexit-dynamic-alloc
@@ -63,7 +63,10 @@ GLOBAL_ATEXIT:newlib-global-atexit
LITE_EXIT:lite-exit
REENT_SMALL:newlib-reent-small
MULTITHREAD:newlib-multithread
+RETARGETABLE_LOCKING:newlib-retargetable-locking
WIDE_ORIENT:newlib-wide-orient
+FSEEK_OPTIMIZATION:newlib-fseek-optimization
+FVWRITE_IN_STREAMIO:newlib-fvwrite-in-streamio
UNBUF_STREAM_OPT:newlib-unbuf-stream-opt
ENABLE_TARGET_OPTSPACE:target-optspace
"
diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh
index 31942b1..14be5ed 100644
--- a/scripts/crosstool-NG.sh
+++ b/scripts/crosstool-NG.sh
@@ -114,7 +114,6 @@ fi
# Where will we work?
CT_WORK_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}"
-CT_BUILD_DIR="${CT_BUILD_TOP_DIR}/build"
CT_DoExecLog ALL mkdir -p "${CT_WORK_DIR}"
CT_DoExecLog DEBUG rm -f "${CT_WORK_DIR}/backtrace"
diff --git a/scripts/functions b/scripts/functions
index 09df03a..2227de7 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1040,7 +1040,8 @@ CT_GetFile()
# TBD these should not be needed if config.sub/guess is a package
# Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.
# Those from CT_TOP_DIR, if they exist, will be be more recent than those from CT_LIB_DIR.
-CT_DoConfigGuess() {
+CT_DoConfigGuess()
+{
if [ -r "${CT_TOP_DIR}/scripts/config.guess" ]; then
"${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.guess"
else
@@ -1048,7 +1049,8 @@ CT_DoConfigGuess() {
fi
}
-CT_DoConfigSub() {
+CT_DoConfigSub()
+{
if [ -r "${CT_TOP_DIR}/scripts/config.sub" ]; then
"${CT_CONFIG_SHELL}" "${CT_TOP_DIR}/scripts/config.sub" "$@"
else
@@ -1060,7 +1062,8 @@ CT_DoConfigSub() {
# environment for the next step(s). When this is needed, it can do so by
# invoking this function.
# Usage: CT_EnvModify [export] VAR VALUE
-CT_EnvModify() {
+CT_EnvModify()
+{
local e
if [ "$1" = "export" ]; then
shift
@@ -1075,7 +1078,10 @@ CT_EnvModify() {
# In fact this function takes the environment variables to build the target
# tuple. It is needed both by the normal build sequence, as well as the
# sample saving sequence.
-CT_DoBuildTargetTuple() {
+CT_DoBuildTargetTuple()
+{
+ local tmp
+
# Set the endianness suffix, and the default endianness gcc option
target_endian_eb=
target_endian_be=
@@ -1137,13 +1143,29 @@ CT_DoBuildTargetTuple() {
esac
# Set the default values for ARCH, ABI, CPU, TUNE, FPU and FLOAT
- unset CT_ARCH_ARCH_CFLAG CT_ARCH_ABI_CFLAG CT_ARCH_CPU_CFLAG CT_ARCH_TUNE_CFLAG CT_ARCH_FPU_CFLAG CT_ARCH_FLOAT_CFLAG
- unset CT_ARCH_WITH_ARCH CT_ARCH_WITH_ABI CT_ARCH_WITH_CPU CT_ARCH_WITH_TUNE CT_ARCH_WITH_FPU CT_ARCH_WITH_FLOAT CT_ARCH_WITH_ENDIAN
- [ "${CT_ARCH_ARCH}" ] && { CT_ARCH_ARCH_CFLAG="-march=${CT_ARCH_ARCH}"; CT_ARCH_WITH_ARCH="--with-arch=${CT_ARCH_ARCH}"; }
- [ "${CT_ARCH_ABI}" ] && { CT_ARCH_ABI_CFLAG="-mabi=${CT_ARCH_ABI}"; CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_ABI}"; }
- [ "${CT_ARCH_CPU}" ] && { CT_ARCH_CPU_CFLAG="-mcpu=${CT_ARCH_CPU}"; CT_ARCH_WITH_CPU="--with-cpu=${CT_ARCH_CPU}"; }
- [ "${CT_ARCH_TUNE}" ] && { CT_ARCH_TUNE_CFLAG="-mtune=${CT_ARCH_TUNE}"; CT_ARCH_WITH_TUNE="--with-tune=${CT_ARCH_TUNE}"; }
- [ "${CT_ARCH_FPU}" ] && { CT_ARCH_FPU_CFLAG="-mfpu=${CT_ARCH_FPU}"; CT_ARCH_WITH_FPU="--with-fpu=${CT_ARCH_FPU}"; }
+ for tmp in ARCH ABI CPU TUNE FPU FLOAT ENDIAN; do
+ eval "unset CT_ARCH_${tmp}_CFLAG CT_ARCH_WITH_${tmp} CT_ARCH_WITH_${tmp}_32 CT_ARCH_WITH_${tmp}_64"
+ done
+
+ [ -n "${CT_ARCH_ABI}" ] && { CT_ARCH_ABI_CFLAG="-mabi=${CT_ARCH_ABI}"; CT_ARCH_WITH_ABI="--with-abi=${CT_ARCH_ABI}"; }
+ [ -n "${CT_ARCH_FPU}" ] && { CT_ARCH_FPU_CFLAG="-mfpu=${CT_ARCH_FPU}"; CT_ARCH_WITH_FPU="--with-fpu=${CT_ARCH_FPU}"; }
+
+ # The options below have distinct variants for multilib-enabled toolchain.
+ # At this time, we just always have them equal to the "main" setting; it
+ # seems that most example configurations are built for a specific CPU.
+ # If there's demand for it, we can turn them into separate knobs in
+ # Kconfig later.
+ for tmp in ARCH CPU TUNE; do
+ eval "val=\${CT_ARCH_${tmp}}"
+ if [ -n "${val}" ]; then
+ eval "CT_ARCH_${tmp}_CFLAG=-m${tmp,,}=${val}"
+ eval "CT_ARCH_WITH_${tmp}=--with-${tmp,,}=${val}"
+ if [ -n "${CT_ARCH_SUPPORTS_WITH_32_64}" -a -n "${CT_MULTILIB}" ]; then
+ eval "CT_ARCH_WITH_${tmp}_32=--with-${tmp,,}-32=${val}"
+ eval "CT_ARCH_WITH_${tmp}_64=--with-${tmp,,}-64=${val}"
+ fi
+ fi
+ done
case "${CT_ARCH_FLOAT}" in
hard)
@@ -1786,7 +1808,7 @@ CT_Mirrors()
'')
# Ignore, this happens before .config is fully evaluated
;;
- [34].*)
+ [345].*)
echo "http://www.kernel.org/pub/linux/kernel/v${version%%.*}.x"
;;
2.6.*)