public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: build libgcc for i486 with msoft-float failed
@ 2013-11-05 18:41 Uros Bizjak
  0 siblings, 0 replies; 5+ messages in thread
From: Uros Bizjak @ 2013-11-05 18:41 UTC (permalink / raw)
  To: gcc-help; +Cc: Reid M

Hello!

> I was trying to build cross gcc and libgcc based on gcc-4.8 for target
> i486 without floating point support.
>
> I build libgcc with option "-D_SOFT_FLOAT -march=i486 -msoft-float
> -mno-sse -Wa,-march=i486" but I met following errors:
>
> 1.  compilation error in file "crtprec.c" : used inline assembly which
> contains float-point instruction
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c: Assembler messages:
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c:40: Error: `fstcw' is
> not supported on `i486'
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c:45: Error: `fldcw' is
> not supported on `i486'
>
> 2. After I comment out the inline assembly to avoid error 1, I could
> get a libgcc for i486 version. There's some undefined soft-float
> function as the following. The source code of corresponding function
> are existed in libgcc but they aren't included in libgcc.a.
> out/target/product/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(time.o):
> In function `clock_now':
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi

> My gcc version is 4.8 and configuration is
> ============================================
> ./gcc-4.8/configure --target=i486-linux-android --disable-multilib
> --disable-nls --disable-shared --disable-threads --enable-visibility
> --disable-decimal-float --disable-bootstrap  --enable-languages=c,c++
> ============================================
>
> Could anybody shed some light on how to build libgcc for target i486
> without floating point support?  Thanks a lot.

The soft-float support has just been committed to mainline SVN (to
become gcc-4.9).

1. gcc for x86 will automatically define _SOFT_FLOAT when -msoft-float
(aka -mno-80387) option is specified, so all you need is to build
libgcc with options "-march=i486 -Wa,-march=i486 -msoft-float". The
library has got #ifndef _SOFT_FLOAT in correct places. I also don't
think you need -mno-sse, 32bit i486 has no SSE enabled by default.

2. The gcc library is missing compiled-in float and double soft-fp
support. You will need following patch:

--cut here--
Index: libgcc/config.host
===================================================================
--- libgcc/config.host  (revision 204405)
+++ libgcc/config.host  (working copy)
@@ -1228,7 +1228,7 @@
   i[34567]86-*-openbsd* | x86_64-*-openbsd*)
        tmake_file="${tmake_file} t-softfp-tf"
        if test "${host_address}" = 32; then
-               tmake_file="${tmake_file} i386/${host_address}/t-softfp"
+               tmake_file="${tmake_file} t-softfp-sfdf
i386/${host_address}/t-softfp"
        fi
        tmake_file="${tmake_file} i386/t-softfp t-softfp"
        ;;
--cut here--

Android is by default compiled with 64bit long double, so this should be enough.

Uros.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build libgcc for i486 with msoft-float failed
  2013-10-07 15:54 ` Ian Lance Taylor
@ 2013-10-07 18:43   ` Reid M
  0 siblings, 0 replies; 5+ messages in thread
From: Reid M @ 2013-10-07 18:43 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

On Mon, Oct 7, 2013 at 8:54 AM, Ian Lance Taylor <iant@google.com> wrote:
> On Sat, Oct 5, 2013 at 11:02 PM, Reid M <reid3759@gmail.com> wrote:
>> I was trying to build cross gcc and libgcc based on gcc-4.8 for target
>> i486 without floating point support.
>
Do you really have that hardware platform--80486 without 80487?
>>> Yes, the hardware platform is a 486 core without fpu.

>> 2. After I comment out the inline assembly to avoid error 1, I could
>> get a libgcc for i486 version. There's some undefined soft-float
>> function as the following. The source code of corresponding function
>> are existed in libgcc but they aren't included in libgcc.a.
>> out/target/product/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(time.o):
>> In function `clock_now':
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__floatsidf'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__floatsidf'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__muldf3'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__adddf3'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__fixdfsi'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__floatsidf'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__floatsidf'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__muldf3'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__adddf3'
>> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
>> undefined reference to `__fixdfsi
>
You should try adding t-softfp to tmake_file in config.host.  I don't
know if that is all you will need but it will take you one step
further.  See the targets in config.host that use t-softfp.  Note that
you don't want i386/t-softfp, or at least not just that--that is just
an RTEMS patch and doesn't do most of what is needed.

>> I'll try it, thanks a lot.

> Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build libgcc for i486 with msoft-float failed
  2013-10-06  6:02 Reid M
  2013-10-06 17:33 ` Kai Ruottu
@ 2013-10-07 15:54 ` Ian Lance Taylor
  2013-10-07 18:43   ` Reid M
  1 sibling, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2013-10-07 15:54 UTC (permalink / raw)
  To: Reid M; +Cc: gcc-help

On Sat, Oct 5, 2013 at 11:02 PM, Reid M <reid3759@gmail.com> wrote:
> I was trying to build cross gcc and libgcc based on gcc-4.8 for target
> i486 without floating point support.

Do you really have that hardware platform--80486 without 80487?


