diff options
Diffstat (limited to 'scripts/build')
-rw-r--r-- | scripts/build/arch/arc.sh | 36 | ||||
-rw-r--r-- | scripts/build/arch/sparc.sh | 37 | ||||
-rw-r--r-- | scripts/build/binutils/binutils.sh | 5 | ||||
-rw-r--r-- | scripts/build/cc/gcc.sh | 4 | ||||
-rw-r--r-- | scripts/build/companion_tools/500-dtc.sh | 6 | ||||
-rw-r--r-- | scripts/build/internals.sh | 2 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 5 | ||||
-rw-r--r-- | scripts/build/libc/musl.sh | 3 | ||||
-rw-r--r-- | scripts/build/libc/newlib.sh | 5 |
9 files changed, 85 insertions, 18 deletions
diff --git a/scripts/build/arch/arc.sh b/scripts/build/arch/arc.sh index b13ef0eb..d15f73f3 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 7433c4d4..97c9b9df 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 2a738deb..a79bb7e2 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 60f259df..3d4db35b 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 ce0b303a..a16ff625 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 5d359979..821761c2 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 221752d0..31fa067f 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 807b3bd8..05da1d40 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 95ab7910..ddecdb19 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 " |