This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Data representation and cross compiles
Daniel Jacobowitz <drow@mvista.com> writes:
| On Wed, Aug 28, 2002 at 02:25:21PM +0200, Gabriel Dos Reis wrote:
| >
| > I'm investigating the V3 build failure reported by the regression
| > tester. I think it doesn't occur on natives, it occurs on
| > cross-compilers only.
| >
| > Suppose I configure for a cross-compiler with
| >
| > --build=i686-pc-linux
| > --host=i686-pc-linux
| > --target=mips-elf
| >
| > Furthermore, assume:
| >
| > sizeof (host_int) == 4 | sizeof (host_long_double) == 12
| > sizeof (target_int) == 4 | sizeof (target_long_double) == 16
| >
| >
| > In the *library* source code, I have something like :
| >
| > sizeof (long double) / sizeof (int)
| >
| > I think the above expression should evaluate to 4 -- since the library
| > is being built for mips-elf -- but the compiler seems to evaluate
| > it to 3 (apparently using i686-pc-linux information).
| >
| > Thoughts?
|
| Well, I don't like your assumptions very much :) mips.h:
|
| /* A C expression for the size in bits of the type `long double' on
| the target machine. If you don't define this, the default is two
| words. */
| #define LONG_DOUBLE_TYPE_SIZE 64
|
| Long doubles are twelve bytes on i386 and eight bytes on MIPS. If
| you're seeing some sort of size mismatch, I'd bet that was it.
Hmm, I tried a cross-compile and the size I got from the preprocessed
output are those I used in the above description :-)
More specifically, all "long double" settings I got from the
preprocessed source are as if long double was 128 bits wide on
misp-elf.
That means, as you say, that somewhere some (duplicated) configuration
settings don't match.
Wait. Indeed, I don't see any thing under libstdc++-v3/config/cpu/mips/
that sets the sizes. Therefore, it defaults -- according to the
comment
// These values can be overridden in the target configuration file.
// The default values are appropriate for many 32-bit targets.
to 128 as per libstdc++-v3/include/std/std_limits.h:115:
#ifndef __glibcpp_long_double_bits
# define __glibcpp_long_double_bits 128
#endif
Bummer.
OK, thanks for your comment. It was very helfpul. I'll try to
minimise the configuration settings duplication by having
gcc/c-common.c:cpp_define_data_format() define the appropriate bits.
Thanks,
-- Gaby