[vorbis-dev] bug in glibc 2.1.2 and older

Monty xiphmont at xiph.org
Sat Jun 24 00:31:06 PDT 2000



This is cropping up more than I expected.  Apparently, many distributions are
still shipping their latest versions with the broken glibcs...

Recently I decided that a specific glibc bug (that causes mangled audio or
crashes) that I found nearly a year ago (and has been fixed for as long) had
probably become scarce enough to risk removing the '-D__NO_MATH_INLINES' define
from the build.  Math inlines help decode performance by using direct i387
assembly for exp() rather than a function call.

I was wrong.  It seems that glibc 2.1.2 and older is still alive and well.

Glibc 2.1.3 is required for libvorbis to build correctly.  Older versions of glibc contain a bug in the hand-rolled inline assembly for math functions; specifically, they interfere with GCC's FPU stack allocation and result in stack overflows. 

If you're curious about your glibc 2.1, look at /usr/include/bit/mathinline.h and search for 'log10'.  The correct line should read:

__inline_mathop_decl (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)")

If your version is missing the "st(1)" at the end, YOU WILL NOT BE ABLE TO BUILD A WORKING LIBVORBIS.  Not only that, but anything you've ever built on your machine that uses rint(), log(), log10(), exp(), etc, stands a good chance of being broken.  Upgrading the libc (*and* the headers) and rebuilding affected packages is the only way to eliminate the problem.

(Note that log10 is not the only affected function, it's just the easiest to check.)

If replacing libc is not an option, all C modules should be built with _D__NO_MATH_INLINES  This will result in a performance sacrifice, but will produce correct binaries.

Monty

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list