> 2. After I comment out the inline assembly to avoid error 1, I could
> get a libgcc for i486 version. There's some undefined soft-float
> function as the following. The source code of corresponding function
> are existed in libgcc but they aren't included in libgcc.a.
> out/target/product/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(time.o):
> In function `clock_now':
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi

You should try adding t-softfp to tmake_file in config.host.  I don't
know if that is all you will need but it will take you one step
further.  See the targets in config.host that use t-softfp.  Note that
you don't want i386/t-softfp, or at least not just that--that is just
an RTEMS patch and doesn't do most of what is needed.

Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: build libgcc for i486 with msoft-float failed
  2013-10-06  6:02 Reid M
@ 2013-10-06 17:33 ` Kai Ruottu
  2013-10-07 15:54 ` Ian Lance Taylor
  1 sibling, 0 replies; 5+ messages in thread
From: Kai Ruottu @ 2013-10-06 17:33 UTC (permalink / raw)
  To: gcc-help

6.10.2013 9:02, Reid M kirjoitti:
> I was trying to build cross gcc and libgcc based on gcc-4.8 for target
> i486 without floating point support.

For me there is always FP support, either using the FPU ("487") or via 
the soft-float
package...

>
> I build libgcc with option "-D_SOFT_FLOAT -march=i486 -msoft-float
> -mno-sse -Wa,-march=i486" but I met following errors:
>
> 1.  compilation error in file "crtprec.c" : used inline assembly which
> contains float-point instruction
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c: Assembler messages:
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c:40: Error: `fstcw' is
> not supported on `i486'
> ../../../gcc-4.8/libgcc/config/i386/crtprec.c:45: Error: `fldcw' is
> not supported on `i486'

Maybe the compile option :

-mno-fp-ret-in-387
Do not use the FPU registers for return values of functions.
The usual calling convention has functions return values of types float and
double in an FPU register, even if there is no FPU. The idea is that the
operating system should emulate an FPU.
The option ‘-mno-fp-ret-in-387’ causes such values to be returned in 
ordinary
CPU registers instead.

would correct this...

>
> 2. After I comment out the inline assembly to avoid error 1, I could
> get a libgcc for i486 version. There's some undefined soft-float
> function as the following. The source code of corresponding function
> are existed in libgcc but they aren't included in libgcc.a.
> out/target/product/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(time.o):
> In function `clock_now':
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__floatsidf'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__muldf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__adddf3'
> /home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
> undefined reference to `__fixdfsi
>
> My gcc version is 4.8 and configuration is
> ============================================
> ./gcc-4.8/configure --target=i486-linux-android --disable-multilib
> --disable-nls --disable-shared --disable-threads --enable-visibility
> --disable-decimal-float --disable-bootstrap  --enable-languages=c,c++
> ============================================

There comes the assumption with i386 and i486SX and told in the 
'-mno-fp-ret-in-387'
description : "The idea is that the operating system should emulate an FPU."

So : Are you really sure that you will need soft-float support in libgcc 
? Ie
Android/Linux for i486 doesn't include the usual "i387-emulator" in its
kernel? For MS/PC-DOS and DJGPP there was that "TSR-program" working
as the i387-emulator, Windoze, Linux, *BSD etc. should include their own
equivalents...

>
> Could anybody shed some light on how to build libgcc for target i486
> without floating point support?

If Android/Linux for i486 doesn't include any i387/487-emulator, then 
you should
study its config settings for GCC. Maybe there then already is a special 
target name
for the i486SX CPU without the FPU used with Android. Or someone like 
you should
add it...

Adding '-mno-fp-ret-in-387' to the '-march=i486 -msoft-float -mno-sse'
"default compile options" for this new special target name would be one
task, another including the usual 'fp-bit.c/dp-bit.c' soft-float 
routines into
the produced 'libgcc'...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* build libgcc for i486 with msoft-float failed
@ 2013-10-06  6:02 Reid M
  2013-10-06 17:33 ` Kai Ruottu
  2013-10-07 15:54 ` Ian Lance Taylor
  0 siblings, 2 replies; 5+ messages in thread
From: Reid M @ 2013-10-06  6:02 UTC (permalink / raw)
  To: gcc-help; +Cc: iant

I was trying to build cross gcc and libgcc based on gcc-4.8 for target
i486 without floating point support.

I build libgcc with option "-D_SOFT_FLOAT -march=i486 -msoft-float
-mno-sse -Wa,-march=i486" but I met following errors:

1.  compilation error in file "crtprec.c" : used inline assembly which
contains float-point instruction
../../../gcc-4.8/libgcc/config/i386/crtprec.c: Assembler messages:
../../../gcc-4.8/libgcc/config/i386/crtprec.c:40: Error: `fstcw' is
not supported on `i486'
../../../gcc-4.8/libgcc/config/i386/crtprec.c:45: Error: `fldcw' is
not supported on `i486'

2. After I comment out the inline assembly to avoid error 1, I could
get a libgcc for i486 version. There's some undefined soft-float
function as the following. The source code of corresponding function
are existed in libgcc but they aren't included in libgcc.a.
out/target/product/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(time.o):
In function `clock_now':
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__floatsidf'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__floatsidf'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__muldf3'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__adddf3'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__fixdfsi'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__floatsidf'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__floatsidf'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__muldf3'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__adddf3'
/home/reid/android/android-4.2.1_r1/bionic/libc/unistd/time.c:53:
undefined reference to `__fixdfsi

My gcc version is 4.8 and configuration is
============================================
./gcc-4.8/configure --target=i486-linux-android --disable-multilib
--disable-nls --disable-shared --disable-threads --enable-visibility
--disable-decimal-float --disable-bootstrap  --enable-languages=c,c++
============================================

Could anybody shed some light on how to build libgcc for target i486
without floating point support?  Thanks a lot.

Best Regards,
Reid

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-05 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 18:41 build libgcc for i486 with msoft-float failed Uros Bizjak
  -- strict thread matches above, loose matches on Subject: below --
2013-10-06  6:02 Reid M
2013-10-06 17:33 ` Kai Ruottu
2013-10-07 15:54 ` Ian Lance Taylor
2013-10-07 18:43   ` Reid M

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).