diff options
26 files changed, 468 insertions, 64 deletions
diff --git a/Makefile.am b/Makefile.am index 5ee3682..84bbe43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,8 @@ SUBDIRS = kconfig bin_SCRIPTS = ct-ng CLEANFILES = ct-ng bash-completion/ct-ng docs/ct-ng.1 -EXTRA_DIST = bootstrap ct-ng.in bash-completion/ct-ng.in docs/ct-ng.1.in maintainer +EXTRA_DIST = bootstrap ct-ng.in bash-completion/ct-ng.in \ + docs/ct-ng.1.in packages maintainer if INSTALL_BASH_COMPLETION compdir = @BASH_COMPLETION_DIR@ @@ -73,5 +74,12 @@ endif uninstall-hook: rm -f $(DESTDIR)$(man1dir)/$(ctng_progname).1.gz -dist-hook: maintainer/download-docs.sh +dist-hook: fetch-docs gen-tarball-version + +.PHONY: fetch-docs +fetch-docs: maintainer/download-docs.sh $< $(top_distdir) $(USER_MANUAL_FILES) + +.PHONY: gen-tarball-version +gen-tarball-version: + echo $(VERSION) > $(distdir)/.tarball-version diff --git a/config/arch/riscv.in b/config/arch/riscv.in index 4efde97..109556a 100644 --- a/config/arch/riscv.in +++ b/config/arch/riscv.in @@ -4,9 +4,12 @@ ## depends on EXPERIMENTAL ## ## select ARCH_SUPPORTS_32 +## select ARCH_SUPPORTS_64 ## select ARCH_DEFAULT_32 +## select ARCH_SUPPORTS_BOTH_MMU ## select ARCH_SUPPORTS_WITH_ABI ## select ARCH_SUPPORTS_WITH_ARCH +## select ARCH_SUPPORTS_WITH_TUNE ## select GCC_REQUIRE_7_or_later ## help The RISC-V architecture, as defined by: diff --git a/config/global/extract.in b/config/global/extract.in index 58f7b95..ba7f5f4 100644 --- a/config/global/extract.in +++ b/config/global/extract.in @@ -40,19 +40,16 @@ config ONLY_EXTRACT Useful to look at the code before doing the build itself. choice - prompt "Patches origin" - bool + bool "Patches origin" default PATCH_BUNDLED config PATCH_BUNDLED - bool - prompt "Bundled only" + bool "Bundled only" help Only apply patches bundled with crosstool-NG. config PATCH_LOCAL - bool - prompt "Local only (EXPERIMENTAL)" + bool "Local only" select PATCH_USE_LOCAL depends on EXPERIMENTAL help @@ -61,16 +58,14 @@ config PATCH_LOCAL copy them into your local directory if needed. config PATCH_BUNDLED_LOCAL - bool - prompt "Bundled, then local" + bool "Bundled, then local" select PATCH_USE_LOCAL help Apply the patches bundled with crosstool-NG, then apply your local patches. config PATCH_LOCAL_BUNDLED - bool - prompt "Local, then bundled" + bool "Local, then bundled" select PATCH_USE_LOCAL depends on EXPERIMENTAL help @@ -79,8 +74,7 @@ config PATCH_LOCAL_BUNDLED to apply on top of your local patches. config PATCH_NONE - bool - prompt "None" + bool "None" depends on EXPERIMENTAL help Don't use any patch at all. diff --git a/configure.ac b/configure.ac index 14a30b4..4e14db2 100644 --- a/configure.ac +++ b/configure.ac @@ -3,11 +3,9 @@ AC_PREREQ([2.67]) -# FIXME Temporary hack until the next release (we'll switch to plain numeric tags then) -# FIXME need to quote sed expression AC_INIT( [crosstool-NG], - [m4_esyscmd_s([git describe --always --dirty | sed s,^crosstool-ng-,,])], + [m4_esyscmd_s([maintainer/git-version-gen --prefix crosstool-ng- .tarball-version])], [crossgcc@sourceware.org], [crosstool-ng], [http://crosstool-ng.org]) @@ -300,12 +298,6 @@ AM_CONDITIONAL([INSTALL_USER_MANUAL], [test ! -f "${srcdir}/docs/MANUAL_ONLINE"] AC_MSG_CHECKING([if the manual needs to be installed]) AM_COND_IF([INSTALL_USER_MANUAL], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -# FIXME Retire? We don't want to debug a version that has been mislabeled by a user -# Decorate the version string per user-supplied version.sh, if any -AS_IF( - [test -f version.sh -a -x version.sh], - [PACKAGE_VERSION=$(./version.sh "${PACKAGE_VERSION}")]) - AC_CONFIG_FILES([ Makefile paths.sh diff --git a/maintainer/git-version-gen b/maintainer/git-version-gen new file mode 100755 index 0000000..6d073fc --- /dev/null +++ b/maintainer/git-version-gen @@ -0,0 +1,227 @@ +#!/bin/sh +# Print a version string. +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2007-2018 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# This script is derived from GIT-VERSION-GEN from GIT: https://git-scm.com/. +# It may be run two ways: +# - from a git repository in which the "git describe" command below +# produces useful output (thus requiring at least one signed tag) +# - from a non-git-repo directory containing a .tarball-version file, which +# presumes this script is invoked like "./git-version-gen .tarball-version". + +# In order to use intra-version strings in your project, you will need two +# separate generated version string files: +# +# .tarball-version - present only in a distribution tarball, and not in +# a checked-out repository. Created with contents that were learned at +# the last time autoconf was run, and used by git-version-gen. Must not +# be present in either $(srcdir) or $(builddir) for git-version-gen to +# give accurate answers during normal development with a checked out tree, +# but must be present in a tarball when there is no version control system. +# Therefore, it cannot be used in any dependencies. GNUmakefile has +# hooks to force a reconfigure at distribution time to get the value +# correct, without penalizing normal development with extra reconfigures. +# +# .version - present in a checked-out repository and in a distribution +# tarball. Usable in dependencies, particularly for files that don't +# want to depend on config.h but do want to track version changes. +# Delete this file prior to any autoconf run where you want to rebuild +# files to pick up a version string change; and leave it stale to +# minimize rebuild time after unrelated changes to configure sources. +# +# As with any generated file in a VC'd directory, you should add +# /.version to .gitignore, so that you don't accidentally commit it. +# .tarball-version is never generated in a VC'd directory, so needn't +# be listed there. +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# +# Then use the following lines in your Makefile.am, so that .version +# will be present for dependencies, and so that .version and +# .tarball-version will exist in distribution tarballs. +# +# EXTRA_DIST = $(top_srcdir)/.version +# BUILT_SOURCES = $(top_srcdir)/.version +# $(top_srcdir)/.version: +# echo $(VERSION) > $@-t && mv $@-t $@ +# dist-hook: +# echo $(VERSION) > $(distdir)/.tarball-version + + +me=$0 + +version="git-version-gen $scriptversion + +Copyright 2011 Free Software Foundation, Inc. +There is NO warranty. You may redistribute this software +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING." + +usage="\ +Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] +Print a version string. + +Options: + + --prefix PREFIX prefix of git tags (default 'v') + --fallback VERSION + fallback version to use if \"git --version\" fails + + --help display this help and exit + --version output version information and exit + +Running without arguments will suffice in most cases." + +prefix=v +fallback= + +while test $# -gt 0; do + case $1 in + --help) echo "$usage"; exit 0;; + --version) echo "$version"; exit 0;; + --prefix) shift; prefix=${1?};; + --fallback) shift; fallback=${1?};; + -*) + echo "$0: Unknown option '$1'." >&2 + echo "$0: Try '--help' for more information." >&2 + exit 1;; + *) + if test "x$tarball_version_file" = x; then + tarball_version_file="$1" + elif test "x$tag_sed_script" = x; then + tag_sed_script="$1" + else + echo "$0: extra non-option argument '$1'." >&2 + exit 1 + fi;; + esac + shift +done + +if test "x$tarball_version_file" = x; then + echo "$usage" + exit 1 +fi + +tag_sed_script="${tag_sed_script:-s/x/x/}" + +nl=' +' + +# Avoid meddling by environment variable of the same name. +v= +v_from_git= + +# First see if there is a tarball-only version file. +# then try "git describe", then default. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || v= + case $v in + *$nl*) v= ;; # reject multi-line output + [0-9]*) ;; + *) v= ;; + esac + test "x$v" = x \ + && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2 +fi + +if test "x$v" != x +then + : # use $v +# Otherwise, if there is at least one git commit involving the working +# directory, and "git describe" output looks sensible, use that to +# derive a version string. +elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ + && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ + || git describe --abbrev=4 HEAD 2>/dev/null` \ + && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ + && case $v in + $prefix[0-9]*) ;; + *) (exit 1) ;; + esac +then + # Is this a new git that lists number of commits since the last + # tag or the previous older version that did not? + # Newer: v6.10-77-g0f8faeb + # Older: v6.10-g0f8faeb + vprefix=`expr "X$v" : 'X\(.*\)-g[^-]*$'` || vprefix=$v + case $vprefix in + *-*) : git describe is probably okay three part flavor ;; + *) + : git describe is older two part flavor + # Recreate the number of commits and rewrite such that the + # result is the same as if we were using the newer version + # of git describe. + vtag=`echo "$v" | sed 's/-.*//'` + commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ + || { commit_list=failed; + echo "$0: WARNING: git rev-list failed" 1>&2; } + numcommits=`echo "$commit_list" | wc -l` + v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; + test "$commit_list" = failed && v=UNKNOWN + ;; + esac + + # Change the penultimate "-" to ".", for version-comparing tools. + # Remove the "g" to save a byte. + v=`echo "$v" | sed 's/-\([^-]*\)-g\([^-]*\)$/.\1-\2/'`; + v_from_git=1 +elif test "x$fallback" = x || git --version >/dev/null 2>&1; then + v=UNKNOWN +else + v=$fallback +fi + +v=`echo "$v" |sed "s/^$prefix//"` + +# Test whether to append the "-dirty" suffix only if the version +# string we're using came from git. I.e., skip the test if it's "UNKNOWN" +# or if it came from .tarball-version. +if test "x$v_from_git" != x; then + # Don't declare a version "dirty" merely because a timestamp has changed. + git update-index --refresh > /dev/null 2>&1 + + dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= + case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. + case $v in + *-dirty) ;; + *) v="$v-dirty" ;; + esac ;; + esac +fi + +# Omit the trailing newline, so that m4_esyscmd can use the result directly. +printf %s "$v" + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/maintainer/kconfig-versions.template b/maintainer/kconfig-versions.template index d5d4cc8..3db512e 100644 --- a/maintainer/kconfig-versions.template +++ b/maintainer/kconfig-versions.template @@ -1,3 +1,5 @@ +#!// This file is not automatically generated, but we want this banner to +#!// appear in the files produced from it. # # DO NOT EDIT! This file is automatically generated. # @@ -167,6 +169,44 @@ endif endchoice +if EXPERIMENTAL +choice + bool "@@pkg_label@@ patches origin" + default @@fork|@@_PATCH_GLOBAL + +config @@fork|@@_PATCH_GLOBAL + bool "Per global policy" + +config @@fork|@@_PATCH_BUNDLED + bool "Bundled only" + +config @@fork|@@_PATCH_LOCAL + bool "Local only" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_BUNDLED_LOCAL + bool "Bundled, then local" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_LOCAL_BUNDLED + bool "Local, then bundled" + select PATCH_USE_LOCAL + +config @@fork|@@_PATCH_NONE + bool "None" + +endchoice +endif + +config @@fork|@@_PATCH_ORDER + string + default "bundled" if @@fork|@@_PATCH_BUNDLED + default "local" if @@fork|@@_PATCH_LOCAL + default "bundled,local" if @@fork|@@_PATCH_BUNDLED_LOCAL + default "local,bundled" if @@fork|@@_PATCH_LOCAL_BUNDLED + default "none" if @@fork|@@_PATCH_NONE + default "global" + #!// Below, we explicitly select all milestones to which a given version #!// compares greater-or-equal. We don't select just the latest applicable #!// (and letting milestones chain-select each other, with FOO_6_or_later diff --git a/packages/gcc/8.1.0/0018-xscale.patch b/packages/gcc/8.1.0/0018-xscale.patch new file mode 100644 index 0000000..62654c2 --- /dev/null +++ b/packages/gcc/8.1.0/0018-xscale.patch @@ -0,0 +1,52 @@ +commit f18d79595db4ae88dbd40d73bb2d1ea191a756a1 +Author: rearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Mon Jun 4 08:41:45 2018 +0000 + + [arm] PR target/86003 build failures with --with-cpu=xscale + + The XScale cpu configuration in GCC has always been somewhat + non-conforming. Although XScale isn't an architecture (it's simply an + implementation of ARMv5te), we do by tradition emit a specific + pre-define for it. We achieve this effect by adding an additional + feature bit to the xscale CPU definition that isn't part of the base + architecture. + + When I restructured the options last year I overlooked this oddity and + the result, of course, is that this configuration now fails to build + as intended. + + What happens is that the driver (correctly) constructs an architecture + for the xscale cpu name (as armv5te) and passes it in addition to the + CPU name. The backend code, on finding both a cpu and an architecture + specifies attempts to correlate the two and finds a difference due to + the additional feature bit and reports an inconsistency (fatally if + -werror is specified). + + I think the best fix to this is to treat the xscale feature bit using + the same mechanism that we use for other 'quirks' in CPU + implementations and simply filter it out before comparing the + capabilities. It has the additional benefit that it's also the + simplest fix. + + PR target/86003 + * config/arm/arm-cpus.in (ALL_QUIRKS): Add xscale feature to the list + of bits to ignore when comparing architectures. + + + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261140 138bc75d-0d04-0410-961f-82ee72b054a4 + +diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in +index aec73b5cae0..661bf1a573c 100644 +--- a/gcc/config/arm/arm-cpus.in ++++ b/gcc/config/arm/arm-cpus.in +@@ -254,7 +254,9 @@ define fgroup DOTPROD NEON dotprod + + # List of all quirk bits to strip out when comparing CPU features with + # architectures. +-define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd ++# xscale isn't really a 'quirk', but it isn't an architecture either and we ++# need to ignore it for matching purposes. ++define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd xscale + + # Architecture entries + # format: diff --git a/packages/mingw-w64/v5.0.3/0001-xgetbv.patch b/packages/mingw-w64/v5.0.3/0001-xgetbv.patch new file mode 100644 index 0000000..2884609 --- /dev/null +++ b/packages/mingw-w64/v5.0.3/0001-xgetbv.patch @@ -0,0 +1,32 @@ +commit 3ce3e27f044935f19e93e80c43ca695262d484e1 +Author: Mateusz <mateuszb@poczta.onet.pl> +Date: Mon Jan 22 20:58:48 2018 +0100 + + intrin-impl.h: do not define _xgetbv for GCC 8 + + GCC 8 from r248028 has defined function _xgetbv and we should + avoid double definition of this function. + + Signed-off-by: Mateusz Brzostek <mateuszb@poczta.onet.pl> + Signed-off-by: Martin Storsjö <martin@martin.st> + +diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h +index ff9e6aff..88af804c 100644 +--- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h ++++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h +@@ -1775,6 +1775,7 @@ __buildmov(__movsd, unsigned __LONG32, "d") + #define __INTRINSIC_DEFINED___movsd + #endif /* __INTRINSIC_PROLOG */ + ++#if !defined(__GNUC__) || __GNUC__ < 8 /* GCC 8 has already defined _xgetbv */ + /* NOTE: This should be in immintrin.h */ + #if __INTRINSIC_PROLOG(_xgetbv) + unsigned __int64 _xgetbv(unsigned int); +@@ -1798,6 +1799,7 @@ unsigned __int64 _xgetbv(unsigned int index) + #endif + #define __INTRINSIC_DEFINED__xgetbv + #endif /* __INTRINSIC_PROLOG */ ++#endif /* __GNUC__ < 8 */ + + #endif /* defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) */ + diff --git a/packages/mpfr/4.0.1/0001-Fix-obsolete-ARC-asm-constraints.patch b/packages/mpfr/4.0.1/0001-Fix-obsolete-ARC-asm-constraints.patch new file mode 100644 index 0000000..12590cf --- /dev/null +++ b/packages/mpfr/4.0.1/0001-Fix-obsolete-ARC-asm-constraints.patch @@ -0,0 +1,37 @@ +mpfr-longlong.h: Fix obsolete ARC asm constraints + +This patch replaces obsolete ARC "J" asm constraint with +up-to-date "Cal" constraint. +The patch should be applied to upstream "mpfr" library and +after that it should be removed from buildroot as soon as +mpfr version with current fix will come up. + +Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com> +Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com> +--- +Index: /src/mpfr-longlong.h +=================================================================== +--- /src/mpfr-longlong.h (revision 10963) ++++ /src/mpfr-longlong.h (working copy) +@@ -416,17 +416,17 @@ + : "=r" (sh), \ + "=&r" (sl) \ + : "r" ((USItype) (ah)), \ +- "rIJ" ((USItype) (bh)), \ ++ "rICal" ((USItype) (bh)), \ + "%r" ((USItype) (al)), \ +- "rIJ" ((USItype) (bl))) ++ "rICal" ((USItype) (bl))) + #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ + __asm__ ("sub.f\t%1, %4, %5\n\tsbc\t%0, %2, %3" \ + : "=r" (sh), \ + "=&r" (sl) \ + : "r" ((USItype) (ah)), \ +- "rIJ" ((USItype) (bh)), \ ++ "rICal" ((USItype) (bh)), \ + "r" ((USItype) (al)), \ +- "rIJ" ((USItype) (bl))) ++ "rICal" ((USItype) (bl))) + #endif + + #if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ diff --git a/samples/riscv64-unknown-linux-gnu/crosstool.config b/samples/riscv64-unknown-linux-gnu/crosstool.config new file mode 100644 index 0000000..66c288d --- /dev/null +++ b/samples/riscv64-unknown-linux-gnu/crosstool.config @@ -0,0 +1,12 @@ +CT_EXPERIMENTAL=y +CT_ARCH_RISCV=y +# CT_DEMULTILIB is not set +CT_ARCH_USE_MMU=y +CT_ARCH_64=y +CT_KERNEL_LINUX=y +CT_DEBUG_GDB=y +# CT_GDB_CROSS_PYTHON is not set +# CT_GDB_GDBSERVER is not set +CT_ZLIB_NEEDED=y +CT_TARGET_VENDOR="unknown" +CT_ARCH_ARCH="rv64gc" diff --git a/samples/riscv64-unknown-linux-gnu/reported.by b/samples/riscv64-unknown-linux-gnu/reported.by new file mode 100644 index 0000000..9456e59 --- /dev/null +++ b/samples/riscv64-unknown-linux-gnu/reported.by @@ -0,0 +1,3 @@ +reporter_name="Paul Walmsley <paul.walmsley@sifive.com>" +reporter_url="https://www.sifive.com/" +reporter_comment="" diff --git a/scripts/build/arch/arm.sh b/scripts/build/arch/arm.sh index 7433c92..4873df1 100644 --- a/scripts/build/arch/arm.sh +++ b/scripts/build/arch/arm.sh @@ -96,6 +96,7 @@ CT_DoArchUClibcCflags() { case "${f}" in -mthumb) CT_KconfigEnableOption "COMPILE_IN_THUMB_MODE" "${cfg}" + CT_KconfigDisableOption "UCLIBC_HAS_CONTEXT_FUNCS" "${cfg}" ;; -marm) CT_KconfigDisableOption "COMPILE_IN_THUMB_MODE" "${cfg}" diff --git a/scripts/build/arch/powerpc.sh b/scripts/build/arch/powerpc.sh index 52f3f8b..7dd5ac5 100644 --- a/scripts/build/arch/powerpc.sh +++ b/scripts/build/arch/powerpc.sh @@ -19,11 +19,11 @@ CT_DoArchTupleValues () { ;; esac - # Add extra flags for SPE if needed + # Add extra flags for SPE if needed. SPE is obsolete in GCC8. if [ "${CT_ARCH_powerpc_ABI_SPE}" = "y" ]; then CT_ARCH_TARGET_CFLAGS="-mabi=spe -mspe" - CT_ARCH_CC_CORE_EXTRA_CONFIG="--enable-e500_double" - CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double" + CT_ARCH_CC_CORE_EXTRA_CONFIG="--enable-e500_double --enable-obsolete" + CT_ARCH_CC_EXTRA_CONFIG="--enable-e500_double --enable-obsolete" fi } diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index a6bf1ac..f38fd7f 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -171,13 +171,13 @@ cc_gcc_multilib_housekeeping() { fi done CT_DoLog DEBUG "Filtered target CFLAGS: '${new_cflags}'" - CT_EnvModify CT_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}" + CT_EnvModify CT_ALL_TARGET_CFLAGS "${new_cflags} ${CT_TARGET_CFLAGS}" CT_EnvModify CT_ARCH_TARGET_CFLAGS_MULTILIB "" # Currently, the only LDFLAGS are endianness-related CT_DoLog DEBUG "Configured target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'" if [ "${ml_endian}" != "seen" ]; then - CT_EnvModify CT_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}" + CT_EnvModify CT_ALL_TARGET_LDFLAGS "${CT_ARCH_TARGET_LDFLAGS_MULTILIB} ${CT_TARGET_LDFLAGS}" CT_EnvModify CT_ARCH_TARGET_LDFLAGS_MULTILIB "" fi CT_DoLog DEBUG "Filtered target LDFLAGS: '${CT_ARCH_TARGET_LDFLAGS_MULTILIB}'" @@ -561,7 +561,11 @@ do_gcc_core_backend() { fi fi - # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) + # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532). + # Pass only user-specified CFLAGS/LDFLAGS in CFLAGS_FOR_TARGET/LDFLAGS_FOR_TARGET: during + # the build of, for example, libatomic, GCC tried to compile multiple variants for runtime + # selection and passing architecture/CPU selectors, as detemined by crosstool-NG, may + # miscompile or outright fail. CT_DoExecLog CFG \ CC_FOR_BUILD="${CT_BUILD}-gcc" \ CFLAGS="${cflags}" \ @@ -1110,6 +1114,8 @@ do_gcc_backend() { fi fi + # NB: not using CT_ALL_TARGET_CFLAGS/CT_ALL_TARGET_LDFLAGS here! + # See do_gcc_core_backend for explanation. CT_DoExecLog CFG \ CC_FOR_BUILD="${CT_BUILD}-gcc" \ CFLAGS="${cflags}" \ diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh index 5f1a8d7..f0d8be4 100644 --- a/scripts/build/companion_libs/200-libelf.sh +++ b/scripts/build/companion_libs/200-libelf.sh @@ -81,7 +81,7 @@ do_libelf_for_target() { libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" ) libelf_opts+=( "host=${CT_TARGET}" ) - libelf_opts+=( "cflags=${CT_TARGET_CFLAGS}" ) + libelf_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" ) libelf_opts+=( "prefix=${prefix}" ) libelf_opts+=( "shared=${CT_SHARED_LIBS}" ) do_libelf_backend "${libelf_opts[@]}" diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh index f848541..75a78bf 100644 --- a/scripts/build/companion_libs/210-expat.sh +++ b/scripts/build/companion_libs/210-expat.sh @@ -54,7 +54,7 @@ do_expat_for_target() { prefix="/usr" ;; esac - expat_opts+=( "cflags=${CT_TARGET_CFLAGS}" ) + expat_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" ) expat_opts+=( "prefix=${prefix}" ) expat_opts+=( "destdir=${CT_SYSROOT_DIR}" ) expat_opts+=( "shared=${CT_SHARED_LIBS}" ) diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh index 97fb834..b5dee13 100644 --- a/scripts/build/companion_libs/220-ncurses.sh +++ b/scripts/build/companion_libs/220-ncurses.sh @@ -97,7 +97,7 @@ do_ncurses_for_target() { prefix="${prefix}" \ destdir="${CT_SYSROOT_DIR}" \ shared="${CT_SHARED_LIBS}" \ - cflags="${CT_TARGET_CFLAGS}" \ + cflags="${CT_ALL_TARGET_CFLAGS}" \ "${opts[@]}" CT_Popd CT_EndStep diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh index 0d98c38..9e2379e 100644 --- a/scripts/build/debug/200-duma.sh +++ b/scripts/build/debug/200-duma.sh @@ -19,8 +19,8 @@ do_debug_duma_build() { make_args=( prefix="${CT_DEBUGROOT_DIR}/usr" HOSTCC="${CT_BUILD}-gcc" - CC="${CT_TARGET}-${CT_CC} ${CT_TARGET_CFLAGS}" - CXX="${CT_TARGET}-g++ ${CT_TARGET_CFLAGS}" + CC="${CT_TARGET}-${CT_CC} ${CT_ALL_TARGET_CFLAGS}" + CXX="${CT_TARGET}-g++ ${CT_ALL_TARGET_CFLAGS}" RANLIB="${CT_TARGET}-ranlib" OS="${CT_KERNEL}" ) diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 0d0701a..fe6ce79 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -22,7 +22,7 @@ do_debug_gdb_build() { local CT_HOST_LD="${CT_HOST}-ld" local CT_CXXFLAGS_FOR_HOST=${CT_CFLAGS_FOR_HOST} - local CT_TARGET_CXXFLAGS=${CT_TARGET_CFLAGS} + local CT_TARGET_CXXFLAGS=${CT_ALL_TARGET_CFLAGS} gdb_src_dir="${CT_SRC_DIR}/gdb" @@ -34,7 +34,7 @@ do_debug_gdb_build() { if [ "${CT_GDB_CROSS}" = "y" ]; then local -a cross_extra_config local gcc_version p _p - local cross_CPPFLAGS cross_CFLAGS cross_CXXFLAGS cross_LDFLAGS + local cross_CFLAGS cross_CXXFLAGS cross_LDFLAGS CT_DoStep INFO "Installing cross-gdb" CT_DoLog EXTRA "Configuring cross-gdb" @@ -94,7 +94,6 @@ do_debug_gdb_build() { cross_extra_config+=("--disable-nls") fi - cross_CPPFLAGS="${CT_CPPFLAGS_FOR_HOST}" cross_CFLAGS="${CT_CFLAGS_FOR_HOST}" cross_CXXFLAGS="${CT_CXXFLAGS_FOR_HOST}" cross_LDFLAGS="${CT_LDFLAGS_FOR_HOST}" @@ -122,7 +121,6 @@ do_debug_gdb_build() { # are multiple consecutive spaces: sub-configure scripts replace them with a # single space and then complain that $CC value changed from that in # the master directory. - cross_CPPFLAGS=`echo ${cross_CPPFLAGS}` cross_CFLAGS=`echo ${cross_CFLAGS}` cross_CXXFLAGS=`echo ${cross_CXXFLAGS}` cross_LDFLAGS=`echo ${cross_LDFLAGS}` @@ -139,7 +137,6 @@ do_debug_gdb_build() { CC="${CT_HOST_CC}" \ CXX="${CT_HOST_CXX}" \ LD="${CT_HOST_LD}" \ - CPPFLAGS="${cross_CPPFLAGS}" \ CFLAGS="${cross_CFLAGS}" \ CXXFLAGS="${cross_CXXFLAGS}" \ LDFLAGS="${cross_LDFLAGS}" \ @@ -191,7 +188,7 @@ do_debug_gdb_build() { # TBD combine GDB native and gdbserver backends, build either or both in a single pass. if [ "${CT_GDB_NATIVE}" = "y" ]; then local -a native_extra_config - local native_CPPFLAGS native_CFLAGS native_CXXFLAGS native_LDFLAGS + local native_CFLAGS native_CXXFLAGS native_LDFLAGS CT_DoStep INFO "Installing native gdb" CT_DoLog EXTRA "Configuring native gdb" @@ -243,10 +240,9 @@ do_debug_gdb_build() { native_extra_config+=("--disable-nls") fi - native_CPPFLAGS="${CT_TARGET_CPPFLAGS}" - native_CFLAGS="${CT_TARGET_CFLAGS}" - native_CXXFLAGS="${CT_TARGET_CXXFLAGS}" - native_LDFLAGS="${CT_TARGET_LDFLAGS}" + native_CFLAGS="${CT_ALL_TARGET_CFLAGS}" + native_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}" + native_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then native_CFLAGS+=" -static" @@ -261,7 +257,6 @@ do_debug_gdb_build() { native_extra_config+=("--disable-ld") native_extra_config+=("--disable-gas") - native_CPPFLAGS=`echo ${native_CPPFLAGS}` native_CFLAGS=`echo ${native_CFLAGS}` native_CXXFLAGS=`echo ${native_CXXFLAGS}` native_LDFLAGS=`echo ${native_LDFLAGS}` @@ -273,7 +268,6 @@ do_debug_gdb_build() { CC="${CT_TARGET_CC}" \ CXX="${CT_TARGET_CXX}" \ LD="${CT_TARGET_LD}" \ - CPPFLAGS="${native_CPPFLAGS}" \ CFLAGS="${native_CFLAGS}" \ CXXFLAGS="${native_CXXFLAGS}" \ LDFLAGS="${native_LDFLAGS}" \ @@ -310,7 +304,7 @@ do_debug_gdb_build() { if [ "${CT_GDB_GDBSERVER}" = "y" ]; then local -a gdbserver_extra_config - local gdbserver_CPPFLAGS gdbserver_CFLAGS gdbserver_CXXFLAGS gdbserver_LDFLAGS + local gdbserver_CFLAGS gdbserver_CXXFLAGS gdbserver_LDFLAGS CT_DoStep INFO "Installing gdbserver" CT_DoLog EXTRA "Configuring gdbserver" @@ -343,10 +337,9 @@ do_debug_gdb_build() { gdbserver_extra_config+=("--disable-ld") gdbserver_extra_config+=("--disable-gas") - gdbserver_CPPFLAGS="${CT_TARGET_CPPFLAGS}" - gdbserver_CFLAGS="${CT_TARGET_CFLAGS}" - gdbserver_CXXFLAGS="${CT_TARGET_CXXFLAGS}" - gdbserver_LDFLAGS="${CT_TARGET_LDFLAGS}" + gdbserver_CFLAGS="${CT_ALL_TARGET_CFLAGS}" + gdbserver_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}" + gdbserver_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then gdbserver_CFLAGS+=" -static" @@ -358,7 +351,6 @@ do_debug_gdb_build() { gdbserver_LDFLAGS+=" -static-libstdc++" fi - gdbserver_CPPFLAGS=`echo ${gdbserver_CPPFLAGS}` gdbserver_CFLAGS=`echo ${gdbserver_CFLAGS}` gdbserver_CXXFLAGS=`echo ${gdbserver_CXXFLAGS}` gdbserver_LDFLAGS=`echo ${gdbserver_LDFLAGS}` @@ -370,7 +362,6 @@ do_debug_gdb_build() { CC="${CT_TARGET_CC}" \ CXX="${CT_TARGET_CXX}" \ LD="${CT_TARGET_LD}" \ - CPPFLAGS="${gdbserver_CPPFLAGS}" \ CFLAGS="${gdbserver_CFLAGS}" \ CXXFLAGS="${gdbserver_CXXFLAGS}" \ LDFLAGS="${gdbserver_LDFLAGS}" \ diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh index ce299c2..3f08226 100644 --- a/scripts/build/debug/400-ltrace.sh +++ b/scripts/build/debug/400-ltrace.sh @@ -34,7 +34,7 @@ do_debug_ltrace_build() { AR="${CT_TARGET}-ar" \ HOST="${ltrace_host}" \ HOST_OS="${CT_TARGET_KERNEL}" \ - CFLAGS="${CT_TARGET_CFLAGS}" \ + CFLAGS="${CT_ALL_TARGET_CFLAGS}"\ ${CONFIG_SHELL} \ ./configure --prefix=/usr else diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh index 480daaa..4f6d6aa 100644 --- a/scripts/build/debug/500-strace.sh +++ b/scripts/build/debug/500-strace.sh @@ -12,7 +12,7 @@ do_debug_strace_extract() do_debug_strace_build() { - local cflags="${CT_TARGET_CFLAGS}" + local cflags="${CT_ALL_TARGET_CFLAGS}" CT_DoStep INFO "Installing strace" @@ -30,7 +30,7 @@ do_debug_strace_build() CT_DoExecLog CFG \ CC="${CT_TARGET}-${CT_CC}" \ CFLAGS="${cflags}" \ - LDFLAGS="${CT_TARGET_LDFLAGS}" \ + LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" \ CPP="${CT_TARGET}-cpp" \ LD="${CT_TARGET}-ld" \ ${CONFIG_SHELL} \ diff --git a/scripts/build/libc/bionic.sh b/scripts/build/libc/bionic.sh index 027493d..573b8d4 100644 --- a/scripts/build/libc/bionic.sh +++ b/scripts/build/libc/bionic.sh @@ -26,7 +26,7 @@ do_libc() { fi CT_DoStep INFO "Installing C library binaries" CT_DoExecLog ALL cp -r "${CT_SRC_DIR}/android-ndk/platforms/android-${CT_ANDROID_API}/arch-${arch}/usr" "${CT_SYSROOT_DIR}" - CT_EnvModify CT_TARGET_CFLAGS "${CT_TARGET_CFLAGS} -D__ANDROID_API__=${CT_ANDROID_API}" + CT_EnvModify CT_ALL_TARGET_CFLAGS "${CT_ALL_TARGET_CFLAGS} -D__ANDROID_API__=${CT_ANDROID_API}" } do_libc_post_cc() { diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 2f257b5..f8af7fc 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -197,7 +197,7 @@ do_libc_backend_once() { esac # In the order of increasing precedence. Flags common to compiler and linker. - glibc_cflags+=" ${CT_TARGET_CFLAGS}" + glibc_cflags+=" ${CT_ALL_TARGET_CFLAGS}" glibc_cflags+=" ${CT_GLIBC_EXTRA_CFLAGS}" glibc_cflags+=" ${multi_flags}" diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh index 819c7d6..2b1e5bb 100644 --- a/scripts/build/libc/newlib.sh +++ b/scripts/build/libc/newlib.sh @@ -94,7 +94,7 @@ ENABLE_TARGET_OPTSPACE:target-optspace [ "${CT_LIBC_NEWLIB_LTO}" = "y" ] && \ CT_LIBC_NEWLIB_TARGET_CFLAGS="${CT_LIBC_NEWLIB_TARGET_CFLAGS} -flto" - cflags_for_target="${CT_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}" + cflags_for_target="${CT_ALL_TARGET_CFLAGS} ${CT_LIBC_NEWLIB_TARGET_CFLAGS}" # Note: newlib handles the build/host/target a little bit differently # than one would expect: diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh index 19b9519..486f733 100644 --- a/scripts/crosstool-NG.sh +++ b/scripts/crosstool-NG.sh @@ -166,8 +166,8 @@ CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )" # Second kludge: merge user-supplied target CFLAGS with architecture-provided # target CFLAGS. Do the same for LDFLAGS in case it happens in the future. # 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}" +CT_ALL_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}" +CT_ALL_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[@]}" ) diff --git a/scripts/functions b/scripts/functions index 0b8fba5..2267a95 100644 --- a/scripts/functions +++ b/scripts/functions @@ -287,6 +287,7 @@ CT_DoLog() { y,*"warning:"*) cur_L=WARN; cur_l=${CT_LOG_LEVEL_WARN};; y,*"WARNING:"*) cur_L=WARN; cur_l=${CT_LOG_LEVEL_WARN};; *"error:"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};; + *"Error:"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};; *"make["*"]: ***"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};; *) cur_L="${LEVEL}"; cur_l="${level}";; esac @@ -1897,7 +1898,7 @@ CT_PackageRun() for v in basename pkg_name version pkg_dir \ src_release mirrors archive_filename archive_dirname archive_formats signature_format \ src_devel devel_vcs devel_url devel_branch devel_revision devel_subdir devel_bootstrap \ - src_custom custom_location; do + src_custom custom_location patch_order; do eval "local ${v}=\${CT_${use}_${v^^}}" done @@ -2055,6 +2056,11 @@ CT_DoExtractPatch() local local_patch_dir local overlay + # Inherit global value if requested + if [ "${patch_order}" = "global" ]; then + patch_order="${CT_PATCH_ORDER}" + fi + # If using overlay, prepare it first - we need to determine where to unpack # this component. if [ "${CT_TARGET_USE_OVERLAY}" = "y" -a ! -d "${CT_BUILD_DIR}/overlay" ]; then @@ -2071,7 +2077,7 @@ CT_DoExtractPatch() # and no overlays. Otherwise, this source directory is custom-tailored for this # particular configuration and cannot be reused by different configurations. if [ "${src_custom}" != "y" -a \ - "${CT_PATCH_ORDER}" = "bundled" -a \ + "${patch_order}" = "bundled" -a \ ! -d "${CT_BUILD_DIR}/overlay/${dir_name}" ]; then src_dir="${CT_COMMON_SRC_DIR}" else @@ -2120,7 +2126,7 @@ CT_DoExtractPatch() bundled_patch_dir="${CT_LIB_DIR}/packages/${pkg_dir}" local_patch_dir="${CT_LOCAL_PATCH_DIR}/${pkg_dir}" - case "${CT_PATCH_ORDER}" in + case "${patch_order}" in bundled) patch_dirs=("${bundled_patch_dir}");; local) patch_dirs=("${local_patch_dir}");; bundled,local) patch_dirs=("${bundled_patch_dir}" "${local_patch_dir}");; |