This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95.2 asm bug ?
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95.2 asm bug ?
- From: alanh at dcs dot kcl dot ac dot uk (Alan Hutchinson)
- Date: Tue, 8 Aug 2000 22:46:58 +0100 (BST)
Dear Sir
Could you please help with compilation of glibc2 ?
The problem may be one in the code of glibc2 or in the compiler
gcc 2.95.2
compiled (I think) with egcs 2.91.66 and libc5.
The compilation and installation went like a dream, using the
recommended shell scripts.
(I think no options were used during its configuration.)
I originally tried to compile glibc2 with egcs 2.91.66
but this produced an odd error message which did not correspond
with anything obvious in the source code
/usr/include/linux/timex.h
called from
../sysdeps/unix/sysv/linux/sys/timex.h
called from
../sysdeps/unix/sysv/linux/adjtime.c
so I downloaded, compiled and installed gcc 2.95.2 with no difficulty.
Thanks for it. The re-run of compilation of glibc2 then produced
a different error. Details:
I downloaded
- glibc-2.0.7pre6.tar.gz
- glibc-crypt-2.0.6.tar.gz (from a German site)
- glibc-linuxthreads-2.0.6.tar.gz
- glibc-localedata-2.0.6.tar.gz
and
- copied them into a subdirectory of /usr/src
- gunzipped and untarred them
- created a subdirectory called 'compile'
- changed to it and ran
../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=...
as suggested in the glibc 2 HOWTO.
This produced a warning, so I removed all new files and then
downloaded and installed
- gettext-0.10.35.tar.gz
and re-ran 'configure'. This time it produced no error messages.
I then ran
- make
This did a lot of work, seemingly without any errors, until it reported
... -o /usr/src/glibc-2.0.7pre6/compile/string/memmove.o
../sysdeps/generic/memmove.c: In function `memmove':
../sysdeps/generic/memmove.c:57: Invalid `asm' statement:
../sysdeps/generic/memmove.c:57: fixed or forbidden register 2 (cx) was spilled for class CREG.
../sysdeps/generic/memmove.c:75: Invalid `asm' statement:
../sysdeps/generic/memmove.c:75: fixed or forbidden register 2 (cx) was spilled for class CREG.
../sysdeps/generic/memmove.c:88: Invalid `asm' statement:
../sysdeps/generic/memmove.c:88: fixed or forbidden register 2 (cx) was spilled for class CREG.
../sysdeps/generic/memmove.c:101: Invalid `asm' statement:
../sysdeps/generic/memmove.c:101: fixed or forbidden register 2 (cx) was spilled for class CREG.
make[2]: *** [/usr/src/glibc-2.0.7pre6/compile/string/memmove.o] Error 1
and left `make' and stopped. The code which seems to cause this is
a pair of macros called
BYTE_COPY_FWD and BYTE_COPY_BWD
containing assembler which depends on the processor version.
This outcome recurred, even when `configure' was given the extra option
--target=iX86-linux
where X was successively 5, 4, 3.
A file which appears to be the source code for i386 is below.
This is on a standard seemingly robust PC with
Linux 2.2.13 (SuSE 6.3)
GNU make 3.77
Intel Celeron 466 MHz CPU
128 Mbytes of RAM, on two SIMM modules each of 64 Mbytes
ASUS ME99 motherboard
a few gigabytes of spare capacity in the Linux disk partition.
The machine passes the POST memory test. It also passes memory tests
under both Linux and Windows 95, although these may not test all RAM.
I hope these details are precise enough for you.
Regards
Alan Hutchinson
alanh@dcs.kcl.ac.uk
to:
gcc-bugs@gcc.gnu.org
================================
/* memcopy.h -- definitions for memory copy functions. i386 version.
Copyright (C) 1991 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <sysdeps/generic/memcopy.h>
#undef OP_T_THRES
#define OP_T_THRES 8
#undef BYTE_COPY_FWD
#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
asm volatile(/* Clear the direction flag, so copying goes forward. */ \
"cld\n" \
/* Copy bytes. */ \
"rep\n" \
"movsb" : \
"=D" (dst_bp), "=S" (src_bp) : \
"0" (dst_bp), "1" (src_bp), "c" (nbytes) : \
"cx")
#undef BYTE_COPY_BWD
#define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
do \
{ \
asm volatile(/* Set the direction flag, so copying goes backwards. */ \
"std\n" \
/* Copy bytes. */ \
"rep\n" \
"movsb\n" \
/* Clear the dir flag. Convention says it should be 0. */ \
"cld" : \
"=D" (dst_ep), "=S" (src_ep) : \
"0" (dst_ep - 1), "1" (src_ep - 1), "c" (nbytes) : \
"cx"); \
dst_ep += 1; \
src_ep += 1; \
} while (0)
#undef WORD_COPY_FWD
#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
do \
{ \
asm volatile(/* Clear the direction flag, so copying goes forward. */ \
"cld\n" \
/* Copy longwords. */ \
"rep\n" \
"movsl" : \
"=D" (dst_bp), "=S" (src_bp) : \
"0" (dst_bp), "1" (src_bp), "c" ((nbytes) / 4) : \
"cx"); \
(nbytes_left) = (nbytes) % 4; \
} while (0)
#undef WORD_COPY_BWD
#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
do \
{ \
asm volatile(/* Set the direction flag, so copying goes backwards. */ \
"std\n" \
/* Copy longwords. */ \
"rep\n" \
"movsl\n" \
/* Clear the dir flag. Convention says it should be 0. */ \
"cld" : \
"=D" (dst_ep), "=S" (src_ep) : \
"0" (dst_ep - 4), "1" (src_ep - 4), "c" ((nbytes) / 4) : \
"cx"); \
dst_ep += 4; \
src_ep += 4; \
(nbytes_left) = (nbytes) % 4; \
} while (0)