Merge pull request #978 from stilor/fix-gcc8-regressions

Fix gcc8 regressions
This commit is contained in:
Alexey Neyman 2018-06-05 22:32:45 -07:00 committed by GitHub
commit 83582f4fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 121 additions and 38 deletions

52
packages/gcc/8.1.0/0018-xscale.patch vendored Normal file
View File

@ -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:

View File

@ -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_) */

View File

@ -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}"

View File

@ -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
}

View File

@ -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}" \

View File

@ -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[@]}"

View File

@ -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}" )

View File

@ -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

View File

@ -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}"
)

View File

@ -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}" \

View File

@ -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

View File

@ -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} \

View File

@ -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() {

View File

@ -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}"

View File

@ -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:

View File

@ -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[@]}" )

View File

@ -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