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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9fdb4e673a488b12 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-08 06:59:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!jussieu.fr!enst.fr!not-for-mail From: Michal Nowak Newsgroups: comp.lang.ada Subject: Re: Placement of pragma Import Date: Sun, 08 Dec 2002 16:08:16 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: avanie.enst.fr 1039359543 29991 137.194.161.2 (8 Dec 2002 14:59:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 8 Dec 2002 14:59:03 +0000 (UTC) Return-Path: In-reply-to: X-Mailer: Calypso Version 3.30.00.00 (3) Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: vinnie@inetia.pl List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:31552 Date: 2002-12-08T16:08:16+01:00 On 2002-12-08 at 12:26 Simon Wright wrote: >Michal Nowak writes: > >> -- Possibility 1: >> >> package Import_Test is >> >> procedure Asm_Coded; >> >> pragma Import (Assembler, Asm_Coded, "donothing"); >> pragma Linker_Options ("nothing_asm.s"); >> >> end Import_Test; >> >> -- Possibility 2: >> package Import_Test is >> >> procedure Asm_Coded; >> >> private -- Imported in private section >> >> pragma Import (Assembler, Asm_Coded, "donothing"); >> pragma Linker_Options ("nothing_asm.s"); >> >> end Import_Test; > >I would certainly use the second choice; it probably makes no >difference to the generated code, but it removes complication from the >public part of the spec. Yes, I agree, that it looks better to put it in private section. However I want to be aware what I'm doing and what consequences it may have. The disassembled main executable differs a bit in these two cases. I'll try to analyze it a more deeper, although I'm not an assembly guru, so I'm not sure if I understand it properly. >By the way, I think you meant nothing_asm.o, not nothing_asm.s? Well, yes and...no. When you pointed me this I recalled, that in my work some time ago I did it by passing the ".o" file as an argument (under ObjectAda). But the posted code I compiled under GNAT and it worked. Now I read RM and it says B.1 (37): 37 Pragma Linker_Options has the effect of passing its string argument as a parameter to the system linker (if one exists), if the immediately enclosing compilation unit is included in the partition being linked. The interpretation of the string argument, and the way in which the string arguments from multiple Linker_Options pragmas are combined, is implementation defined. So if I understood it correctly, it depends from implementation how it is processed. Seems GNAT compilation system is intelligent enough to compile the assembly source first and then link it. - Michal "<> Whoever said that, he's right."