Hello Gabriel On 09.03.09, you wrote:
> The above sqrt() function is distinct from the C version, because > it has a C++ linkage. Consequently, I would expect that if > __builtin_sqrtf() is not available, the compiler would emit a > library call to the out-of-line C version. But it dont work. I have define in math.h this func.see my below example source that show important parts.look a little ugly, but this is done to avoid in -o3 the remove of some function calls. real problem i see in libdirac inline float sqrtf(float x) { return sqrt(x); } ....... int main(int argc, char** argv) { ........ printf("%f\n",sqrtf((float)argc)); // work printf("%f\n",std::sqrt(static_cast<float>(argc))); // work not printf("%f\n",std::sqrt(static_cast<double>(argc))); // work ...... when i change c++/4.3.2/cmath to this code, then all work .... using ::sqrt; inline float sqrt(float __x) - { return __builtin_sqrtf(__x); } + { return sqrtf(__x); } ..... now you can come to the idea and add it as link func, maybe then it work. But then i get error at that line, but other lines work. printf("%f\n",sqrtf((float)argc)); undefined reference to `sqrtf(float)' You see there is the _ not in.normaly funcs that not find have a _ before To get all work, it seem i need add the same function add in math.h and in the linker lib or change cmath file and remove all __builtin_ commands the architecture not have. > On Mon, Mar 9, 2009 at 2:42 AM, Bernd Roesch <nospamn...@web.de> wrote: >> Hello Richard >> >> On 06.03.09, you wrote: >> >> ah thanks for info, i understand now too wy sqrtf, fmod (work in C >> programs) >> get linker error on C++ programs but sqrt and some other work on >> platform >> 68k. >> in c++/4.3.2/cmath include >> >> is this code. >> >> using ::sqrt; >> >> inline float >> sqrt(float __x) >> { return __builtin_sqrtf(__x); } >> >> But .md file of many architetures contain no entry for this.I see only >> i386, >> rs6000, ia64, sh contain code for this.(I search for sqrtf and list >> files >> that contain this) >> the header files are build during GCC build, i change nothing. >> >> Is there something wrong during compiler Build process ? > > The above sqrt() function is distinct from the C version, because > it has a C++ linkage. Consequently, I would expect that if > __builtin_sqrtf() is not available, the compiler would emit a > library call to the out-of-line C version. > > -- Gaby Regards