comp.lang.ada
 help / color / mirror / Atom feed
* Re: Help ADA and Assembly !!! :-(
       [not found] <68omkm$orf$1@news2.isdnet.net>
  1998-01-05  0:00 ` Help ADA and Assembly !!! :-( Dmitriy Anisimkov
@ 1998-01-05  0:00 ` Martin C. Carlisle
  1 sibling, 0 replies; 4+ messages in thread
From: Martin C. Carlisle @ 1998-01-05  0:00 UTC (permalink / raw)



In article <68omkm$orf$1@news2.isdnet.net>, jphe <jphe@hol.fr> wrote:
>Hi everybody i have a project that compare ada subprocedure and assembly
>subprocedure but i can't get in ADA the assembly .obj sub-procedure that i
>have made withe TASM could you help me about the use of Pragma import
>because i read the doc of Gnat and ADAGIDE but it doesn't recognize my .obj,
>i send my little source thanks..... JP  ( JPHE@HOL.fr )
>
>Exemple is a test of pragma import that must be works with calcul.obj but
>doesn't. It says udefinied reference to "calcul" ???

I believe you want something like the following:

procedure Test2;
pragma Import(Convention => Ada, Entity => Test2, Link_Name =>
  "calcul"); -- use whatever name is in .obj in place of "calcul"
             -- use Ada's name in place of Test2.
pragma Linker_Options("myobjfile.obj"); -- rename myobjfile to your name

--Martin
   
-- 
Martin C. Carlisle, Computer Science, US Air Force Academy
mcc@cs.usafa.af.mil, http://www.usafa.af.mil/dfcs/bios/carlisle.html
DISCLAIMER:  This content in no way reflects the opinions, standard or 
policy of the US Air Force Academy or the United States Government.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help ADA and Assembly !!! :-(
       [not found] <68omkm$orf$1@news2.isdnet.net>
@ 1998-01-05  0:00 ` Dmitriy Anisimkov
  1998-01-05  0:00   ` Samuel Tardieu
  1998-01-05  0:00 ` Martin C. Carlisle
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitriy Anisimkov @ 1998-01-05  0:00 UTC (permalink / raw)



Hello.

> Exemple is a test of pragma import that must be works with calcul.obj but
> doesn't. It says udefinied reference to "calcul" ???
 
Gnat don't understand the *.obj files, but you can write in GNU assembler.
GCC compile assembler files *.s and make *.o files. Also you can get
assembler source from ADA source by -S compiler option.

gcc -S -O2 essaicalc.adb

try
-O1 without optimization
-O2 optimization
-O3 strong optimization

from 
---------essaicalc.ads
package essaicalc is
Procedure essaicalcul (n1,n2:integer; r1,r2 : out integer);
end essaicalc;

---------essaicalc.adb
package body essaicalc is
Procedure essaicalcul (n1,n2:integer; r1,r2 : out integer) is
begin
r1 := n1+n2;
r2 := n1*n2;
end;
end essaicalc;

I have get assembler code, this is a main fragment :

_essaicalc__essaicalcul:
.stabn 68,0,2,LM1-_essaicalc__essaicalcul
LM1:
LBB2:
LBE2:
	pushl %ebp
	movl %esp,%ebp
	pushl %ebx
	movl 8(%ebp),%ebx
	movl 12(%ebp),%eax
	movl 16(%ebp),%edx
.stabn 68,0,5,LM2-_essaicalc__essaicalcul
LM2:
	movl %eax,%ecx
	addl %edx,%eax
	imull %edx,%ecx
	movl %eax,(%ebx)
	movl %ecx,4(%ebx)
	movl %ebx,%eax
	movl -4(%ebp),%ebx
	movl %ebp,%esp
	popl %ebp
	ret $4

I'm using Gnat 3.10 for Win32. I think you can get same results in GNAT for
MSDOS.
IMHO Gnat for MSDOS is 32bit compiler, not 16 :

>	MOV	AX,[BP+6]
>	ADD	AX,[BP+8]

Best regards,

Dimitri Anisimkov.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help ADA and Assembly !!! :-(
  1998-01-05  0:00 ` Help ADA and Assembly !!! :-( Dmitriy Anisimkov
@ 1998-01-05  0:00   ` Samuel Tardieu
  1998-01-05  0:00     ` Robert Dewar
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Tardieu @ 1998-01-05  0:00 UTC (permalink / raw)
  To: Dmitriy Anisimkov


>>>>> "Dmitriy" == Dmitriy Anisimkov <ts@quadrat.omsk.su> writes:

Dmitriy> try -O1 without optimization

You mean probably -O0. -O1 turns on some optimizations such as
putting variables into registers even when the "register" keyword is
not present (when compiling C code), it turns on -fthread-jumps and
-fdefer-pop, etc. See "man gcc" for details.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help ADA and Assembly !!! :-(
  1998-01-05  0:00   ` Samuel Tardieu
@ 1998-01-05  0:00     ` Robert Dewar
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1998-01-05  0:00 UTC (permalink / raw)



Samuel said

<<You mean probably -O0. -O1 turns on some optimizations such as
putting variables into registers even when the "register" keyword is
not present (when compiling C code), it turns on -fthread-jumps and
-fdefer-pop, etc. See "man gcc" for details.
>>

Indeed, -O1 does substantial optimization, a typical behavior for many
programs is that -O1 saves a lot over -O0, but -O2 does not save that
much more over -O1.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-01-05  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <68omkm$orf$1@news2.isdnet.net>
1998-01-05  0:00 ` Help ADA and Assembly !!! :-( Dmitriy Anisimkov
1998-01-05  0:00   ` Samuel Tardieu
1998-01-05  0:00     ` Robert Dewar
1998-01-05  0:00 ` Martin C. Carlisle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox