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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,770531b96951ef54 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!30g2000cwc.googlegroups.com!not-for-mail From: "Rolf" Newsgroups: comp.lang.ada Subject: Re: Linking Ada with large Assembler libs? Date: 8 Mar 2007 00:58:27 -0800 Organization: http://groups.google.com Message-ID: <1173344306.890836.307350@30g2000cwc.googlegroups.com> References: <1172093396.490201.203630@a75g2000cwd.googlegroups.com> NNTP-Posting-Host: 217.89.139.138 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1173344319 6014 127.0.0.1 (8 Mar 2007 08:58:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Mar 2007 08:58:39 +0000 (UTC) In-Reply-To: <1172093396.490201.203630@a75g2000cwd.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 www-proxy-mozilla.vi.vector.int:8080 (squid/2.5.STABLE5), 1.0 vistrem1.vector-informatik.com:8080 (squid/2.5.STABLE12) Complaints-To: groups-abuse@google.com Injection-Info: 30g2000cwc.googlegroups.com; posting-host=217.89.139.138; posting-account=X6JcNAwAAACCYFUClJvh1OjD0lgttvkm Xref: g2news1.google.com comp.lang.ada:14419 Date: 2007-03-08T00:58:27-08:00 List-Id: On Feb 21, 10:29 pm, "freejack" wrote: > The Machine Code Insertions sections of the relevant reference manuals > have been informative. > > However, I'm linking my Ada code with pre-existing libs written in > Assembler. The GNAT manuals are a little sketchy on how to do this > properly. I'm using NASM and FASM Assembler code. Most of the > Assembler code deals primarily with I/O. I'm using Pragma No_Run_Time > and writing my own Binder files, with a good bit of success. > It's not such a big problem, as I can do it by fiddling with the > linker and manipulating the object code. But the result is messy and > error prone. > > What are the best methods you guys have come up with for doing this > sort of manipulation? I either used inline assembly code in the body of an Ada procedure (preferred) or pragma Import (Convention => C, ...) when programming the AVR microprocessors. In the latter case you have to follow exactly gcc's parameter passing mechanism in the assembly code (e.g. for AVR the first arg is in r24/r25, the second arg in r26/r27, etc.). In the recent AVR-Ada releases we don't use assembly anymore; everything is Ada now with almost identical asm code. I'm considering to use Asm code for bin->ascii conversions, though. In the beginning I also used my own hand written binder file, now I have a patch to gcc in order to generate a binder file that fits my needs. Have a look at pragma Linker_Options. You can use it for simple things like including the object file for your assembler code, but also for using special linker scripts. HTH Rolf