public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
@ 2022-09-25 9:50 thomas.petazzoni@free-electrons.com
2022-09-26 8:01 ` [Bug target/107032] " clyon at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: thomas.petazzoni@free-electrons.com @ 2022-09-25 9:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
Bug ID: 107032
Summary: ARM: libgcc2.c:2174:1: error: r7 cannot be used in
'asm' here
Product: gcc
Version: 11.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: thomas.petazzoni@free-electrons.com
Target Milestone: ---
When building gcc 10.4.0 or 11.3.0 for Cortex-M3 or M7, the build fails with:
../../../libgcc/libgcc2.c: In function '__clear_cache':
../../../libgcc/libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2174 | }
| ^
Makefile:501: recipe for target '_clear_cache.o' failed
GCC was configured like this:
(cd
/home/buildroot/autobuild/instance-0/output-1/build/host-gcc-initial-10.4.0/build
&& rm -rf config.cache;
PATH="/home/buildroot/autobuild/instance-0/output-1/host/bin:/home/buildroot/autobuild/instance-0/output-1/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PKG_CONFIG="/home/buildroot/autobuild/instance-0/output-1/host/bin/pkg-config"
PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
PKG_CONFIG_LIBDIR="/home/buildroot/autobuild/instance-0/output-1/host/lib/pkgconfig:/home/buildroot/autobuild/instance-0/output-1/host/share/pkgconfig"
AR="/usr/bin/ar" AS="/usr/bin/as" LD="/usr/bin/ld" NM="/usr/bin/nm"
CC="/usr/bin/gcc" GCC="/usr/bin/gcc" CXX="/usr/bin/g++" CPP="/usr/bin/cpp"
OBJCOPY="/usr/bin/objcopy" RANLIB="/usr/bin/ranlib"
CPPFLAGS="-I/home/buildroot/autobuild/instance-0/output-1/host/include"
CFLAGS="-O2 -I/home/buildroot/autobuild/instance-0/output-1/host/include"
CXXFLAGS="-O2 -I/home/buildroot/autobuild/instance-0/output-1/host/include"
LDFLAGS="-L/home/buildroot/autobuild/instance-0/output-1/host/lib
-Wl,-rpath,/home/buildroot/autobuild/instance-0/output-1/host/lib"
INTLTOOL_PERL=/usr/bin/perl CFLAGS="-O2
-I/home/buildroot/autobuild/instance-0/output-1/host/include"
LDFLAGS="-L/home/buildroot/autobuild/instance-0/output-1/host/lib
-Wl,-rpath,/home/buildroot/autobuild/instance-0/output-1/host/lib"
MAKEINFO=missing CFLAGS_FOR_TARGET="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -O0 -g0 -Wl,-elf2flt=-r -static"
CXXFLAGS_FOR_TARGET="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -O0 -g0 -Wl,-elf2flt=-r -static -Wl,-elf2flt=-r
-static" AR_FOR_TARGET=gcc-ar NM_FOR_TARGET=gcc-nm RANLIB_FOR_TARGET=gcc-ranlib
CONFIG_SITE=/dev/null ./configure
--prefix="/home/buildroot/autobuild/instance-0/output-1/host"
--sysconfdir="/home/buildroot/autobuild/instance-0/output-1/host/etc"
--localstatedir="/home/buildroot/autobuild/instance-0/output-1/host/var"
--enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html
--disable-doc --disable-docs --disable-documentation --disable-debug
--with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking
--target=arm-buildroot-uclinux-uclibcgnueabi
--with-sysroot=/home/buildroot/autobuild/instance-0/output-1/host/arm-buildroot-uclinux-uclibcgnueabi/sysroot
--enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib
--disable-decimal-float
--with-gmp=/home/buildroot/autobuild/instance-0/output-1/host
--with-mpc=/home/buildroot/autobuild/instance-0/output-1/host
--with-mpfr=/home/buildroot/autobuild/instance-0/output-1/host
--with-pkgversion="Buildroot 2022.05-439-g18f6e4bf70"
--with-bugurl="http://bugs.buildroot.net/" --without-zstd --disable-libquadmath
--disable-libquadmath-support --disable-libsanitizer --disable-tls
--enable-threads --without-isl --without-cloog --with-float=soft
--with-abi="aapcs-linux" --with-cpu=cortex-m3 --with-float=soft
--with-mode=thumb --enable-languages=c --disable-shared --without-headers
--disable-threads --with-newlib --disable-largefile )
Full build log of GCC 10.4.0 for Cortex-M3:
http://autobuild.buildroot.net/results/e91/e91fa76142cf50e514d5fe4791a06f3c3c014b5a/build-end.log
Full build log of GCC 11.3.0 for Cortex-M7:
http://autobuild.buildroot.net/results/9f7/9f7a43a375d476f47702cd7848eba53b76fcd386/build-end.log
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
@ 2022-09-26 8:01 ` clyon at gcc dot gnu.org
2022-09-26 8:08 ` thomas.petazzoni@free-electrons.com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: clyon at gcc dot gnu.org @ 2022-09-26 8:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
Christophe Lyon <clyon at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clyon at gcc dot gnu.org
--- Comment #1 from Christophe Lyon <clyon at gcc dot gnu.org> ---
At quick glance, I think this is caused by the definition of CLEAR_INSN_CACHE
in gcc/config/arm/uclinux-eabi.h:
/* Clear the instruction cache from `beg' to `end'. This makes an
inline system call to SYS_cacheflush. */
#undef CLEAR_INSN_CACHE
#define CLEAR_INSN_CACHE(BEG, END) \
{ \
register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
register unsigned long _end __asm ("a2") = (unsigned long) (END); \
register unsigned long _flg __asm ("a3") = 0; \
register unsigned long _scno __asm ("r7") = 0xf0002; \
__asm __volatile ("swi 0x0 @ sys_cacheflush" \
: "=r" (_beg) \
: "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \
}
which makes explicit use of r7.
This code has been like that since it was committed in 2007....
So I suspect nobody ever tried to build this configuration.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
2022-09-26 8:01 ` [Bug target/107032] " clyon at gcc dot gnu.org
@ 2022-09-26 8:08 ` thomas.petazzoni@free-electrons.com
2022-09-26 8:13 ` clyon at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: thomas.petazzoni@free-electrons.com @ 2022-09-26 8:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #2 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> ---
Thanks for the feedback. There must be something special in those
configurations, because I did build a Cortex-M4 configuration with gcc 11.3.0
just a few days ago, and it built fine.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
2022-09-26 8:01 ` [Bug target/107032] " clyon at gcc dot gnu.org
2022-09-26 8:08 ` thomas.petazzoni@free-electrons.com
@ 2022-09-26 8:13 ` clyon at gcc dot gnu.org
2022-09-26 8:42 ` thomas.petazzoni@free-electrons.com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: clyon at gcc dot gnu.org @ 2022-09-26 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #3 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Interesting....
Did you use the same target triplet?
arm*-*-uclinuxfdpiceabi is handled differently from
arm-buildroot-uclinux-uclibcgnueabi
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
` (2 preceding siblings ...)
2022-09-26 8:13 ` clyon at gcc dot gnu.org
@ 2022-09-26 8:42 ` thomas.petazzoni@free-electrons.com
2022-09-26 12:51 ` clyon at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: thomas.petazzoni@free-electrons.com @ 2022-09-26 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #4 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> ---
Yes, same triplet. We do not (yet) have FDPIC support for ARM in Buildroot (we
have a patch series pending for that).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
` (3 preceding siblings ...)
2022-09-26 8:42 ` thomas.petazzoni@free-electrons.com
@ 2022-09-26 12:51 ` clyon at gcc dot gnu.org
2022-09-27 10:55 ` rearnsha at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: clyon at gcc dot gnu.org @ 2022-09-26 12:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #5 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Could you share the preprocessed source file in the M3 and M4 cases along with
the full command line used to compile it?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
` (4 preceding siblings ...)
2022-09-26 12:51 ` clyon at gcc dot gnu.org
@ 2022-09-27 10:55 ` rearnsha at gcc dot gnu.org
2022-09-27 11:32 ` clyon at gcc dot gnu.org
2022-09-27 12:02 ` rearnsha at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2022-09-27 10:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-09-27
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #6 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
In Thumb code r7 is the frame pointer, so can't be used in inline assembler
without a dance whenever the frame pointer might be needed. I'm surprised this
hasn't shown up before.
We're going to need a separate definition of this macro when compiling for
Thumb as you can't easily rewrite this. The code will need to do something
like
mov scratch, r7
mov r7, #<syscall-value>
svc 0
mov r7, scratch
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
` (5 preceding siblings ...)
2022-09-27 10:55 ` rearnsha at gcc dot gnu.org
@ 2022-09-27 11:32 ` clyon at gcc dot gnu.org
2022-09-27 12:02 ` rearnsha at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: clyon at gcc dot gnu.org @ 2022-09-27 11:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #7 from Christophe Lyon <clyon at gcc dot gnu.org> ---
Indeed, but I am surprised it seems to compile for cortex-m4?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/107032] ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
` (6 preceding siblings ...)
2022-09-27 11:32 ` clyon at gcc dot gnu.org
@ 2022-09-27 12:02 ` rearnsha at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2022-09-27 12:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107032
--- Comment #8 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Perhaps something is changing the decision on the use of the frame pointer.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-09-27 12:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 9:50 [Bug target/107032] New: ARM: libgcc2.c:2174:1: error: r7 cannot be used in 'asm' here thomas.petazzoni@free-electrons.com
2022-09-26 8:01 ` [Bug target/107032] " clyon at gcc dot gnu.org
2022-09-26 8:08 ` thomas.petazzoni@free-electrons.com
2022-09-26 8:13 ` clyon at gcc dot gnu.org
2022-09-26 8:42 ` thomas.petazzoni@free-electrons.com
2022-09-26 12:51 ` clyon at gcc dot gnu.org
2022-09-27 10:55 ` rearnsha at gcc dot gnu.org
2022-09-27 11:32 ` clyon at gcc dot gnu.org
2022-09-27 12:02 ` rearnsha at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).