aboutsummaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build')
-rw-r--r--scripts/build/arch/lm32.sh6
-rw-r--r--scripts/build/arch/openrisc.sh6
-rw-r--r--scripts/build/arch/parisc.sh14
-rw-r--r--scripts/build/arch/rx.sh5
-rw-r--r--scripts/build/arch/sh.sh38
-rw-r--r--scripts/build/arch/tricore.sh9
-rw-r--r--scripts/build/binutils/binutils.sh21
-rw-r--r--scripts/build/cc/gcc.sh94
-rw-r--r--scripts/build/companion_libs/050-zlib.sh2
-rw-r--r--scripts/build/companion_libs/070-zstd.sh16
-rw-r--r--scripts/build/companion_libs/100-gmp.sh4
-rw-r--r--scripts/build/companion_libs/220-ncurses.sh4
-rw-r--r--scripts/build/companion_libs/340-picolibc.sh28
-rw-r--r--scripts/build/companion_libs/400-gnuprumcu.sh19
-rw-r--r--scripts/build/debug/300-gdb.sh37
-rw-r--r--scripts/build/kernel/hurd.sh71
-rw-r--r--scripts/build/libc/avr-libc.sh4
-rw-r--r--scripts/build/libc/glibc.sh8
-rw-r--r--scripts/build/libc/mingw-w64.sh1
-rw-r--r--scripts/build/libc/newlib.sh3
-rw-r--r--scripts/build/linker.sh38
-rw-r--r--scripts/build/linker/100-mold.sh40
-rw-r--r--scripts/build/test_suite/gcc.sh13
23 files changed, 391 insertions, 90 deletions
diff --git a/scripts/build/arch/lm32.sh b/scripts/build/arch/lm32.sh
new file mode 100644
index 00000000..77e7c2cb
--- /dev/null
+++ b/scripts/build/arch/lm32.sh
@@ -0,0 +1,6 @@
+# Compute LM32-specific values
+
+CT_DoArchTupleValues() {
+ # Do nothing here. Default values are sane.
+ :;
+}
diff --git a/scripts/build/arch/openrisc.sh b/scripts/build/arch/openrisc.sh
new file mode 100644
index 00000000..7b467540
--- /dev/null
+++ b/scripts/build/arch/openrisc.sh
@@ -0,0 +1,6 @@
+# Compute OpenRISC-specific values
+
+CT_DoArchTupleValues() {
+ CT_TARGET_ARCH="or1k"
+ :;
+}
diff --git a/scripts/build/arch/parisc.sh b/scripts/build/arch/parisc.sh
new file mode 100644
index 00000000..fce59c31
--- /dev/null
+++ b/scripts/build/arch/parisc.sh
@@ -0,0 +1,14 @@
+# Compute parisc-specific values
+
+CT_DoArchTupleValues()
+{
+ # The architecture part of the tuple:
+ CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}"
+}
+
+CT_DoArchUClibcConfig()
+{
+ local cfg="${1}"
+
+ CT_DoArchUClibcSelectArch "${cfg}" "parisc"
+}
diff --git a/scripts/build/arch/rx.sh b/scripts/build/arch/rx.sh
new file mode 100644
index 00000000..88bdb5f4
--- /dev/null
+++ b/scripts/build/arch/rx.sh
@@ -0,0 +1,5 @@
+# Compute RX values
+
+CT_DoArchTupleValues() {
+ :;
+}
diff --git a/scripts/build/arch/sh.sh b/scripts/build/arch/sh.sh
index 8339b940..6fe2e9e5 100644
--- a/scripts/build/arch/sh.sh
+++ b/scripts/build/arch/sh.sh
@@ -5,7 +5,7 @@ CT_DoArchTupleValues () {
# like 'sheb-unknown-elf' even though GCC does. So keep the tuple just sh-*-elf
# unless user wants something specific (either CPU or explicit suffix).
if [ "${CT_ARCH_SH_VARIANT}" != "sh" -o -n "${CT_ARCH_SUFFIX}" ]; then
- CT_TARGET_ARCH="${CT_ARCH_SH_VARIANT}${CT_ARCH_SUFFIX:-${target_endian_eb}}"
+ CT_TARGET_ARCH="${CT_ARCH_SH_VARIANT}${CT_ARCH_SUFFIX:-${CT_ARCH_SH_FLOAT_SUFFIX}${target_endian_eb}}"
fi
# Endianness stuff (uses non-standard CFLAGS). If both are compiled, let the
@@ -17,20 +17,9 @@ CT_DoArchTupleValues () {
# Instead of -m{soft,hard}-float, uses CPU type
CT_ARCH_FLOAT_CFLAG=
- case "${CT_ARCH_SH_VARIANT}" in
- sh3) CT_ARCH_ARCH_CFLAG=-m3;;
- sh4*|sh2*)
- # softfp is not possible for SuperH, no need to test for it.
- case "${CT_ARCH_FLOAT}" in
- hard)
- CT_ARCH_ARCH_CFLAG="-m${CT_ARCH_SH_VARIANT##sh}"
- ;;
- soft)
- CT_ARCH_ARCH_CFLAG="-m${CT_ARCH_SH_VARIANT##sh}-nofpu"
- ;;
- esac
- ;;
- esac
+ if [ "${CT_ARCH_SH_VARIANT}" != "sh" ]; then
+ CT_ARCH_ARCH_CFLAG=-m${CT_ARCH_SH_VARIANT#sh}-${CT_ARCH_SH_FLOAT_SUFFIX#_}
+ fi
}
CT_DoArchMultilibList() {
@@ -47,11 +36,11 @@ CT_DoArchMultilibList() {
# the default CPU configured with --with-cpu (CT_ARCH_CPU).
IFS=,
for x in ${CT_CC_GCC_MULTILIB_LIST}; do
- if [ "${x}" = "${CT_ARCH_SH_VARIANT}" -o "sh${x#m}" = "${CT_ARCH_SH_VARIANT}" ]; then
+ if [ "${x}" = "${CT_ARCH_ARCH_CFLAG#-}" -o "sh${x#m}" = "${CT_ARCH_ARCH_CFLAG#-}" ]; then
CT_DoLog WARN "Ignoring '${x}' in multilib list: it is the default multilib"
continue
fi
- if [ "${x}" = "${CT_ARCH_CPU}" -o "sh${x#m}" = "${CT_ARCH_CPU}" ]; then
+ if [ "${x}" = "${CT_ARCH_CPU}" -o "sh${x#m}" = "${CT_ARCH_CPU}" -o "m${x#sh}" = "${CT_ARCH_CPU}" ]; then
CT_DoLog WARN "Ignoring '${x}' in multilib list: it is the default multilib"
continue
fi
@@ -74,10 +63,7 @@ CT_DoArchMultilibTarget ()
for m in "${multi_flags[@]}"; do
case "${m}" in
- -m4*) newcpu=sh4;;
- -m3*) newcpu=sh3;;
- -m2*) newcpu=sh2;;
- -m1*) newcpu=sh1;;
+ -m[12345]*) newcpu=sh${m#-m}; newcpu=${newcpu/_/-}; newcpu=${newcpu/_/-};;
esac
done
@@ -96,6 +82,7 @@ CT_DoArchMultilibTarget ()
CT_DoArchGlibcAdjustTuple() {
local target_var="${1}"
local target_
+ local newtarget
eval target_=\"\${${target_var}}\"
@@ -106,7 +93,10 @@ CT_DoArchGlibcAdjustTuple() {
# specified, so the only source of default is CT_ARCH_CPU.
# GCC defaults to sh1, but this Glibc cannot compile for it.
if [ -n "${CT_ARCH_CPU}" ]; then
- target_=${target_/#sh-/${CT_ARCH_CPU}-}
+ newtarget=${CT_ARCH_CPU/#m/sh}
+ newtarget=${newtarget/-/_}
+ newtarget=${newtarget/-/_}
+ target_="${newtarget}-${target_#*-}"
CT_DoLog DEBUG "Adjusted target tuple ${target_}"
else
CT_Abort "GNU C library cannot build for sh1 (GCC default). " \
@@ -142,10 +132,10 @@ CT_DoArchGlibcAdjustConfigure() {
# and it would've been handled above. Our last resort: CT_ARCH_CPU
if [ "${#add_args[@]}" = 0 ]; then
case "${CT_ARCH_CPU}" in
- sh[34]*-nofpu)
+ sh[24]a-nofpu | m[24]a-nofpu | sh4-nofpu | m4-nofpu)
add_args+=( "--without-fp" )
;;
- sh[34]*)
+ *)
add_args+=( "--with-fp" )
;;
esac
diff --git a/scripts/build/arch/tricore.sh b/scripts/build/arch/tricore.sh
new file mode 100644
index 00000000..1051b56f
--- /dev/null
+++ b/scripts/build/arch/tricore.sh
@@ -0,0 +1,9 @@
+# Compute tricore-specific values
+
+CT_DoArchTupleValues()
+{
+ # The architecture part of the tuple:
+ CT_TARGET_ARCH="${CT_ARCH}${CT_ARCH_SUFFIX}"
+ CT_ARCH_ENDIAN_CFLAG=""
+ CT_ARCH_ENDIAN_LDFLAG=""
+}
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index eff19c46..6ae2f7cb 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -182,9 +182,15 @@ do_binutils_backend() {
extra_config+=("--without-zstd")
fi
- # Disable usage of glob for higher compatibility.
- # Not strictly needed for anything but GDB anyways.
- export ac_cv_func_glob=no
+ # gold links with CXXLINK/g++, not libtool, and does not understand
+ # -all-static
+ if [ "${static_build}" = "y" ]; then
+ case "${CT_BINUTILS_LINKERS_LIST}" in
+ *gold*)
+ extra_config+=("--with-gold-ldflags=--static")
+ ;;
+ esac
+ fi
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
@@ -215,6 +221,13 @@ do_binutils_backend() {
fi
CT_DoLog EXTRA "Building binutils"
+ if [ "${static_build}" = "y" ]; then
+ case "${CT_BINUTILS_LINKERS_LIST}" in
+ *gold*)
+ CT_DoExecLog ALL make -C gold ${CT_JOBSFLAGS}
+ ;;
+ esac
+ fi
CT_DoExecLog ALL make "${extra_make_flags[@]}" ${CT_JOBSFLAGS}
CT_DoLog EXTRA "Installing binutils"
@@ -295,7 +308,7 @@ do_elf2flt_backend() {
--prefix=${prefix} \
--with-bfd-include-dir=${binutils_bld}/bfd \
--with-binutils-include-dir=${binutils_src}/include \
- --with-libbfd=${binutils_bld}/bfd/libbfd.a \
+ --with-libbfd=${binutils_bld}/bfd/.libs/libbfd.a \
--with-libiberty=${binutils_bld}/libiberty/libiberty.a \
--disable-werror \
${elf2flt_opts} \
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index 275e239c..57f5f222 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -43,7 +43,7 @@ cc_gcc_lang_list() {
[ "${CT_CC_LANG_CXX}" = "y" ] && lang_list+=",c++"
[ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_list+=",fortran"
[ "${CT_CC_LANG_ADA}" = "y" ] && lang_list+=",ada"
- [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d"
+ [ "${CT_CC_LANG_D}" = "y" ] && lang_list+=",d"
[ "${CT_CC_LANG_JAVA}" = "y" ] && lang_list+=",java"
[ "${CT_CC_LANG_JIT}" = "y" ] && lang_list+=",jit"
[ "${CT_CC_LANG_OBJC}" = "y" ] && lang_list+=",objc"
@@ -282,6 +282,7 @@ do_gcc_core_backend() {
gcc_build|gcc_host)
CT_DoLog EXTRA "Configuring final gcc compiler"
extra_config+=( "${CT_CC_SYSROOT_ARG[@]}" )
+ extra_config+=( "--with-headers=${CT_PREFIX_DIR}/${CT_TARGET}/include" )
extra_user_config=( "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" )
log_txt="final gcc compiler"
# to inhibit the libiberty and libgcc tricks later on
@@ -388,16 +389,32 @@ do_gcc_core_backend() {
"") extra_config+=("--disable-libstdcxx-verbose");;
esac
+ if [ "${build_libstdcxx}" = "yes" ]; then
+ if [ "x${CT_CC_GCC_LIBSTDCXX}" = "x" ]; then
+ build_libstdcxx="no"
+ elif [ "${CT_CC_GCC_LIBSTDCXX}" = "y" ]; then
+ extra_config+=("--enable-libstdcxx")
+ fi
+
+ if [ "${CT_LIBC_AVR_LIBC}" = "y" ]; then
+ extra_config+=("--enable-cstdio=stdio_pure")
+ fi
+
+ if [ "${CT_CC_GCC_LIBSTDCXX_HOSTED_DISABLE}" = "y" ]; then
+ extra_config+=("--disable-libstdcxx-hosted")
+ fi
+ fi
+
if [ "${build_libstdcxx}" = "no" ]; then
extra_config+=(--disable-libstdcxx)
fi
if [ "${CT_LIBC_PICOLIBC}" = "y" ]; then
- extra_config+=("--with-default-libc=picolibc")
- extra_config+=("--enable-stdio=pure")
- if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then
- extra_config+=("--disable-wchar_t")
- fi
+ extra_config+=("--with-default-libc=picolibc")
+ extra_config+=("--enable-stdio=pure")
+ if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then
+ extra_config+=("--disable-wchar_t")
+ fi
fi
core_LDFLAGS+=("${ldflags}")
@@ -494,6 +511,12 @@ do_gcc_core_backend() {
*) extra_config+=( "--enable-decimal-float=${CT_CC_GCC_DEC_FLOATS}" );;
esac
+ if [ "${CT_CC_GCC_ENABLE_PLUGINS}" = "y" ]; then
+ extra_config+=( --enable-plugin )
+ else
+ extra_config+=( --disable-plugin )
+ fi
+
case "${CT_ARCH}" in
mips)
case "${CT_CC_GCC_mips_llsc}" in
@@ -528,6 +551,22 @@ do_gcc_core_backend() {
"") extra_config+=("--disable-tls");;
esac
+ # In baremetal, we only build the Ada compiler without its runtime.
+ # The runtime will need to be provided externaly by the user.
+ if [ "${mode}" = "baremetal" \
+ -a "${CT_CC_LANG_ADA}" = "y" \
+ ]; then
+ extra_config+=("--disable-libada" )
+ fi
+
+ # In baremetal, we only build the D compiler without its runtime.
+ # The runtime will need to be provided externaly by the user.
+ if [ "${mode}" = "baremetal" \
+ -a "${CT_CC_LANG_D}" = "y" \
+ ]; then
+ extra_config+=("--disable-libphobos" )
+ fi
+
# Some versions of gcc have a defective --enable-multilib.
# Since that's the default, only pass --disable-multilib. For multilib,
# also enable multiarch. Without explicit --enable-multiarch, core
@@ -680,9 +719,7 @@ do_gcc_core_backend() {
else # build_libgcc
core_targets=( gcc )
fi # ! build libgcc
- if [ "${build_libstdcxx}" = "yes" \
- -a "${CT_CC_LANG_CXX}" = "y" \
- ]; then
+ if [ "${build_libstdcxx}" = "yes" ]; then
core_targets+=( target-libstdc++-v3 )
fi
@@ -710,6 +747,14 @@ do_gcc_core_backend() {
CT_DoLog EXTRA "Building ${log_txt}"
CT_DoExecLog ALL make ${CT_JOBSFLAGS} ${core_targets_all}
+ # In case of baremetal, the gnat* tools are not built automatically.
+ if [ "${mode}" = "baremetal" \
+ -a "${CT_CC_LANG_ADA}" = "y" \
+ ]; then
+ CT_DoLog EXTRA "Building gnattools for baremetal"
+ CT_DoExecLog ALL make -C gcc ${CT_JOBSFLAGS} cross-gnattools
+ fi
+
# Do not pass ${CT_JOBSFLAGS} here: recent GCC builds have been failing
# in parallel 'make install' at random locations: libitm, libcilk,
# always for the files that are installed more than once to the same
@@ -785,9 +830,7 @@ do_cc_for_build() {
# lack of such a compiler, but better safe than sorry...
build_final_opts+=( "mode=baremetal" )
build_final_opts+=( "build_libgcc=yes" )
- if [ "${CT_LIBC_NONE}" != "y" ]; then
- build_final_opts+=( "build_libstdcxx=yes" )
- fi
+ build_final_opts+=( "build_libstdcxx=yes" )
build_final_opts+=( "build_libgfortran=yes" )
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
build_final_opts+=( "build_staticlinked=yes" )
@@ -870,15 +913,14 @@ do_cc_for_host() {
final_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
final_opts+=( "lang_list=$( cc_gcc_lang_list )" )
final_opts+=( "build_step=gcc_host" )
+ final_opts+=( "extra_cxxflags_for_target=${CT_CC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" )
if [ "${CT_BUILD_MANUALS}" = "y" ]; then
final_opts+=( "build_manuals=yes" )
fi
if [ "${CT_BARE_METAL}" = "y" ]; then
final_opts+=( "mode=baremetal" )
final_opts+=( "build_libgcc=yes" )
- if [ "${CT_LIBC_NONE}" != "y" ]; then
- final_opts+=( "build_libstdcxx=yes" )
- fi
+ final_opts+=( "build_libstdcxx=yes" )
final_opts+=( "build_libgfortran=yes" )
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
final_opts+=( "build_staticlinked=yes" )
@@ -1050,16 +1092,24 @@ do_gcc_backend() {
"") extra_config+=("--disable-libstdcxx-verbose");;
esac
- if [ "${build_libstdcxx}" = "no" ]; then
+ if [ "x${CT_CC_GCC_LIBSTDCXX}" = "x" ]; then
extra_config+=(--disable-libstdcxx)
- elif [ "${CT_CC_GCC_EXTRA_LIBSTDCXX}" = "y" ]; then
+ elif [ "${CT_CC_GCC_LIBSTDCXX}" = "y" ]; then
extra_config+=(--enable-libstdcxx)
fi
+ if [ "${CT_CC_GCC_LIBSTDCXX_HOSTED_DISABLE}" = "y" ]; then
+ extra_config+=("--disable-libstdcxx-hosted")
+ fi
+
+ if [ "${CT_LIBC_AVR_LIBC}" = "y" ]; then
+ extra_config+=("--enable-cstdio=stdio_pure")
+ fi
+
if [ "${CT_LIBC_PICOLIBC}" = "y" ]; then
- extra_config+=("--with-default-libc=picolibc")
- extra_config+=("--enable-stdio=pure")
- extra_config+=("--disable-wchar_t")
+ extra_config+=("--with-default-libc=picolibc")
+ extra_config+=("--enable-stdio=pure")
+ extra_config+=("--disable-wchar_t")
fi
final_LDFLAGS+=("${ldflags}")
@@ -1126,6 +1176,10 @@ do_gcc_backend() {
fi
fi
+ if [ "${CT_CC_GCC_ENABLE_DEFAULT_PIE}" = "y" ]; then
+ extra_config+=("--enable-default-pie")
+ fi
+
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ] || \
[ "${enable_optspace}" = "yes" ]; then
extra_config+=("--enable-target-optspace")
diff --git a/scripts/build/companion_libs/050-zlib.sh b/scripts/build/companion_libs/050-zlib.sh
index 07c95496..fff326b2 100644
--- a/scripts/build/companion_libs/050-zlib.sh
+++ b/scripts/build/companion_libs/050-zlib.sh
@@ -92,8 +92,6 @@ do_zlib_backend() {
cp -av "${CT_SRC_DIR}/zlib/." .
extra_make=( -f win32/Makefile.gcc \
PREFIX="${host}-" \
- SHAREDLIB= \
- IMPLIB= \
LIBRARY_PATH="${prefix}/lib" \
INCLUDE_PATH="${prefix}/include" \
BINARY_PATH="${prefix}/bin" \
diff --git a/scripts/build/companion_libs/070-zstd.sh b/scripts/build/companion_libs/070-zstd.sh
index bc334142..d8ef8c2e 100644
--- a/scripts/build/companion_libs/070-zstd.sh
+++ b/scripts/build/companion_libs/070-zstd.sh
@@ -81,19 +81,9 @@ do_zstd_backend() {
done
CT_DoLog EXTRA "Building zstd"
- CT_DoExecLog ALL make ${CT_JOBSFLAGS} -C "${CT_SRC_DIR}/zstd/lib" libzstd.a BUILD_DIR="${PWD}" CC="${host}-gcc" AS="${host}-as" CFLAGS="${cflags}" LDFLAGS="${ldflags}"
-
- # TODO: Has to be tested
-
- #if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
- # if [ "${host}" = "${CT_BUILD}" ]; then
- # CT_DoLog EXTRA "Checking zstd"
- # CT_DoExecLog ALL make ${CT_JOBSFLAGS} -s check
- # else
- # # Cannot run host binaries on build in a canadian cross
- # CT_DoLog EXTRA "Skipping check for zstd on the host"
- # fi
- #fi
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS} -C "${CT_SRC_DIR}/zstd/lib" libzstd.a-nomt-release BUILD_DIR="${PWD}" CC="${host}-gcc" AS="${host}-as" CFLAGS="${cflags}" LDFLAGS="${ldflags}"
+
+ # There is no library only check in zstd
CT_DoLog EXTRA "Installing zstd"
CT_DoExecLog ALL make -C "${CT_SRC_DIR}/zstd/lib" install-static install-includes BUILD_DIR="${PWD}" PREFIX="$prefix"
diff --git a/scripts/build/companion_libs/100-gmp.sh b/scripts/build/companion_libs/100-gmp.sh
index 28deff97..4ecaa721 100644
--- a/scripts/build/companion_libs/100-gmp.sh
+++ b/scripts/build/companion_libs/100-gmp.sh
@@ -122,12 +122,14 @@ do_gmp_backend() {
extra_config+=("--with-pic")
fi
+ cflags+=" ${CT_GMP_EXTRA_CFLAGS}"
+
# GMP's configure script doesn't respect the host parameter
# when not cross-compiling, ie when build == host so set
# CC_FOR_BUILD and CPP_FOR_BUILD.
CT_DoExecLog CFG \
CC_FOR_BUILD="${CT_BUILD}-gcc" \
- CPP_FOR_BUILD="{CT_BUILD}-cpp" \
+ CPP_FOR_BUILD="${CT_BUILD}-cpp" \
CC="${host}-gcc" \
CFLAGS="${cflags} -fexceptions" \
LDFLAGS="${ldflags}" \
diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh
index f1fcd1a1..36aadae6 100644
--- a/scripts/build/companion_libs/220-ncurses.sh
+++ b/scripts/build/companion_libs/220-ncurses.sh
@@ -133,6 +133,8 @@ do_ncurses_backend() {
esac
done
+ ncurses_opts+=("--disable-widec")
+
if [ "${CT_NCURSES_NEW_ABI}" != "y" ]; then
ncurses_opts+=("--with-abi-version=5")
fi
@@ -150,6 +152,8 @@ do_ncurses_backend() {
ncurses_opts+=("--with-shared")
fi
+ cflags+=" ${CT_NCURSES_EXTRA_CFLAGS}"
+
CT_DoLog EXTRA "Configuring ncurses"
CT_DoExecLog CFG \
CFLAGS="${cflags}" \
diff --git a/scripts/build/companion_libs/340-picolibc.sh b/scripts/build/companion_libs/340-picolibc.sh
index 0b2038e6..bef72e0f 100644
--- a/scripts/build/companion_libs/340-picolibc.sh
+++ b/scripts/build/companion_libs/340-picolibc.sh
@@ -26,13 +26,7 @@ do_picolibc_common_install() {
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
@@ -48,6 +42,24 @@ RETARGETABLE_LOCKING:newlib-retargetable-locking
fi
done
+ # Check how picolibc wants threading support to be specified
+
+ if grep -q single-thread "${CT_SRC_DIR}/picolibc/meson_options.txt"; then
+ if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then
+ picolibc_opts+=("-Dsingle-thread=false")
+ else
+ picolibc_opts+=("-Dsingle-thread=true")
+ fi
+ else
+ if [ "${CT_LIBC_PICOLIBC_MULTITHREAD}" = "y" ]; then
+ picolibc_opts+=("-Dnewlib-retargetable-locking=true")
+ picolibc_opts+=("-Dnewlib-multithread=true")
+ else
+ picolibc_opts+=("-Dnewlib-retargetable-locking=false")
+ picolibc_opts+=("-Dnewlib-multithread=false")
+ fi
+ fi
+
[ "${CT_LIBC_PICOLIBC_EXTRA_SECTIONS}" = "y" ] && \
CT_LIBC_PICOLIBC_TARGET_CFLAGS="${CT_LIBC_PICOLIBC_TARGET_CFLAGS} -ffunction-sections -fdata-sections"
@@ -150,12 +162,16 @@ do_cc_libstdcxx_picolibc()
final_opts+=( "lang_list=c,c++" )
final_opts+=( "build_step=libstdcxx" )
final_opts+=( "extra_config+=('--enable-stdio=stdio_pure')" )
+ final_opts+=( "extra_config+=('--with-headers=${CT_PREFIX_DIR}/picolibc/include')" )
if [ "${CT_PICOLIBC_older_than_1_8}" = "y" ]; then
final_opts+=( "extra_config+=('--disable-wchar_t')" )
fi
if [ "${CT_LIBC_PICOLIBC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
final_opts+=( "enable_optspace=yes" )
fi
+ if [ -n "${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" ]; then
+ final_opts+=( "extra_cxxflags_for_target=${CT_LIBC_PICOLIBC_GCC_LIBSTDCXX_TARGET_CXXFLAGS}" )
+ fi
if [ "${CT_BARE_METAL}" = "y" ]; then
final_opts+=( "mode=baremetal" )
diff --git a/scripts/build/companion_libs/400-gnuprumcu.sh b/scripts/build/companion_libs/400-gnuprumcu.sh
index bba85748..7d17853c 100644
--- a/scripts/build/companion_libs/400-gnuprumcu.sh
+++ b/scripts/build/companion_libs/400-gnuprumcu.sh
@@ -19,6 +19,22 @@ do_gnuprumcu_extract() {
do_gnuprumcu_for_target() {
local -a gnuprumcu_opts
+ local -a cflags
+
+ cflags=${CT_ALL_TARGET_CFLAGS}
+
+ # When building a canadian, newlib is installed
+ # only in the host' sysroot. Thus the build toolchain
+ # lacks CRT0 and LibC objects. Consequently the
+ # gnuprumcu configure script fails with:
+ # .../ld: cannot find crt0.o: No such file or directory
+ # configure:3738: error: C compiler cannot create executables
+ #
+ # Fix by pointing the build toolchain to the host sysroot,
+ # where the necessary target runtime files are available.
+ case "${CT_TOOLCHAIN_TYPE}" in
+ canadian) cflags="${cflags} --sysroot=${CT_SYSROOT_DIR}";;
+ esac
CT_DoStep INFO "Installing gnuprumcu for the target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-gnuprumcu-target-${CT_TARGET}"
@@ -26,7 +42,8 @@ do_gnuprumcu_for_target() {
gnuprumcu_opts+=( "destdir=${CT_SYSROOT_DIR}" )
gnuprumcu_opts+=( "host=${CT_TARGET}" )
- gnuprumcu_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" )
+ gnuprumcu_opts+=( "cflags=${cflags}" )
+ gnuprumcu_opts+=( "ldflags=${CT_ALL_TARGET_LDFLAGS}" )
gnuprumcu_opts+=( "prefix=${CT_PREFIX_DIR}" )
do_gnuprumcu_backend "${gnuprumcu_opts[@]}"
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 8860b541..508ba25f 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -66,8 +66,8 @@ do_debug_gdb_build()
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
- extra_config+=("--with-expat")
- extra_config+=("--without-libexpat-prefix")
+ cross_extra_config+=("--with-expat")
+ cross_extra_config+=("--without-libexpat-prefix")
# ct-ng always builds ncurses in cross mode as a static library.
# Starting from the patchset 20200718 ncurses defines a special macro
@@ -122,6 +122,14 @@ do_debug_gdb_build()
native_extra_config+=("--program-prefix=")
+ # Starting from GDB 11.x, gmp is needed as a dependency to build full
+ # gdb. And if target GMP gets built, explicitly point to installed library,
+ # as otherwise host library might be attempted to be used for target binary
+ # linkage.
+ if [ "${CT_GMP_TARGET}" = "y" ]; then
+ native_extra_config+=("--with-libgmp-prefix=${CT_SYSROOT_DIR}")
+ fi
+
# gdbserver gets enabled by default with gdb
# since gdbserver was promoted to top-level
if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" = "y" ]; then
@@ -167,17 +175,14 @@ do_debug_gdb_build()
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
- # To prevent this '--without-libexpat-prefix' flag must be passed.
- # Thus configure falls back to '-lexpat', which is exactly what we want.
- #
- # NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
- # It conflicts with a static build: GDB's configure script will find the shared
- # version of expat and will attempt to link that, despite the -static flag.
- # The link will fail, and configure will abort with "expat missing or unusable"
- # message.
- native_extra_config+=("--with-expat")
- native_extra_config+=("--without-libexpat-prefix")
+ native_extra_config+=("--with-expat=y")
+ native_extra_config+=("--with-libexpat-prefix=${CT_BUILDTOOLS_PREFIX_DIR}")
+ # Without specifying libexpat type, configure would look for -lexpat
+ # and try to link with shared library, set library type explicitly.
+ if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
+ native_extra_config+=("--with-libexpat-type=static")
+ fi
do_gdb_backend \
buildtype=native \
subdir=${subdir} \
@@ -348,7 +353,13 @@ do_gdb_backend()
"${extra_config[@]}" \
if [ "${static}" = "y" ]; then
- extra_make_flags+=("LDFLAGS=${ldflags} -all-static")
+ if [ "${CT_GDB_CC_LD_LIBTOOL}" = "y" ]; then
+ # gdb is linked with libtool, but gdbserver is not
+ # Both linker accept -static --static and create static binaries
+ extra_make_flags+=("LDFLAGS=${ldflags} -static --static")
+ else
+ extra_make_flags+=("LDFLAGS=${ldflags} -static")
+ fi
CT_DoLog EXTRA "Prepare gdb for static build"
CT_DoExecLog ALL make ${CT_JOBSFLAGS} configure-host
fi
diff --git a/scripts/build/kernel/hurd.sh b/scripts/build/kernel/hurd.sh
new file mode 100644
index 00000000..fcda95bc
--- /dev/null
+++ b/scripts/build/kernel/hurd.sh
@@ -0,0 +1,71 @@
+# This file declares functions to install the kernel headers for linux
+# Copyright 2007 Yann E. MORIN
+# Licensed under the GPL v2. See COPYING in the root of this package
+
+CT_DoKernelTupleValues()
+{
+ :
+}
+
+# Download the kernel
+do_kernel_get()
+{
+ CT_Fetch HURD
+ CT_Fetch GNUMACH
+ CT_Fetch MIG
+}
+
+# Extract kernel
+do_kernel_extract()
+{
+ # TBD verify linux_disable_build_relocs is run
+ CT_ExtractPatch HURD
+ CT_ExtractPatch GNUMACH
+ CT_ExtractPatch MIG
+}
+
+# Install kernel headers using headers_install from kernel sources.
+do_kernel_headers()
+{
+ CT_DoStep INFO "Installing kernel headers"
+
+ for component in gnumach mig hurd; do
+ local build_dir="${CT_BUILD_DIR}/${component}"
+ local src_dir="${CT_SRC_DIR}/${component}"
+
+ CT_mkdir_pushd "${build_dir}"
+ CT_DoLog EXTRA "crupest PATH $PATH"
+
+ case ${component} in
+ gnumach)
+ CT_DoLog EXTRA "Installing GNU Mach headers"
+ CT_DoExecLog ALL \
+ ${src_dir}/configure \
+ --host="${CT_TARGET}" \
+ --prefix="/usr"
+ CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install-data
+ ;;
+ mig)
+ CT_DoLog EXTRA "Installing GNU MIG"
+ CT_DoExecLog ALL \
+ ${src_dir}/configure \
+ --target="${CT_TARGET}" \
+ --prefix="/usr"
+ CT_DoExecLog ALL \
+ make TARGET_CFLAGS="-isysroot ${CT_SYSROOT_DIR}" install
+ ;;
+ hurd)
+ CT_DoLog EXTRA "Installing Hurd headers"
+ CT_DoExecLog ALL \
+ ${src_dir}/configure \
+ --host="${CT_TARGET}" \
+ --prefix="/usr"
+ CT_DoExecLog ALL make prefix="${CT_SYSROOT_DIR}/usr" install-data-local-headers
+ ;;
+ esac
+
+ CT_Popd
+ done
+
+ CT_EndStep
+}
diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh
index c13ae39b..4949380a 100644
--- a/scripts/build/libc/avr-libc.sh
+++ b/scripts/build/libc/avr-libc.sh
@@ -2,7 +2,7 @@
avr_libc_post_cc()
{
- if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then
+ if [ "${CT_CC_CORE_NEEDED}" != "y" ]; then
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
@@ -32,7 +32,7 @@ avr_libc_post_cc()
avr_libc_main()
{
- if [ "${CT_CC_CORE_PASS_2_NEEDED}" = "y" ]; then
+ if [ "${CT_CC_CORE_NEEDED}" = "y" ]; then
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 280eb124..043660c1 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -182,6 +182,10 @@ glibc_backend_once()
# or even after they get installed...
echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
+ if [ "${CT_GLIBC_MAKEINFO_WORKAROUND}" = "y" ]; then
+ echo "ac_cv_prog_MAKEINFO=" >>config.cache
+ fi
+
CT_SymlinkToolsMultilib
# Configure with --prefix the way we want it on the target...
@@ -249,8 +253,8 @@ glibc_backend_once()
build_cppflags="${build_cppflags} -I${CT_BUILDTOOLS_PREFIX_DIR}/include/"
build_ldflags="${build_ldflags} -lintl -liconv"
case "$CT_BUILD" in
- *cygwin*|*freebsd*)
- # Additionally, stat in FreeBSD, Cygwin, and possibly others
+ *cygwin*|*freebsd*|aarch64*darwin*)
+ # Additionally, stat in FreeBSD, Cygwin, Darwin arm64 and possibly others
# is always 64bit, so replace struct stat64 with stat.
build_cppflags="${build_cppflags} -Dstat64=stat"
;;
diff --git a/scripts/build/libc/mingw-w64.sh b/scripts/build/libc/mingw-w64.sh
index d4f3634f..6224deba 100644
--- a/scripts/build/libc/mingw-w64.sh
+++ b/scripts/build/libc/mingw-w64.sh
@@ -208,6 +208,7 @@ mingw_w64_main()
--prefix=${MINGW_INSTALL_PREFIX} \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
+ --enable-wildcard \
"${crt_opts[@]}"
# mingw-w64-crt has a missing dependency occasionally breaking the
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index 72111a93..21d13773 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -89,6 +89,9 @@ ENABLE_TARGET_OPTSPACE:target-optspace
[ "${CT_LIBC_NEWLIB_LTO}" = "y" ] && \
CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -flto"
+ [ "${CT_GCC_14_or_later}" = "y" ] && \
+ CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -Wno-error=implicit-function-declaration -Wno-implicit-int"
+
cflags_for_target="${CT_ALL_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}"
# Note: newlib handles the build/host/target a little bit differently
diff --git a/scripts/build/linker.sh b/scripts/build/linker.sh
new file mode 100644
index 00000000..235d7cf6
--- /dev/null
+++ b/scripts/build/linker.sh
@@ -0,0 +1,38 @@
+# Wrapper to build the standalone linkers
+
+# List all linkers, and parse their scripts
+CT_LINKER_LIST=
+for f in "${CT_LIB_DIR}/scripts/build/linker/"*.sh; do
+ _f="$(basename "${f}" .sh)"
+ _f="${_f#???-}"
+ __f="CT_LINKER_${_f^^}"
+ if [ "${!__f}" = "y" ]; then
+ CT_DoLog DEBUG "Enabling linker '${_f}'"
+ . "${f}"
+ CT_LINKER_LIST="${CT_LINKER_LIST} ${_f}"
+ else
+ CT_DoLog DEBUG "Disabling linker '${_f}'"
+ fi
+done
+
+# Download the linkers
+do_linker_get() {
+ for f in ${CT_LINKER_LIST}; do
+ do_linker_${f}_get
+ done
+}
+
+# Extract and patch the linkers
+do_linker_extract() {
+ for f in ${CT_LINKER_LIST}; do
+ do_linker_${f}_extract
+ done
+}
+
+# Build the linkers
+do_linker() {
+ for f in ${CT_LINKER_LIST}; do
+ do_linker_${f}_build
+ done
+}
+
diff --git a/scripts/build/linker/100-mold.sh b/scripts/build/linker/100-mold.sh
new file mode 100644
index 00000000..c743c9c7
--- /dev/null
+++ b/scripts/build/linker/100-mold.sh
@@ -0,0 +1,40 @@
+# Build script for the mold linker
+
+do_linker_mold_get() {
+ CT_Fetch MOLD
+}
+
+do_linker_mold_extract() {
+ CT_ExtractPatch MOLD
+}
+
+do_linker_mold_build() {
+ local target_dir="${CT_PREFIX_DIR}/${CT_TARGET}"
+
+ CT_DoStep INFO "Installing mold for host"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mold"
+
+ CT_DoLog EXTRA "Configuring mold for host"
+ CT_DoExecLog CFG \
+ CC="${CT_HOST}-gcc" \
+ CXX="${CT_HOST}-g++" \
+ CFLAGS="${CT_CFLAGS_FOR_HOST}" \
+ LDFLAGS="${CT_LDFLAGS_FOR_HOST}" \
+ cmake "${CT_SRC_DIR}/mold" \
+ -DBUILD_TESTING=OFF \
+ -DMOLD_MOSTLY_STATIC=ON \
+ -DCMAKE_BUILD_TYPE=Release
+
+ CT_DoLog EXTRA "Building mold for host"
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing mold for host"
+ mkdir -p "${target_dir}/bin"
+ cp mold "${target_dir}/bin"
+ ln -s mold "${target_dir}/bin/ld.mold"
+ mkdir -p "${target_dir}/lib/mold"
+ cp mold-wrapper.so "${target_dir}/lib/mold"
+
+ CT_Popd
+ CT_EndStep
+}
diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh
index 6c6e5a72..25eee5ad 100644
--- a/scripts/build/test_suite/gcc.sh
+++ b/scripts/build/test_suite/gcc.sh
@@ -21,8 +21,17 @@ do_test_suite_gcc_build() {
"${CT_SRC_DIR}/gcc/gcc/testsuite" \
"${CT_TEST_SUITE_DIR}/gcc"
- CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \
- "${CT_TEST_SUITE_DIR}/gcc/Makefile"
+ DG_QEMU_ARGS=`echo "${CT_TEST_SUITE_GCC_QEMU_ARGS}" | sed 's/@SYSROOT@/$(SYSROOT)/'`
+
+ CT_DoExecLog ALL sed -i -r \
+ -e "s/@@DG_TARGET@@/${CT_TARGET}/g" \
+ -e "s/@@DG_SSH@@/${CT_TEST_SUITE_GCC_SSH}/g" \
+ -e "s/@@DG_QEMU@@/${CT_TEST_SUITE_GCC_QEMU}/g" \
+ -e "s/@@DG_TARGET_HOSTNAME@@/${CT_TEST_SUITE_GCC_TARGET_HOSTNAME}/g" \
+ -e "s/@@DG_TARGET_USERNAME@@/${CT_TEST_SUITE_GCC_TARGET_USERNAME}/g" \
+ -e "s/@@DG_QEMU_PROGRAM@@/${CT_TEST_SUITE_GCC_QEMU_PROGRAM}/g" \
+ -e "s/@@DG_QEMU_ARGS@@/${DG_QEMU_ARGS}/g" \
+ "${CT_TEST_SUITE_DIR}/gcc/default.cfg"
CT_EndStep
}