This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: build libgcc for i486 with msoft-float failed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]