[PATCH] Builtins and C++ and such (take 2)

Roger Sayle roger@eyesopen.com
Mon Mar 25 06:09:00 GMT 2002

Hi Mark,

Many thanks for reviewing the g++ changes.

> This version looks good to me.  As I read it, the V3 change is only
> necessary to make the builtin optimization work -- without it, V3
> would still work, but we would get the unoptimized version of the
> builtins, correct?

Not quite.  Without the change to <cmath> there are two regressions
in the libstdc++-v3 test suite, both in 26_numerics.

One side-effect of disabling the built-in, is that functions that
used to get C linkage due to the previously anticipated prototype,
end up with C++ linkage.   This results in warnings about unresolved
references to std::abs and std::sqrt during linking (which should
be references to _abs and _sqrt).

Alternative fixes include either compiling libstdc++.so with the
-fno-builtin flag, or explictly adding an extern "C++" linkage for
these functions to the libstdc++ library.  Ben, any preferences?
Simply re-ordering statements in cmath had the dual benefits of
fixing the linkage errors and enabling the builtin optimizations.

> If that is so, the patch is fine for mainline and branch.

Alas I don't have CVS write privileges.  But we should wait for
the libstc++ issues to be resolved before proceeding.

Many thanks once again.

Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833

More information about the Gcc-patches mailing list