This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: MIPS SIZE_TYPE and PTRDIFF_TYPE revamp
[ skip to the bottom if you want to cut to the chase. 8-]
At Tue, 12 Mar 2002 16:37:00 +0000 (UTC), cgd@broadcom.com wrote:
> At Tue, 12 Mar 2002 16:04:02 +0000 (UTC), "Alexandre Oliva" wrote:
> > > In retrospect, are you sure this patch fixes the problem?
> >
> > Yup. I don't see how you could get a duplicate definition of
> > __SIZE_TYPE__ or __PTRDIFF_TYPE__.
>
> OK, well, i'll double-check this afternoon, but I don't think I did
> anything odd.
>
> Either way, i'll tell you the result, but if i'm still having a
> problem i'll try to dig into it a little more, time permitting.
FYI:
it seems that those warnings are gone, but the final failure which
caused the build to croak is still there, which confused me. 8-)
In case you're interested, that failure is:
gmake[7]: Entering directory `/projects/bbp_ext7/systems/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/libsupc++'
/bin/sh ../libtool --tag CXX --tag disable-shared --mode=compile /home/cgd/proj/gcc-testing/build_isa32/gcc/xgcc -shared-libgcc -B/home/cgd/proj/gcc-testing/build_isa32/gcc/ -nostdinc++ -L/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/src -L/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/src/.libs -nostdinc -B/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/newlib/ -isystem /home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/newlib/targ-include -isystem /home/cgd/proj/gcc-testing/combined/newlib/libc/include -B/home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/bin/ -B/home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/lib/ -isystem /home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/include -L/home/cgd/proj/gcc-testing/build_isa32/ld -mips64 -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/../gcc -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/../include -I/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/include/mipsisa32-elf -I/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/include -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++ -g -O2 -mips64 -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -g -c /home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/del_op.cc
/home/cgd/proj/gcc-testing/build_isa32/gcc/xgcc -shared-libgcc -B/home/cgd/proj/gcc-testing/build_isa32/gcc/ -nostdinc++ -L/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/src -L/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/src/.libs -nostdinc -B/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/newlib/ -isystem /home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/newlib/targ-include -isystem /home/cgd/proj/gcc-testing/combined/newlib/libc/include -B/home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/bin/ -B/home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/lib/ -isystem /home/cgd/proj/gcc-testing/install_isa32/mipsisa32-elf/include -L/home/cgd/proj/gcc-testing/build_isa32/ld -mips64 -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/../gcc -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/../include -I/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/include/mipsisa32-elf -I/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/include -I/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++ -g -O2 -mips64 -fno-implicit-templates -Wall -Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once -g -c /home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/del_op.cc -o del_op.o
In file included from /home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/del_op.cc:31:
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:79: `operator
new' takes type `size_t' (`unsigned int') as first parameter
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:80: `operator
new' takes type `size_t' (`unsigned int') as first parameter
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:83: `operator
new' takes type `size_t' (`unsigned int') as first parameter
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:84: `operator
new' takes type `size_t' (`unsigned int') as first parameter
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:89: `operator
new' takes type `size_t' (`unsigned int') as first parameter
/home/cgd/proj/gcc-testing/combined/libstdc++-v3/libsupc++/new:90: `operator
new' takes type `size_t' (`unsigned int') as first parameter
gmake[7]: *** [del_op.lo] Error 1
it appears that what's going on is that in the preprocessed source:
# 147 "/home/cgd/proj/gcc-testing/build_isa32/gcc/include/stddef.h" 3 4
typedef long int ptrdiff_t;
# 201 "/home/cgd/proj/gcc-testing/build_isa32/gcc/include/stddef.h" 3 4
typedef long unsigned int size_t;
# 48 "/home/cgd/proj/gcc-testing/build_isa32/mipsisa32-elf/mips64/libstdc++-v3/include/cstddef" 2 3
because, due to the MEABI -mips64 spec handling, __SIZE_TYPE__ is
'unsigned long int' and __PTRDIFF_TYPE__ is 'long int'.
Alas:
#ifndef Pmode
#define Pmode ((TARGET_LONG64 && TARGET_64BIT) ? DImode : SImode)
#endif
and AFAICT TARGET_LONG64 won't be set.
I'm thinking that the code (starting w/ the comment on line 4914 or
thereabouts in mips.c):
/* If no type size setting options (-mlong64,-mint64,-mlong32) were used
then set the type sizes. In the EABI in 64 bit mode, longs and
pointers are 64 bits. Likewise for the SGI Irix6 N64 ABI. */
if (mips_explicit_type_size_string == NULL
&& ((mips_abi == ABI_EABI && TARGET_64BIT)
|| mips_abi == ABI_64))
target_flags |= MASK_LONG64;
should have an additional term:
|| (mips_abi == ABI_MEABI && TARGET_64BIT)
in the obvious place (with the comment updated to match).
I'm trying a build w/ the diff below. If it goes well i'll send in
the patch w/ a change log and a request for approval.
Especially since i know _nothing_ about the MEABI, any thoughts you
might have about this would be appreciated. I just made this change
based on the cpp specs you've provided. 8-)
thanks,
chris
===================================================================
Index: mips.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.181
diff -u -r1.181 mips.c
--- mips.c 10 Mar 2002 01:38:59 -0000 1.181
+++ mips.c 13 Mar 2002 01:05:19 -0000
@@ -4912,10 +4912,11 @@
target_flags &= ~ (MASK_FLOAT64|MASK_64BIT);
/* If no type size setting options (-mlong64,-mint64,-mlong32) were used
- then set the type sizes. In the EABI in 64 bit mode, longs and
- pointers are 64 bits. Likewise for the SGI Irix6 N64 ABI. */
+ then set the type sizes. In the EABI and MEABI in 64 bit mode, longs
+ and pointers are 64 bits. Likewise for the SGI Irix6 N64 ABI. */
if (mips_explicit_type_size_string == NULL
&& ((mips_abi == ABI_EABI && TARGET_64BIT)
+ || (mips_abi == ABI_MEABI && TARGET_64BIT)
|| mips_abi == ABI_64))
target_flags |= MASK_LONG64;