public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc 4.x and support of x87 FPU in libstdc++
@ 2014-01-12  2:57 Denis K
  2014-01-12  9:00 ` H.J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Denis K @ 2014-01-12  2:57 UTC (permalink / raw)
  To: gcc

Hello,

I've been trying to compile gcc 4.5.4 from the sources using
--with-fpmath=387 but I'm getting this error: "Invalid
--with-fpmath=387". I looked in the configs and found that it doesn't
support this option:

case ${with_fpmath} in
  avx)
    tm_file="${tm_file} i386/avxmath.h"
    ;;
  sse)
    tm_file="${tm_file} i386/ssemath.h"
    ;;
  *)
    echo "Invalid --with-fpmath=$with_fpmath" 1>&2
    exit 1

Basically, I started this whole thing because I need to supply a
statically linked executable for an old target platform (in fact, it's
an old Celeron but without any SSE2 instructions that are apparently
used by libstdc++ by DEFAULT). The executable crashes at the first
instruction (movq XMM0,...) coming from copying routines in the
internals of libstdc++ with an "Illegal instruction" message. Is there
any way to resolve this? I need to be on a fairly recent g++ to be
able to port my existing code base and it should be all statically
linked as the target OS hardly has anything installed.

I was wondering if it's possible to supply these headers/sources from
an older build to enable support for regular x87 instructions, so that
no SSE instructions are referenced?

PS Right now I'm trying a hack in gcc\config\i386\ssemath.h where I replace

#undef TARGET_FPMATH_DEFAULT
#define TARGET_FPMATH_DEFAULT (TARGET_SSE2 ? FPMATH_SSE : FPMATH_387)

#undef TARGET_SUBTARGET32_ISA_DEFAULT
#define TARGET_SUBTARGET32_ISA_DEFAULT \
   (OPTION_MASK_ISA_MMX | OPTION_MASK_ISA_SSE | OPTION_MASK_ISA_SSE2)

with

#undef TARGET_FPMATH_DEFAULT
#define TARGET_FPMATH_DEFAULT (FPMATH_387)

#undef TARGET_SUBTARGET32_ISA_DEFAULT
#define TARGET_SUBTARGET32_ISA_DEFAULT \
   (OPTION_MASK_ISA_MMX )


But I'm not sure this is going to to work and what sort of side
effects this could cause.


Thanks.

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

* Re: gcc 4.x and support of x87 FPU in libstdc++
  2014-01-12  2:57 gcc 4.x and support of x87 FPU in libstdc++ Denis K
@ 2014-01-12  9:00 ` H.J. Lu
  0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2014-01-12  9:00 UTC (permalink / raw)
  To: Denis K; +Cc: GCC Development

On Sat, Jan 11, 2014 at 6:54 PM, Denis K <deniskravtsov@gmail.com> wrote:
> Hello,
>
> I've been trying to compile gcc 4.5.4 from the sources using
> --with-fpmath=387 but I'm getting this error: "Invalid
> --with-fpmath=387". I looked in the configs and found that it doesn't
> support this option:
>
> case ${with_fpmath} in
>   avx)
>     tm_file="${tm_file} i386/avxmath.h"
>     ;;
>   sse)
>     tm_file="${tm_file} i386/ssemath.h"
>     ;;
>   *)
>     echo "Invalid --with-fpmath=$with_fpmath" 1>&2
>     exit 1
>
> Basically, I started this whole thing because I need to supply a
> statically linked executable for an old target platform (in fact, it's
> an old Celeron but without any SSE2 instructions that are apparently
> used by libstdc++ by DEFAULT). The executable crashes at the first

How did you configure GCC?


-- 
H.J.

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

* Re: gcc 4.x and support of x87 FPU in libstdc++
  2014-01-12 17:37 ` H.J. Lu
@ 2014-01-12 19:42   ` Denis K
  0 siblings, 0 replies; 5+ messages in thread
From: Denis K @ 2014-01-12 19:42 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Development

Thank you, I think it worked (but I also patched ssemath.h locally, so
need to roll back and recompile again to make sure). Though I'm not
exactly sure why I didn't get an error from configure. I'm not very
familiar with the syntax used but I was thinking that

case ${with_fpmath} in
  avx)
    tm_file="${tm_file} i386/avxmath.h"
    ;;
  sse)
    tm_file="${tm_file} i386/ssemath.h"
    ;;
  *)
    echo "Invalid --with-fpmath=$with_fpmath" 1>&2
    exit 1

