GPM 1.20.1 problems

Greg Schafer gschafer at zip.com.au
Tue Jan 21 21:32:50 PST 2003


On Tue, Jan 21, 2003 at 10:45:44PM -0600, Bruce Dubbs wrote:
> I think I found it. In math.h we have:
> 
> #ifdef __USE_EXTERN_INLINES
> # include <bits/mathinline.h>
> #endif
> 
> in bits/mathinline.h we have:
> 
> extern __inline double ceil (double __x)
> { register long double __value;
>  __volatile unsigned short int __cw;
>  __volatile unsigned short int __cwtmp;
>  __asm __volatile ("fnstcw %0" : "=m" (__cw));
>  __cwtmp = (__cw & 0xf3ff) | 0x0800;
>  __asm __volatile ("fldcw %0" : : "m" (__cwtmp));
>  __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
>  __asm __volatile ("fldcw %0" : : "m" (__cw));
>  return __value;
> }
> 
> Which substitues inline assembly for the ceil function.  gcc must define 
> __USE_EXTERN_INLINES when the -O1 or above optimizations are used.  You 
> could force it in -Os by defining before including math.h.  Note that 
> calling the functon in glibc *does* decrease the size of the executable 
> by about nine instructions but defining the var increases program size.

Cool. Thanks for looking at it Bruce. Us weenies can now sleep at night :-)

But strictly speaking, it's not gcc defining __USE_EXTERN_INLINES. It
actually comes from features.h:-

/* Decide whether we can define 'extern inline' functions in headers.  */
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
    && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
# define __USE_EXTERN_INLINES   1
#endif

But of course gcc does define the __OPTIMIZE__ stuff in there.

Greg
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-dev' in the subject header of the message



More information about the blfs-dev mailing list