As I have seen that more people have problems with a missing __fsetfpucw when
compiling/linking software with glibc-2.1.1 here is my hack to solve this problem.
Before glibc-2.1.1 the function __setfpucw() was declared global in
/usr/include/fpu_control.h at the end of this file
.
.
.
__BEGIN_DECLS
/* Called at startup. It can be used to manipulate fpu control register. */
extern void __setfpucw __P ((fpu_control_t));
__END_DECLS
#endif /* fpu_control.h */
The suggestion, given in the comment above it, was applied in a lot of programs out
there which don't compile and link anymore because as of glibc-2.1.1 this declaration
is simply missing. Not even one notification is left behind to say something about
it's elimination. From bug report
http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl/full/1105
I understand that the function from now on is local to libc as it was always mentioned
to be. (Despite the comment above the global function declaration, I should say)
I ran into problems when compiling Ptolemy 0.7.1 from
http://ptolemy.eecs.berkeley.edu on SuSE Linux 6.2. They used __setfpucw() in two
files with an interesting comment which says nothing to me (maybe someone can tell
(me) more about that):
#ifdef linux
// Fix for DECalendarQueue SIGFPE under linux.
__setfpucw(_FPU_DEFAULT | _FPU_MASK_IM);
#endif
(The Ptolemy files are $PTOLEMY/src/pigiRpc/pigiMain.cc and
PTOLEMY/src/ptcl/ptclInit.cc)
To fix the problem, in the concerning source files I added the following function
definition:
inline void __setfpucw(int cw) { _FPU_SETCW(cw); }
This way __setfpucw symbol is defined as a wrapper which executes _FPU_SETCW(cw) which
is a macro (still?) defined in fpu_control.h. Now, the files compile and link again.
However, I am not 100% sure if _FPU_SETCW() modifies the wanted fpu control register,
but the macro name suggests it does (Ptolemy runs fine). Furthermore, since
_FPU_SETCW() is still a declaration with a leading underscore (only one this time) and
a lot of people were referring to the FAQ, which seems to say something like don't use
stuff from libc with leading underscores, I hope this macro will remain defined for a
while. Of course, as a last resort, one can always plug in the corresponding assembler
instruction in your own defined __setfpucw(int cw) to get
inline void __setfpucw(int cw) { __asm__ ("fnstcw %0" : "=m" (*&cw)) ; }
Hope someone can use this,
Dion
----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: [EMAIL PROTECTED]