Only allows for avx or sse and any other option should result in the
default case leading to a failure.


On 12 January 2014 15:50, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Jan 12, 2014 at 7:42 AM, Denis K <deniskravtsov@gmail.com> wrote:
>> My settings were taken from the comment here:
>> http://stackoverflow.com/questions/9450394/how-to-install-gcc-from-scratch-with-gmp-mpfr-mpc-elf-without-shared-librari
>>
>> --disable-shared
>>   --disable-bootstrap
>>   --disable-libstdcxx-pch
>>   --enable-languages=all
>>   --enable-libgomp
>>   --enable-lto
>>   --enable-threads=posix
>>   --enable-tls
>>   --with-gmp=/tmp/gcc
>>   --with-mpfr=/tmp/gcc
>>   --with-mpc=/tmp/gcc
>>   --with-libelf=/tmp/gcc
>>   --with-fpmath=sse
>>
>
> Please remove " --with-fpmath=sse".
>
>
> --
> H.J.

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

* Re: gcc 4.x and support of x87 FPU in libstdc++
  2014-01-12 15:50 Denis K
@ 2014-01-12 17:37 ` H.J. Lu
  2014-01-12 19:42   ` Denis K
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2014-01-12 17:37 UTC (permalink / raw)
  To: Denis K; +Cc: GCC Development

On Sun, Jan 12, 2014 at 7:42 AM, Denis K <deniskravtsov@gmail.com> wrote:
> My settings were taken from the comment here:
> http://stackoverflow.com/questions/9450394/how-to-install-gcc-from-scratch-with-gmp-mpfr-mpc-elf-without-shared-librari
>
> --disable-shared
>   --disable-bootstrap
>   --disable-libstdcxx-pch
>   --enable-languages=all
>   --enable-libgomp
>   --enable-lto
>   --enable-threads=posix
>   --enable-tls
>   --with-gmp=/tmp/gcc
>   --with-mpfr=/tmp/gcc
>   --with-mpc=/tmp/gcc
>   --with-libelf=/tmp/gcc
>   --with-fpmath=sse
>

Please remove " --with-fpmath=sse".


-- 
H.J.

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

* Re: gcc 4.x and support of x87 FPU in libstdc++
@ 2014-01-12 15:50 Denis K
  2014-01-12 17:37 ` H.J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Denis K @ 2014-01-12 15:50 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Development

My settings were taken from the comment here:
http://stackoverflow.com/questions/9450394/how-to-install-gcc-from-scratch-with-gmp-mpfr-mpc-elf-without-shared-librari

--disable-shared
  --disable-bootstrap
  --disable-libstdcxx-pch
  --enable-languages=all
  --enable-libgomp
  --enable-lto
  --enable-threads=posix
  --enable-tls
  --with-gmp=/tmp/gcc
  --with-mpfr=/tmp/gcc
  --with-mpc=/tmp/gcc
  --with-libelf=/tmp/gcc
  --with-fpmath=sse

When I tried supplying  "--with-fpmath=387" instead, I came across the
problem that was in my original question.

On 12 January 2014 02:57, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sat, Jan 11, 2014 at 6:54 PM, Denis K <deniskravtsov@gmail.com> wrote:
>> Hello,
>>
>> I've been trying to compile gcc 4.5.4 from the sources using
>> --with-fpmath=387 but I'm getting this error: "Invalid
>> --with-fpmath=387". I looked in the configs and found that it doesn't
>> support this option:
>>
>> case ${with_fpmath} in
>>   avx)
>>     tm_file="${tm_file} i386/avxmath.h"
>>     ;;
>>   sse)
>>     tm_file="${tm_file} i386/ssemath.h"
>>     ;;
>>   *)
>>     echo "Invalid --with-fpmath=$with_fpmath" 1>&2
>>     exit 1
>>
>> Basically, I started this whole thing because I need to supply a
>> statically linked executable for an old target platform (in fact, it's
>> an old Celeron but without any SSE2 instructions that are apparently
>> used by libstdc++ by DEFAULT). The executable crashes at the first
>
> How did you configure GCC?
>
>
> --
> H.J.

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

end of thread, other threads:[~2014-01-12 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-12  2:57 gcc 4.x and support of x87 FPU in libstdc++ Denis K
2014-01-12  9:00 ` H.J. Lu
2014-01-12 15:50 Denis K
2014-01-12 17:37 ` H.J. Lu
2014-01-12 19:42   ` Denis K

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