gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] gcl compiler problem


From: Camm Maguire
Subject: Re: [Gcl-devel] gcl compiler problem
Date: 10 Feb 2003 14:34:21 -0500

Greetings!  I believe you cat dump a running image which redirects the
toplevel to your program, thus creating a 'standalone' executable.
maxima and acl2 do this for example.  Others on the list a better
equipped to supply the details.  This only makes sense for large
programs, as the image with the lisp core included is already quite
big.

Take care,

Jean-baptiste Couturier <address@hidden> writes:

> Hello,
> 
> Thanks for your help. I was believe we can compile 'standalone' executabl=
> es.
> 
> Cheers.
> 
> Peter Wood wrote:
> 
> >On Tue, Feb 04, 2003 at 11:52:39PM +0100, Jean-baptiste Couturier wrote:
> > =20
> >
> >>Hello,
> >>
> >>Firtly, you must know that i'm newbie with gcl. (& I wish it's the good=
> =20
> >>place to ask my question)
> >>
> >>I try to make a platform dependant executable file using my lisp progra=
> m=20
> >>but i've compilation error. Using "gcl -compile myprog" i obtain=20
> >>myprog.o (an elf32-i386 according to objdump) but i can't run it (bash:=
> =20
> >>./myprog.o: cannot execute binary file).
> >>
> >>example:
> >>test.lsp:
> >>----------
> >>(print 'hello)
> >>
> >>(jb)prog >gcl -compile test  =20
> >>Compiling test.lsp.
> >>End of Pass 1.=20
> >>End of Pass 2.=20
> >>OPTIMIZE levels: Safety=3D0 (No runtime error checking), Space=3D0, Spe=
> ed=3D3
> >>Finished compiling test.
> >>
> >>(jb)prog >chmod u+x test.o && ./test.o
> >>bash: ./test.o: cannot execute binary file
> >>
> >>(jb)prog >objdump -d test.o
> >>
> >>test.o:     format de fichier elf32-i386
> >>
> >>D=E9assemblage de la section .text:
> >>
> >>00000000 <init_code>:
> >>  0:   55                      push   %ebp
> >>  1:   89 e5                   mov    %esp,%ebp
> >>  3:   83 ec 08                sub    $0x8,%esp
> >>  6:   83 c4 f4                add    $0xfffffff4,%esp
> >>  9:   68 00 00 00 00          push   $0x0
> >>  e:   e8 fc ff ff ff          call   f <init_code+0xf>
> >> 13:   c9                      leave=20
> >> 14:   c3                      ret  =20
> >> 15:   8d 76 00                lea    0x0(%esi),%esi
> >>
> >>
> >>Any help appreciated.
> >>Cheers!
> >>   =20
> >>
> >
> >Hi
> >
> >GCL does not compile 'standalone' executables.  Your program will need
> >the lisp environment to work.  This means you could do the following:
> >
> >;test.lsp
> >(progn 'compile (print 'hello) (si::quit))
> >;      ^^^^^^^^
> >
> >compile it:
> >
> >gcl -compile test.lsp
> >
> >and run it:
> >
> >gcl -batch -load test.o
> >
> >This works! :-)
> >
> >In the form above, the symbol 'compile (marked) causes the compiler to
> >compile everything to machine code (otherwise normally GCL only
> >compiles defuns and defmacros to machine code to save space -- in the
> >disassembly output from your program, only the initialization code is
> >appearing.  I guess the rest is in the 'data' section -- compare it to
> >mine which I attach).  The '-batch ' argument on the command line
> >causes GCL to not print any startup message.
> >
> >In the html/info documentation which is supplied with GCL, there is a
> >section entitled 'Operating system' which explains other ways to run
> >your program (eg as a shell-style script) and provides info on other
> >useful stuff like accessing command line args etc.
> >
> >Hope this helps.
> >
> >Regards,
> >Peter
> >
> >
> > =20
> >
> >------------------------------------------------------------------------
> >
> >
> >test.o:     file format elf32-i386
> >
> >Disassembly of section .text:
> >
> >00000000 <init_code>:
> >   0:        55                      push   %ebp
> >   1:        89 e5                   mov    %esp,%ebp
> >   3:        83 ec 08                sub    $0x8,%esp
> >   6:        83 c4 f4                add    $0xfffffff4,%esp
> >   9:        68 00 00 00 00          push   $0x0
> >   e:        e8 fc ff ff ff          call   f <init_code+0xf>
> >  13:        83 c4 10                add    $0x10,%esp
> >  16:        89 ec                   mov    %ebp,%esp
> >  18:        5d                      pop    %ebp
> >  19:        c3                      ret   =20
> >  1a:        89 f6                   mov    %esi,%esi
> >
> >0000001c <LI1>:
> >  1c:        55                      push   %ebp
> >  1d:        89 e5                   mov    %esp,%ebp
> >  1f:        83 ec 18                sub    $0x18,%esp
> >  22:        eb 00                   jmp    24 <LI1+0x8>
> >  24:        83 c4 f8                add    $0xfffffff8,%esp
> >  27:        68 00 00 00 00          push   $0x0
> >  2c:        a1 00 00 00 00          mov    0x0,%eax
> >  31:        50                      push   %eax
> >  32:        e8 fc ff ff ff          call   33 <LI1+0x17>
> >  37:        83 c4 10                add    $0x10,%esp
> >  3a:        c7 45 fc 00 00 00 00    movl   $0x0,0xfffffffc(%ebp)
> >  41:        8b 55 fc                mov    0xfffffffc(%ebp),%edx
> >  44:        89 d0                   mov    %edx,%eax
> >  46:        eb 08                   jmp    50 <LI1+0x34>
> >  48:        b8 00 00 00 00          mov    $0x0,%eax
> >  4d:        eb 01                   jmp    50 <LI1+0x34>
> >  4f:        90                      nop   =20
> >  50:        89 ec                   mov    %ebp,%esp
> >  52:        5d                      pop    %ebp
> >  53:        c3                      ret   =20
> >
> >00000054 <LI2>:
> >  54:        55                      push   %ebp
> >  55:        89 e5                   mov    %esp,%ebp
> >  57:        83 ec 0c                sub    $0xc,%esp
> >  5a:        57                      push   %edi
> >  5b:        56                      push   %esi
> >  5c:        53                      push   %ebx
> >  5d:        8b 1d 00 00 00 00       mov    0x0,%ebx
> >  63:        8b 35 00 00 00 00       mov    0x0,%esi
> >  69:        89 35 00 00 00 00       mov    %esi,0x0
> >  6f:        eb 00                   jmp    71 <LI2+0x1d>
> >  71:        a1 00 00 00 00          mov    0x0,%eax
> >  76:        a3 00 00 00 00          mov    %eax,0x0
> >  7b:        8b 3d 0c 00 00 00       mov    0xc,%edi
> >  81:        ff d7                   call   *%edi
> >  83:        89 35 00 00 00 00       mov    %esi,0x0
> >  89:        c7 45 fc 00 00 00 00    movl   $0x0,0xfffffffc(%ebp)
> >  90:        8b 55 fc                mov    0xfffffffc(%ebp),%edx
> >  93:        89 d0                   mov    %edx,%eax
> >  95:        eb 07                   jmp    9e <LI2+0x4a>
> >  97:        b8 00 00 00 00          mov    $0x0,%eax
> >  9c:        eb 00                   jmp    9e <LI2+0x4a>
> >  9e:        8d 65 e8                lea    0xffffffe8(%ebp),%esp
> >  a1:        5b                      pop    %ebx
> >  a2:        5e                      pop    %esi
> >  a3:        5f                      pop    %edi
> >  a4:        89 ec                   mov    %ebp,%esp
> >  a6:        5d                      pop    %ebp
> >  a7:        c3                      ret   =20
> >
> >000000a8 <LnkT1>:
> >  a8:        55                      push   %ebp
> >  a9:        89 e5                   mov    %esp,%ebp
> >  ab:        83 ec 08                sub    $0x8,%esp
> >  ae:        83 c4 f8                add    $0xfffffff8,%esp
> >  b1:        68 0c 00 00 00          push   $0xc
> >  b6:        a1 04 00 00 00          mov    0x4,%eax
> >  bb:        50                      push   %eax
> >  bc:        e8 fc ff ff ff          call   bd <LnkT1+0x15>
> >  c1:        83 c4 10                add    $0x10,%esp
> >  c4:        89 ec                   mov    %ebp,%esp
> >  c6:        5d                      pop    %ebp
> >  c7:        c3                      ret   =20
> > =20
> >
> 
> 
> 
> 
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]