public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* 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
* 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

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-10-06  6:02 build libgcc for i486 with msoft-float failed Reid M
2013-10-06 17:33 ` Kai Ruottu
2013-10-07 15:54 ` Ian Lance Taylor
2013-10-07 18:43   ` Reid M
2013-11-05 18:41 Uros Bizjak

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