libstdc++/8197: std::sin(float) causes undefined reference to sinf
Christian Ehrhardt
ehrhardt@mathematik.uni-ulm.de
Sat Oct 26 07:19:00 GMT 2002
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8197
Hi,
I got some more information on this one and a patch that fixes the
problem for me:
std::sin(float) fails
std::sin(double) works
::sin(float) works
std::sin(float) and Linking against libstc++.a works
The problem seems to be that std::sin(float) is an inline function defined in
cmath. This inline function uses __builtin_sinf which in turn generates
a reference to a function sinf.
This function even exists and is exported from stubs.o:
turing# nm sparc-sun-solaris2.9/libstdc++-v3/libmath/stubs.o |grep sinf
00000714 T sinf
However, in libstdc++.so the symbol sinf is private:
turing# nm sparc-sun-solaris2.9/libstdc++-v3/src/.libs/libstdc++.so |grep sinf
00050c78 t sinf
This is caused by using linker-map.gnu instead of the dummy linker map file.
This patch fixes the problem for me. I'm fully aware that this is
probably not the correct way to fix this but determining the correct way
is currently beyond me:
--- gcc-3.2/libstdc++-v3/config/linker-map.gnu.orig Fri Oct 25 17:26:02 2002
+++ gcc-3.2/libstdc++-v3/config/linker-map.gnu Fri Oct 25 17:26:02 2002
@@ -108,6 +108,40 @@
# __gnu_cxx::_verbose_terminate_handler()
_ZN9__gnu_cxx27__verbose_terminate_handlerEv;
+ # stub functions from libmath
+ sinf;
+ sinl;
+ sinhf;
+ sinhl;
+ cosf;
+ cosl;
+ coshf;
+ coshl;
+ tanf;
+ tanl;
+ tanhf;
+ tanhl;
+ atan2f;
+ atan2l;
+ expf;
+ expl;
+ hypotf;
+ hypotl;
+ hypot;
+ logf;
+ logl;
+ log10f;
+ log10l;
+ powf;
+ powl;
+ sqrtf;
+ sqrtl;
+ copysignf;
+ nan;
+ __signbit;
+ __signbitf;
+ __signbitl;
+
local:
*;
};
While we're at it: There is one more symbol, namely __new_handler that
might have a similar problem. Should this be visible outside of
libstdc++.so?
regards Christian
--
THAT'S ALL FOLKS!
More information about the Gcc-bugs
mailing list