From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ecc38b3271b36b88 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!192.87.166.28.MISMATCH!tudelft.nl!txtfeed1.tudelft.nl!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!gegeweb.org!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ? Date: Sun, 27 Mar 2011 23:35:52 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: <0ea88302-a755-4a61-bf5b-728469c9d5d2@34g2000pru.googlegroups.com> Reply-To: anon@anon.org NNTP-Posting-Host: 1xMhT4XYP7cAn1O894vdAQ.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: IBM NewsReader/2 2.0 Xref: g2news2.google.com comp.lang.ada:19496 Date: 2011-03-27T23:35:52+00:00 List-Id: In <0ea88302-a755-4a61-bf5b-728469c9d5d2@34g2000pru.googlegroups.com>, ytomino writes: >On Mar 27, 9:00=A0pm, a...@att.net wrote: >> Using C you may need to also change the first underscore or remove both >> such as >> >> =A0 pragma Import (C, isfinite, "_builtin_isfinite"); > >$ /usr/local/bin/gcc-4.6.0/gnatmake test1 >gcc -c test1.adb >gnatbind -x test1.ali >gnatlink test1.ali >Undefined symbols: > "__builtin_isfinite", referenced from: > __ada_test1 in test1.o > __ada_test1 in test1.o >ld: symbol(s) not found >collect2: ld returned 1 exit status >gnatlink: error when calling /usr/local/bin/gcc-4.6.0/gcc >gnatmake: *** link failed. > >> or >> =A0 pragma Import (C, isfinite, "builtin_isfinite"); > >$ /usr/local/bin/gcc-4.6.0/gnatmake test1 >gcc -c test1.adb >gnatbind -x test1.ali >gnatlink test1.ali >Undefined symbols: > "_builtin_isfinite", referenced from: > __ada_test1 in test1.o > __ada_test1 in test1.o >ld: symbol(s) not found >collect2: ld returned 1 exit status >gnatlink: error when calling /usr/local/bin/gcc-4.6.0/gcc >gnatmake: *** link failed. > >In the first, libc.a (or libm.a) does not have the body of "isfinite" >function. >gcc expands builtin-functions to inline-assembly code. >To tell the truth, libm.a has "_isfinite", but that is unused to call >"__builtin_isfinite". >Please make sure with nm. The problem with builtin routines is that you need to write a C interface routine that is called by Ada and then that routine calls the "__builtin_isfinite" macro. Such as: function isfinite ( X : Long_Float ) return Integer; pragma Import ( C, isfinite, "_gnat_builtin_isfinite" ) ; /* * File: builtin.c * the C code */ void _gnat_builtin_isfinite ( x ) long x ; { __builtin_isfinite ( x ) ; } to compile gcc -c builtin.c gnat make .adb -largs builtin.o or gnat link .ali builtin.o But the easiest way is just use Ada: function isfinite ( S : Long_Float ) return Boolean ; function isfinite ( S : Long_Float ) return Boolean ; begin -- IEEE 754 standards If S'Exponent = -1 and S'Fraction = 0 Then return True ; end if ; return False ; end isfinite ;