Hi,
I am seeing the following failure when building a crosstool-NG
configuration which configures GCC for XScale CPU. The warning is:
cc1: warning: switch -mcpu=xscale conflicts with -march=armv5te switch
But during the build of libatomic, -Werror is thrown in, so the warning
becomes an error.
GCC is configured with:
CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc' CFLAGS='-O2 -g -pipe
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools/include
' CFLAGS_FOR_BUILD='-O2 -g -pipe
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools/include
' CXXFLAGS='-O2 -g -pipe
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools/include
' CXXFLAGS_FOR_BUILD='-O2 -g -pipe
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools/include
'
LDFLAGS='-L/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools/lib
-lstdc++ -lm' CFLAGS_FOR_TARGET='' CXXFLAGS_FOR_TARGET=''
LDFLAGS_FOR_TARGET='' '/bin/bash'
'/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/configure'
'--build=x86_64-build_pc-linux-gnu' '--host=x86_64-build_pc-linux-gnu'
'--target=armeb-unknown-linux-uclibcgnueabi'
'--prefix=/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi'
'--with-sysroot=/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/sysroot'
'--enable-languages=c,c++' '--with-cpu=xscale' '--with-float=soft'
'--with-pkgversion=crosstool-NG 1.23.0-392-gd274ab06-dirty'
'--disable-sjlj-exceptions' '--enable-__cxa_atexit'
'--disable-libmudflap' '--disable-libgomp' '--disable-libssp'
'--disable-libquadmath' '--disable-libquadmath-support'
'--disable-libsanitizer' '--disable-libmpx'
'--with-gmp=/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools'
'--with-mpfr=/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools'
'--with-mpc=/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools'
'--with-isl=/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/buildtools'
'--enable-lto' '--with-host-libstdcxx=-static-libgcc
-Wl,-Bstatic,-lstdc++,-Bdynamic -lm' '--enable-threads=posix'
'--enable-target-optspace' '--enable-plugin' '--enable-gold'
'--disable-nls' '--disable-multilib'
'--with-local-prefix=/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/sysroot'
'--enable-long-long'
Failing command is:
[ALL ] libtool: compile:
/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/build/build-cc-gcc-final/./gcc/xgcc
-B/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/build/build-cc-gcc-final/./gcc/
-B/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/bin/
-B/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/lib/
-isystem
/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/include
-isystem
/home/avn/x-tools/armeb-unknown-linux-uclibcgnueabi/armeb-unknown-linux-uclibcgnueabi/sys-include
-DHAVE_CONFIG_H
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/libatomic/config/arm
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/libatomic/config/linux/arm
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/libatomic/config/posix
-I/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/libatomic
-I. -Wall -Werror -pthread -g -O2 -g -Os -MT init.lo -MD -MP -MF
.deps/init.Tpo -c
/home/avn/work/ctng/crosstool-ng/.build/armeb-unknown-linux-uclibcgnueabi/src/gcc/libatomic/config/linux/arm/init.c
-fPIC -DPIC -o .libs/init.o
The problem, as far as I can see, is that the driver executes cc1 with
the flags defined in
#define OPTION_DEFAULT_SPECS \
{"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
{"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
{"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}" }, \
{"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" }, \
{"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}"}, \
{"abi", "%{!mabi=*:-mabi=%(VALUE)}"}, \
{"mode", "%{!marm:%{!mthumb:-m%(VALUE)}}"}, \
{"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"},
Which evaluates to:
-mcpu=xscale -mfloat-abi=soft -mtls-dialect=gnu -marm -march=armv5te
added to the arguments from the command line (as you may see, there were
no -march= or -mcpu= in the original command).
Then, cc1 discovers that -mcpu=xscale and -march=armv5te are not exactly
compatible:
(gdb) p arm_selected_cpu->common.isa_bits
$17 = {isa_bit_armv3m, isa_bit_mode32, isa_bit_notm, isa_bit_xscale,
isa_bit_armv4, isa_bit_armv5e, isa_bit_armv5, isa_bit_thumb, isa_nobit
<repeats 36 times>}
(gdb) p arm_selected_arch->common.isa_bits
$18 = {isa_bit_armv3m, isa_bit_mode32, isa_bit_notm, isa_bit_armv4,
isa_bit_armv5e, isa_bit_armv5, isa_bit_thumb, isa_nobit <repeats 37 times>}
Because they differ in the presence of isa_bit_xscale (and that bit is
not listed as a quirk that's ignored during comparison), cc1 complains.
What should be the fix for this?
Regards,
Alexey.