diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/build/arch/arm.sh | 1 | ||||
-rw-r--r-- | scripts/build/arch/powerpc.sh | 4 | ||||
-rw-r--r-- | scripts/build/binutils/binutils.sh | 4 | ||||
-rw-r--r-- | scripts/build/companion_tools/100-m4.sh | 8 | ||||
-rw-r--r-- | scripts/build/debug/300-gdb.sh | 5 | ||||
-rw-r--r-- | scripts/build/libc/glibc.sh | 2 | ||||
-rw-r--r-- | scripts/build/libc/picolibc.sh | 111 | ||||
-rw-r--r-- | scripts/build/libc/uClibc.sh | 1 | ||||
-rwxr-xr-x | scripts/config.guess | 2 | ||||
-rwxr-xr-x | scripts/config.sub | 9 | ||||
-rw-r--r-- | scripts/crosstool-NG.sh | 2 | ||||
-rw-r--r-- | scripts/functions | 10 |
12 files changed, 140 insertions, 19 deletions
diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh index 4873df1..9a53bc4 100644 --- a/scripts/build/arch/arm.sh +++ b/scripts/build/arch/arm.sh @@ -70,6 +70,7 @@ CT_DoArchUClibcConfig() { ;; thumb) CT_KconfigEnableOption "COMPILE_IN_THUMB_MODE" "${cfg}" + CT_KconfigDisableOption "UCLIBC_HAS_CONTEXT_FUNCS" "${cfg}" ;; esac # FIXME: CONFIG_ARM_OABI does not exist in neither uClibc/uClibc-ng diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh index 36a727a..85c64d1 100644 --- a/scripts/build/arch/powerpc.sh +++ b/scripts/build/arch/powerpc.sh @@ -7,12 +7,12 @@ CT_DoArchTupleValues () { # Only override values when ABI is not the default case "${CT_ARCH_powerpc_ABI}" in eabi) - # EABI is only for bare-metal, so libc ∈ [none,newlib] + # EABI is only for bare-metal, so libc ∈ [none,newlib,picolibc] CT_TARGET_SYS="eabi" ;; spe) case "${CT_LIBC}" in - none|newlib) CT_TARGET_SYS="elfspe";; + none|newlib|picolibc) CT_TARGET_SYS="elfspe";; *glibc) CT_TARGET_SYS="gnuspe";; uClibc) CT_TARGET_SYS="uclibcgnuspe";; esac diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh index a79bb7e..428a341 100644 --- a/scripts/build/binutils/binutils.sh +++ b/scripts/build/binutils/binutils.sh @@ -177,6 +177,10 @@ do_binutils_backend() { [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls") + # Disable usage of glob for higher compatibility. + # Not strictly needed for anything but GDB anyways. + export ac_cv_func_glob=no + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" CT_DoExecLog CFG \ diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh index 4bbe8d3..7d9044f 100644 --- a/scripts/build/companion_tools/100-m4.sh +++ b/scripts/build/companion_tools/100-m4.sh @@ -42,6 +42,7 @@ do_m4_backend() local prefix local cflags local ldflags + local libs for arg in "$@"; do eval "${arg// /\\ }" @@ -54,12 +55,19 @@ do_m4_backend() # it includes system <spawn.h> but expects a locally-built # posix_spawn(). ldflags="${ldflags} -lrt" + ;; + *-mingw32) + # m4 is built with stack smashing protection enabled which + # is not part of mingw-w64 c library in v7.0.0 and later. + libs="${libs} -lssp" + ;; esac CT_DoLog EXTRA "Configuring m4" CT_DoExecLog CFG \ CFLAGS="${cflags}" \ LDFLAGS="${ldflags}" \ + LIBS="${libs}" \ ${CONFIG_SHELL} \ "${CT_SRC_DIR}/m4/configure" \ --host="${host}" \ diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 9139331..b0ea29b 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -146,7 +146,7 @@ do_debug_gdb_build() cflags="${CT_ALL_TARGET_CFLAGS}" \ ldflags="${CT_ALL_TARGET_LDFLAGS}" \ static="${CT_GDB_NATIVE_STATIC}" \ - static_libstdc="${CT_GDB_NATIVE_STATIC_LIBSTDC}" \ + static_libstdcxx="${CT_GDB_NATIVE_STATIC_LIBSTDCXX}" \ prefix=/usr \ destdir="${CT_DEBUGROOT_DIR}" \ "${native_extra_config[@]}" @@ -236,7 +236,8 @@ do_gdb_backend() cflags+=" -static" ldflags+=" -static" fi - if [ "${static_libstdc}" = "y" ]; then + if [ "${static_libstdcxx}" = "y" ]; then + ldflags+=" -static-libgcc" ldflags+=" -static-libstdc++" fi diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 31fa067..ba6e548 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -314,6 +314,8 @@ glibc_backend_once() ;; esac + # Make sure glibc build system respects our provided CFLAGS. + extra_make_args+=( default_cflags= ) extra_make_args+=( "BUILD_CFLAGS=${build_cflags}" ) extra_make_args+=( "BUILD_CPPFLAGS=${build_cppflags}" ) extra_make_args+=( "BUILD_LDFLAGS=${build_ldflags}" ) diff --git a/scripts/build/libc/picolibc.sh b/scripts/build/libc/picolibc.sh new file mode 100644 index 0000000..152125c --- /dev/null +++ b/scripts/build/libc/picolibc.sh @@ -0,0 +1,111 @@ +# This file adds functions to build the Picolibc library +# Copyright © 2020 Keith Packard +# Licensed under the GPL v2 or later. See COPYING in the root of this package +# +# Edited by Keith Packard <keithp@keithp.com> +# + +picolibc_start_files() +{ + CT_DoStep INFO "Installing C library headers & start files" + CT_DoExecLog ALL cp -a "${CT_SRC_DIR}/picolibc/newlib/libc/include/." \ + "${CT_HEADERS_DIR}" + CT_EndStep +} + +picolibc_main() +{ + local -a picolibc_opts + local cflags_for_target + + CT_DoStep INFO "Installing C library" + + CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc" + + CT_DoLog EXTRA "Configuring Picolibc library" + + # Multilib is the default, so if it is not enabled, disable it. + if [ "${CT_MULTILIB}" != "y" ]; then + picolibc_opts+=("-Dmultilib=false") + fi + + yn_args="IO_C99FMT:io-c99-formats +IO_LL:io-long-long +REGISTER_FINI:newlib-register-fini +NANO_MALLOC:newlib-nano-malloc +ATEXIT_DYNAMIC_ALLOC:newlib-atexit-dynamic-alloc +GLOBAL_ATEXIT:newlib-global-atexit +LITE_EXIT:lite-exit +MULTITHREAD:newlib-multithread +RETARGETABLE_LOCKING:newlib-retargetable-locking + " + + for ynarg in $yn_args; do + var="CT_LIBC_PICOLIBC_${ynarg%:*}" + eval var=\$${var} + argument=${ynarg#*:} + + + if [ "${var}" = "y" ]; then + picolibc_opts+=( "-D$argument=true" ) + else + picolibc_opts+=( "-D$argument=false" ) + fi + done + + [ "${CT_USE_SYSROOT}" = "y" ] && \ + picolibc_opts+=( "-Dsysroot-install=true" ) + + [ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \ + CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections" + + [ "${CT_LIBC_PICOLIBC_LTO}" = "y" ] && \ + CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -flto" + + cflags_for_target="${CT_ALL_TARGET_CFLAGS} ${CT_LIBC_PICOLIBC_TARGET_CFLAGS}" + + # Note: picolibc handles the build/host/target a little bit differently + # than one would expect: + # build : not used + # host : the machine building picolibc + # target : the machine picolibc runs on + meson_cflags="" + for cflag in ${cflags_for_target}; do + meson_cflags="${meson_cflags} '${cflag}'," + done + cat << EOF > picolibc-cross.txt +[binaries] +c = '${CT_TARGET}-gcc' +ar = '${CT_TARGET}-ar' +as = '${CT_TARGET}-as' +strip = '${CT_TARGET}-strip' + +[host_machine] +system = '${CT_TARGET_VENDOR}' +cpu_family = '${CT_TARGET_ARCH}' +cpu = '${CT_TARGET_ARCH}' +endian = '${CT_ARCH_ENDIAN}' + +[properties] +c_args = [ ${meson_cflags} '-nostdlib', '-fno-common', '-ftls-model=local-exec' ] +needs_exe_wrapper = true +skip_sanity_check = true +EOF + CT_DoExecLog CFG \ + meson \ + --cross-file picolibc-cross.txt \ + --prefix=${CT_SYSROOT_DIR} \ + -Dspecsdir=${CT_SYSROOT_DIR}/lib \ + "${CT_SRC_DIR}/picolibc" \ + "${picolibc_opts[@]}" \ + "${CT_LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY[@]}" + + CT_DoLog EXTRA "Building C library" + CT_DoExecLog ALL ninja + + CT_DoLog EXTRA "Installing C library" + CT_DoExecLog ALL ninja install + + CT_Popd + CT_EndStep +} diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh index 5c04b32..4328542 100644 --- a/scripts/build/libc/uClibc.sh +++ b/scripts/build/libc/uClibc.sh @@ -303,7 +303,6 @@ manage_uClibc_config() CT_KconfigEnableOption "UCLIBC_HAS_LOCALE" "${dst}" CT_KconfigDeleteOption "UCLIBC_PREGENERATED_LOCALE_DATA" "${dst}" CT_KconfigDeleteOption "UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA" "${dst}" - CT_KconfigDeleteOption "UCLIBC_HAS_XLOCALE" "${dst}" fi # WCHAR support diff --git a/scripts/config.guess b/scripts/config.guess index a81aa50..183eb2a 100755 --- a/scripts/config.guess +++ b/scripts/config.guess @@ -1041,7 +1041,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" diff --git a/scripts/config.sub b/scripts/config.sub index 3b4c762..36df2c8 100755 --- a/scripts/config.sub +++ b/scripts/config.sub @@ -1139,14 +1139,6 @@ case $cpu-$vendor in cpu=nsx vendor=tandem ;; - s390-*) - cpu=s390 - vendor=ibm - ;; - s390x-*) - cpu=s390x - vendor=ibm - ;; tile*-*) os=${os:-linux-gnu} ;; @@ -1238,6 +1230,7 @@ case $cpu-$vendor in | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ | spu \ + | s390 | s390x \ | tahoe \ | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ | tron \ diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh index 14be5ed..f09ae0c 100644 --- a/scripts/crosstool-NG.sh +++ b/scripts/crosstool-NG.sh @@ -437,7 +437,7 @@ if [ -z "${CT_RESTART}" ]; then t="${!r}-" fi - for tool in ar as dlltool gcc g++ gcj gnatbind gnatmake ld nm objcopy objdump ranlib strip windres; do + for tool in ar as dlltool gcc g++ gcj gnatbind gnatmake ld libtool nm objcopy objdump ranlib strip windres; do # First try with prefix + suffix # Then try with prefix only # Then try with suffix only, but only for BUILD, and HOST iff REAL_BUILD == REAL_HOST diff --git a/scripts/functions b/scripts/functions index 2227de7..4ea3c5a 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1135,7 +1135,7 @@ CT_DoBuildTargetTuple() uClibc) CT_TARGET_SYS=uclibc;; musl) CT_TARGET_SYS=musl;; bionic) CT_TARGET_SYS=android;; - none|newlib) CT_TARGET_SYS=elf;; + none|newlib|picolibc) CT_TARGET_SYS=elf;; *) # Keep empty for the libraries like mingw or avr-libc CT_TARGET_SYS= @@ -2233,6 +2233,7 @@ CT_DoExtractPatch() local archive ext local -a patch_dirs local bundled_patch_dir + local bundled_common_patch_dir local local_patch_dir local overlay @@ -2307,13 +2308,14 @@ CT_DoExtractPatch() CT_DoExecLog ALL touch "${src_dir}/.${basename}.patching" bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}" + bundled_common_patch_dir="${CT_LIB_DIR}/packages/${pkg_name}" local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}" case "${patch_order}" in - bundled) patch_dirs=("${bundled_patch_dir}");; + bundled) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}");; local) patch_dirs=("${local_patch_dir}");; - bundled,local) patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");; - local,bundled) patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}");; + bundled,local) patch_dirs=("${bundled_patch_dir}" "${bundled_common_patch_dir}" "${local_patch_dir}");; + local,bundled) patch_dirs=("${local_patch_dir}" "${bundled_patch_dir}" "${bundled_common_patch_dir}");; none) patch_dirs=;; esac |