Re: floats / Porting GCC on a new arch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/2/25 Kai Ruottu <kai.ruottu@xxxxxxxxxxx>:
> Florent DEFAY wrote:
>
>> My target machine doesn't support floats operations
>
>> so I defined these macros :
>>
>> #define TARGET_FLOAT_FORMAT IEEE_FLOAT_FORMAT
>>
>> #undef  TARGET_DECIMAL_FLOAT_SUPPORTED_P
>> #define TARGET_DECIMAL_FLOAT_SUPPORTED_P
>>  target_decimal_float_supported_p
>> // returns always false
>> #undef  TARGET_FIXED_POINT_SUPPORTED_P
>> #define TARGET_FIXED_POINT_SUPPORTED_P      target_fixed_point_supported_p
>> // returns always false
>>
>> and that's all about floats.
>>
>> What should I additionally implement ?
>
> The normal way with no-FPU CPUs seems to be to use the
> 'config/fp-bit.c' which implements the basic soft-float
> routines in C.  These routines then will be a part of the
> 'libgcc.a', the "GCC helper library". Another way is to
> implement these in the opsys kernel like in x86 with the
> old i386, i486SX, "embedded x86" etc. "no-*87 FPU inside"
> CPUs in the Linux kernel. The idea being that there could
> be that FPU in the system but when there isn't, every float
> opcode causes a "trap" or "exception" which the opsys kernel
> will handle... Third way is to implement the soft-float ops
> in the C library, I remember in Linux/PPC this being the
> case, the 'glibc' for it includes the soft-float operations.
>
> But with embedded "no FPU anywhere" CPUs the 'libgcc.a'
> normally has those basic soft-float routines for add/sub/mul/div
> for floats and doubles...  Just "spy" the already ported
> CPUs, their "target Makefile-fragments", the 't-<cpu>' or
> something files in 'gcc/config/<cpu>'...
>

Thank you.

I did. Now I have a makefile-fragment containing this :

FPBIT = fp-bit.c
DPBIT = dp-bit.c

fp-bit.c: $(srcdir)/config/fp-bit.c
        echo '#define FLOAT' > fp-bit.c
        cat $(srcdir)/config/fp-bit.c >> fp-bit.c

dp-bit.c: $(srcdir)/config/fp-bit.c
        cat $(srcdir)/config/fp-bit.c > dp-bit.c

But it did not changed the behavior of my cc1.

I still have this error :

Program received signal SIGSEGV, Segmentation fault.
builtin_define_float_constants (name_prefix=0x83fcaf9 "FLT",
fp_suffix=0x8419523 "F", fp_cast=0x84109dd "%s", type=0xb7d01410) at
../../gcc-4.3.3/gcc/c-cppbuiltin.c:108
108       gcc_assert (fmt->b != 10);

and the back trace is

(gdb) bt
#0  builtin_define_float_constants (name_prefix=0x83fcaf9 "FLT",
fp_suffix=0x8419523 "F", fp_cast=0x84109dd "%s", type=0xb7d01410) at
../../gcc-4.3.3/gcc/c-cppbuiltin.c:108
#1  0x08090324 in c_cpp_builtins (pfile=0x9dd56d0) at
../../gcc-4.3.3/gcc/c-cppbuiltin.c:508
#2  0x08087809 in finish_options () at ../../gcc-4.3.3/gcc/c-opts.c:1508
#3  0x08087a15 in c_common_parse_file (set_yydebug=0) at
../../gcc-4.3.3/gcc/c-opts.c:1288
#4  0x08202297 in toplev_main (argc=13, argv=0xbfb38404) at
../../gcc-4.3.3/gcc/toplev.c:1042
#5  0x080a47d2 in main (argc=788558629, argv=0x66006425) at
../../gcc-4.3.3/gcc/main.c:35

Is my makefile-fragment not sufficient ? Or maybe the error is not
connected with a floats implementation problem ?

Thank you.

Florent


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux