gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: gcl-2.6.8pre on MAC OSX 10.2


From: Camm Maguire
Subject: [Gcl-devel] Re: gcl-2.6.8pre on MAC OSX 10.2
Date: 23 Oct 2006 15:53:01 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

"Bill Page" <address@hidden> writes:

> Camm,
> 
> On October 23, 2006 10:23 AM you wrote:
> > ...
> > Bill Page wrote:
> > > 
> > > I tried to track this down. LEADING_UNDERSCORE is set to 1, which
> > > seems to be correct when I use nm to look at the symbols in the
> > > test file compiled by the gcl configure script. The raw symbol
> > > "___srget" does have 3 underscores (two in the original name), and
> > > cos appears as "_cos" etc. Everything works fine during the Axiom
> > > build for quite a while (up to the start of the building interpsys)
> > > until the 
> > > 
> > >   Error: Undefined symbol "___srget"
> > > 
> > > message appears. I would have presumed that this symbol would have
> > > been needed long before this failure occured. I rather suspsect that
> > > this error is a consequence of some deeper but silent problem, e.g.
> > > failed compiler::link?
> > > 
> > 
> > OK here is a simple test (asusming this symbol comes from getc()
> > on the mac:
> > 
> > foo.l:
> > (defun foo nil (with-open-file (s "/tmp/foo") (read-byte s)))
> > 
> > gcl
> > >(compile-file "foo.l")
> > >(load "foo.o")
> > >(bye)
> > nm foo.o |grep srget
> > 
> 
> Here's the result:
> 
> --------
> 
> ppc-osx3:~/osx/new/gcl-2.6.8pre $ vi foo.l
> ppc-osx3:~/osx/new/gcl-2.6.8pre $ gcl
> GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> Modifications of this banner must retain notice of a compatible license
> Dedicated to the memory of W. Schelter
> 
> Use (help) to get some basic information on how to use GCL.
> Temporary directory for compiler files set to /tmp/
> 
> >(compile-file "foo.l")
> 
> Compiling foo.l.
> End of Pass 1.
> End of Pass 2.
> OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
> Finished compiling foo.lisp.
> #p"foo.o"
> 
> >(load "foo.o")
> 
> Loading foo.o
> 
> Error: Undefined symbol "___srget"
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by EVAL.
> Broken at LOAD.  Type :H for Help.
> >>(quit)
> ppc-osx3:~/osx/new/gcl-2.6.8pre $ nm foo.o
>          U _Cnil_body
>          U _Dotnil_body
>          U _FEwrong_type_argument
>          U _FIXtemp
> 00000000 t _L1
>          U _Lclose
> 000004fc d _Lnk1
> 000004c8 t _LnkT1
> 000004f0 d _VVi
>          U ___srget
>          U _bds_top
>          U _call_or_link
>          U _do_init
>          U _frs_limit
>          U _frs_overflow
>          U _frs_top
>          U _ihs_top
>          U _in_signal_handler
> 000004ac T _init_code
>          U _lex_env
>          U _make_cons
>          U _make_fixnum1
>          U _nlj_active
>          U _nlj_fr
>          U _nlj_tag
>          U _read_byte1
>          U _sLlist
> 00000500 d _s_my_dot.0
>          U _setjmp
>          U _small_fixnum_table
>          U _unwind
>          U _vs_base
>          U _vs_limit
>          U _vs_overflow
>          U _vs_top
>          U dyld_stub_binding_helper
>          U restFP
>          U saveFP
> 
> -------
> 
> But I see the this symbol *is* known to the gcl image.
> 
> ppc-osx3:~/osx/new/gcl-2.6.8pre $ nm unixport/saved_gcl | grep srget
>          U ___srget
> 
> What is wrong?
> 

Here is says that saved_gcl *uses* the symbol, but does not provide
it.  We need T ___srget.

Was our patch to o/makefile designed to remove ___srget from plt.h?
If so, this is the culprit.  What was the reason if this is the case?
If not, we need to add code to plttest.c to get these symbols into
plt.h.  If this makes any sense to you and you can tell me which is
the case, we can proceed from here.

The idea is that raw_gcl needs its own symbol for every symol that can
be written by the compiler/gcc into an object file to be loaded.  If
symbols are in external libraries, e.g. cos() in libm, GCL compiles in
its own reference by taking the address in C

void *ref=cos;

This forces ldd to make a plt table, en effective trampoline, which
will be properly relocated at runtime by ld.so.  Jumping to this
trampoline is sufficient to get us to where we need to go.  

We also have an additional mechanism to parse the raw_map file to look
at the plt table explicitly if present.  This is not very portable,
but the results are in si::*plt-table*.


> > ...
> > > 
> > >             | /home/users/b/bi/billpage/osx/bin/gcl
> > > GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> > > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> > > Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> > > Modifications of this banner must retain notice of a 
> > compatible license
> > > Dedicated to the memory of W. Schelter
> > > 
> > > Use (help) to get some basic information on how to use GCL.
> > > Temporary directory for compiler files set to /tmp/
> > > 
> > > >DBEGIN:          0x1c9000
> > > mach_mapstart:   0x5f9000
> > > heap_end:        0x5f9000
> > > core_end:        0x5f9000
> > > mach_brkpt:      0x5f9000
> > > mach_maplimit: 0x201c9000
> > > --- List of All Regions ---
> > >    address       size prot maxp zone_name
> > >          0     0x1000 none none (no zone)
> > >     0x1000   0x1c8000 r x  rwx  (no zone)
> > >   0x1c9000     0xf000 rw   rwx  (no zone)
> > >   0x1d8000   0x421000 rw   rwx  (no zone)
> > >   0x5f9000   0x165000 r    rwx  (no zone)
> > >   0x75e000    0x40000 rw   rwx  DefaultMallocZone
> > > --- List of Regions to be Dumped ---
> > >    address       size prot maxp zone_name
> > >          0     0x1000 none none (no zone)
> > >     0x1000   0x1c8000 r x  rwx  (no zone)
> > >   0x1c9000   0x430000 rw   rwx  (no zone)
> > >   0x5f9000   0x165000 r    rwx  (no zone)
> > >   0x75e000    0x40000 rw   rwx  DefaultMallocZone
> > > --- Header Information ---
> > > Magic      = 0xfeedface
> > > CPUType    = 18
> > > CPUSubType = 0
> > > FileType   = 0x2
> > > NCmds      = 10
> > > SizeOfCmds = 1620
> > > Flags      = 0x00000085
> > > Highest address of load commands in input file:     0x75e000
> > > Lowest offset of all sections in __TEXT segment:      0xc30
> > > --- List of Load Commands in Input File ---
> > > no cmd                 cmdsize name                address  
> >      size
> > >  0 LC_SEGMENT             0x38 __PAGEZERO                0  
> >    0x1000
> > >  1 LC_SEGMENT            0x258 __TEXT               0x1000  
> >  0x1c8000
> > >                                __text               0x1c30  
> >  0x1ad804
> > >                                __picsymbol_stub   0x1af434  
> >    0x1998
> > >                                __symbol_stub      0x1b0dcc  
> >         0
> > >                                __cstring          0x1b0dcc  
> >   0x16110
> > >                                __literal4         0x1c6edc  
> >      0x18
> > >                                __literal8         0x1c6ef8  
> >     0x108
> > >                                __const            0x1c7000  
> >    0x1f9c
> > >                                __eh_frame         0x1c8f9c  
> >      0x60
> > >  2 LC_SEGMENT            0x214 __DATA             0x1c9000  
> >  0x430000
> > >                                __data             0x1c9000  
> >    0xaee4
> > >                                __la_symbol_ptr    0x1d3ee4  
> >     0x2d8
> > >                                __nl_symbol_ptr    0x1d41bc  
> >     0x9e0
> > >                                __dyld             0x1d4b9c  
> >      0x1c
> > >                                __const            0x1d4bb8  
> >    0x2748
> > >                                __bss              0x1d7300  
> >    0x9340
> > >                                __common           0x1e0640  
> >  0x418970
> > >  3 LC_SEGMENT             0x38 __LINKEDIT         0x5f9000  
> >  0x165000
> > >  4 LC_LOAD_DYLINKER       0x1c
> > >  5 LC_LOAD_DYLIB          0x34
> > >  6 LC_SYMTAB              0x18
> > >  7 LC_DYSYMTAB            0x50
> > >  8 LC_TWOLEVEL_HINTS      0x10
> > >  9 LC_UNIXTHREAD          0xb0
> > > --- Load Commands written to Output File ---
> > > Writing segment __PAGEZERO       at          0 -          0 
> > (sz:          0)
> > > Writing segment __TEXT           at          0 -   0x1c8000 
> > (sz:   0x1c8000)
> > > Writing segment __DATA           at   0x1c8000 -   0x1d7000 
> > (sz:     0xf000)
> > >         section __data           at   0x1c8000 -   0x1d2ee4 
> > (sz:     0xaee4)
> > >         section __la_symbol_ptr  at   0x1d2ee4 -   0x1d31bc 
> > (sz:      0x2d8)
> > >         section __nl_symbol_ptr  at   0x1d31bc -   0x1d3b9c 
> > (sz:      0x9e0)
> > >         section __dyld           at   0x1d3b9c -   0x1d3bb8 
> > (sz:       0x1c)
> > >         section __const          at   0x1d3bb8 -   0x1d6300 
> > (sz:     0x2748)
> > >         section __bss            at   0x1d6300 -   0x1df640 
> > (sz:     0x9340)
> > >         section __common         at   0x1df640 -   0x5f7fb0 
> > (sz:   0x418970)
> > > Writing segment __DATA           at   0x5f8000 -   0x5f8000 
> > (sz:          0)
> > > WGCL (GNU Common Lisp)  April 1994  131072 pages
> > > 
> >
> > Does this stop here?  Or do you see "Initializing ...." as in your
> > compiler::link output below?
> >
> 
> It stops there.

OK, this is definitely strange.  Could you please 

(trace system open delete-file)

before the compiler::link and send me the output.


>  
> > > > > 
> > > > > If I intervene and make Axiom use the original 
> > 'saved_gcl' to build
> > > > > 'bootsys' instead of using 'lisp', then the 'postpar.8' 
> > problem does
> > > > > not occur and gcl finds the .o files anyway, as expected.
> > > > > 
> > > > > This makes me suspicious that something subtle may be wrong with
> > > > > the output of 'compiler:link'. The size of the result 
> > images also
> > > > > seem curious:
> > > > > 
> > > > > -rwxr-xr-x  1 billpage  100  18362444 Oct 17 19:08 saved_gcl
> > > > > ...
> > > > > -rwxr-xr-x  1 billpage  100  13072984 Oct 18 04:01 lisp
> > > > > -rwxr-xr-x  1 billpage  100  19159640 Oct 18 04:01 bootsys
> > > > > -rwxr-xr-x  1 billpage  100   7719512 Oct 18 04:01 raw_lisp.tmp
> > > > > -rw-r--r--  1 billpage  100         0 Oct 18 04:01 raw_lisp_map
> > > > > -rwxr-xr-x  1 billpage  100  49588824 Oct 18 03:10 depsys
> > > > > 
> > > > > Remember that 'lisp' is create by 'compiler::link' from
> > > > > saved_gcl plus some externals. Why is it smaller? Also the
> > > > > "raw" files were left here don't look "normal" to me.
> > > > > 
> > > > > A test image of gcl created by
> > > > > 
> > > > >   $ gcl
> > > > >   (si:save-system "test-image")
> > > > >   (quit)
> > > > > 
> > > > > is actually *larger* than the original saved_gcl.
> > > > > 
> > > > > -rwxr-xr-x  1 billpage  100  23699532 Oct 18 11:07 test-image
> > > > > 
> > > > > Are all these problems related?
> > > > > 
> > > > > Any thing you can suggest would be greatly appreciated.
> > > > > 
> > > > 
> > > > I also suspect compiler::link failure.  It is also odd that
> > > > save-system images are so much bigger.  Here is the tiny 
> > difference on
> > > > Linux:
> > > > 
> > > > ls -l /usr/lib/gcl-2.6.7/unixport/saved_gcl
> > > > -rwxr-xr-x 1 root root 9329131 Oct 18 13:43 
> > > > /usr/lib/gcl-2.6.7/unixport/saved_gcl
> > > > /usr/lib/gcl-2.6.7/unixport/saved_gcl
> > > > GCL (GNU Common Lisp)  2.6.7 CLtL1    Oct 18 2006 13:40:07
> > > > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> > > > Binary License:  GPL due to GPL'ed components: (XGCL READLINE 
> > > > BFD UNEXEC)
> > > > Modifications of this banner must retain notice of a 
> > > > compatible license
> > > > Dedicated to the memory of W. Schelter
> > > > 
> > > > Use (help) to get some basic information on how to use GCL.
> > > > Temporary directory for compiler files set to /tmp/
> > > > 
> > > > >(si::save-system "/tmp/ff")
> > > > ls -l /tmp/ff
> > > > -rwxr-x--- 1 camm camm 9333267 Oct 18 16:25 /tmp/ff
> > > > 
> > > > compiler::link should be no smaller than saved_gcl.  The 
> > raw files are
> > > > explicitly deleted as named and output by gcc -- the .tmp 
> > extension
> > > > appears non-std and might be expected to persist.
> > > > 
> > > > I'd make two images, one with
> > > > 
> > > > (si::save-system "foo")
> > > > 
> > > > and the other with
> > > > 
> > > > (compiler::link nil "bar")
> > > > 
> > > > And then in each, do a few tests, including looking at
> > > > si::*load-types*.
> > > >
> > > 
> > > Ok, here are the result of your suggested tests below:
> > > 
> > > --------------
> > > 
> > > ppc-osx3:~/osx/axiom.build-improvements $ echo 
> > '(si::save-system "foo")' |
> > > gcl > foo.log
> > > ppc-osx3:~/osx/axiom.build-improvements $ echo 
> > '(compiler::link nil "bar")'
> > > | gcl > bar.log
> > > ppc-osx3:~/osx/axiom.build-improvements $ ls -l foo bar
> > > -rwxr-xr-x  1 billpage  100  13029844 Oct 21 15:06 bar
> > > -rwxr-xr-x  1 billpage  100  23708096 Oct 21 15:05 foo
> > > 
> > > ppc-osx3:~/osx/axiom.build-improvements $ cat foo.log
> > > 
> > > GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> > > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> > > Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> > > Modifications of this banner must retain notice of a 
> > compatible license
> > > Dedicated to the memory of W. Schelter
> > > 
> > > Use (help) to get some basic information on how to use GCL.
> > > Temporary directory for compiler files set to /tmp/
> > > 
> > > >DBEGIN:          0x1c7000
> > > mach_mapstart:   0x5f5000
> > > heap_end:        0xb0c000
> > > core_end:        0xb0d000
> > > mach_brkpt:     0xe737000
> > > mach_maplimit: 0x201c7000
> > > --- List of All Regions ---
> > >    address       size prot maxp zone_name
> > >          0     0x1000 none none (no zone)
> > >     0x1000   0x1c6000 r x  rwx  (no zone)
> > >   0x1c7000   0x42e000 rw   rwx  (no zone)
> > >   0x5f5000   0x517000 rwx  rwx  (no zone)
> > >   0xb0c000 0x1f6bb000 rwx  rwx  (no zone)
> > > --- List of Regions to be Dumped ---
> > >    address       size prot maxp zone_name
> > >          0     0x1000 none none (no zone)
> > >     0x1000   0x1c6000 r x  rwx  (no zone)
> > >   0x1c7000   0x42e000 rw   rwx  (no zone)
> > >   0x5f5000 0x1fbd2000 rwx  rwx  (no zone)
> > > --- Header Information ---
> > > Magic      = 0xfeedface
> > > CPUType    = 18
> > > CPUSubType = 0
> > > FileType   = 0x2
> > > NCmds      = 11
> > > SizeOfCmds = 1744
> > > Flags      = 0x00000085
> > > Highest address of load commands in input file:   0x5fad0000
> > > Lowest offset of all sections in __TEXT segment:      0x6f8
> > > --- List of Load Commands in Input File ---
> > > no cmd                 cmdsize name                address  
> >      size
> > >  0 LC_SEGMENT             0x38 __PAGEZERO                0  
> >    0x1000
> > >  1 LC_SEGMENT            0x258 __TEXT               0x1000  
> >  0x1c6000
> > >                                __text               0x16f8  
> >  0x1aafc8
> > >                                __picsymbol_stub   0x1ac6c0  
> >    0x18e4
> > >                                __symbol_stub      0x1adfa4  
> >         0
> > >                                __cstring          0x1adfa4  
> >   0x15f5c
> > >                                __literal4         0x1c3f00  
> >      0x18
> > >                                __literal8         0x1c3f18  
> >     0x108
> > >                                __const            0x1c4020  
> >    0x1f9c
> > >                                __eh_frame         0x1c5fbc  
> >      0x60
> > >  2 LC_SEGMENT            0x214 __DATA             0x1c7000  
> >  0x42e000
> > >                                __data             0x1c7000  
> >    0xaec4
> > >                                __la_symbol_ptr    0x1d1ec4  
> >     0x2c4
> > >                                __nl_symbol_ptr    0x1d2188  
> >     0x9c8
> > >                                __dyld             0x1d2b50  
> >      0x1c
> > >                                __const            0x1d2b6c  
> >    0x2748
> > >                                __bss              0x1d52b8  
> >    0x8f28
> > >                                __common           0x1de1e0  
> >  0x416d68
> > >  3 LC_SEGMENT             0x7c __DATA             0x5f5000 
> > 0x1fbd2000
> > >                                __data             0x5f5000  
> >  0x517000
> > >  4 LC_SEGMENT             0x38 __LINKEDIT       0x5f96b000  
> >  0x165000
> > >  5 LC_LOAD_DYLINKER       0x1c
> > >  6 LC_LOAD_DYLIB          0x34
> > >  7 LC_SYMTAB              0x18
> > >  8 LC_DYSYMTAB            0x50
> > >  9 LC_TWOLEVEL_HINTS      0x10
> > > 10 LC_UNIXTHREAD          0xb0
> > > --- Load Commands written to Output File ---
> > > Writing segment __PAGEZERO       at          0 -          0 
> > (sz:          0)
> > > Writing segment __TEXT           at          0 -   0x1c6000 
> > (sz:   0x1c6000)
> > > Writing segment __DATA           at   0x1c6000 -   0x5f4000 
> > (sz:   0x42e000)
> > >         section __data           at   0x1c6000 -   0x1d0ec4 
> > (sz:     0xaec4)
> > >         section __la_symbol_ptr  at   0x1d0ec4 -   0x1d1188 
> > (sz:      0x2c4)
> > >         section __nl_symbol_ptr  at   0x1d1188 -   0x1d1b50 
> > (sz:      0x9c8)
> > >         section __dyld           at   0x1d1b50 -   0x1d1b6c 
> > (sz:       0x1c)
> > >         section __const          at   0x1d1b6c -   0x1d42b4 
> > (sz:     0x2748)
> > >         section __bss            at   0x1d42b8 -   0x1dd1e0 
> > (sz:     0x8f28)
> > >         section __common         at   0x1dd1e0 -   0x5f3f48 
> > (sz:   0x416d68)
> > > Writing segment __DATA           at   0x5f4000 -   0xb0c000 
> > (sz:   0x518000)
> > > Writing segment __LINKEDIT       at  0x1538000 -  0x169c1c0 
> > (sz:   0x1641c0)
> > > Writing LC_LOAD_DYLINKER  command
> > > Writing LC_LOAD_DYLIB     command
> > > Writing LC_SYMTAB         command
> > > Fixed up 0/17 external relocation entries in data segment.
> > > Writing LC_DYSYMTAB       command
> > > Writing LC_TWOLEVEL_HINTS command
> > > Writing LC_UNIXTHREAD     command
> > > 12 unused bytes follow Mach-O header
> > > 
> > > 
> > > ppc-osx3:~/osx/axiom.build-improvements $ cat bar.log
> > > 
> > > GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> > > Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> > > Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> > > Modifications of this banner must retain notice of a 
> > compatible license
> > > Dedicated to the memory of W. Schelter
> > > 
> > > Use (help) to get some basic information on how to use GCL.
> > > Temporary directory for compiler files set to /tmp/
> > > 
> > > >DBEGIN:          0x1c7000
> > 
> > What I don't understand is this output appearing twice.  This is the
> > place it appears not to belong.  Is this not output only from unexec?
> >
> 
> I don't know. How can I tell?
>  
> > ... 
> > Might be of use seeing if both images can compile and load files,
> > especially the test file foo.l above.
> >
> 
> Same result as above:
> 
> --------- 
> 
> ppc-osx3:~/osx/axiom.build-improvements $ ./foo
> GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> Modifications of this banner must retain notice of a compatible license
> Dedicated to the memory of W. Schelter
> 
> Use (help) to get some basic information on how to use GCL.
> Temporary directory for compiler files set to /tmp/
> 
> >(compile-file "foo.l")
> 
> Compiling foo.l.
> End of Pass 1.
> End of Pass 2.
> OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
> Finished compiling foo.l.
> #p"foo.o"
> 
> >(load "foo.o")
> 
> Loading foo.o
> 
> Error: Undefined symbol "___srget"
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by EVAL.
> Broken at LOAD.  Type :H for Help.
> >>(quit)
> ppc-osx3:~/osx/axiom.build-improvements $ ./bar
> GCL (GNU Common Lisp)  2.6.8 CLtL1    Oct 18 2006 15:24:28
> Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
> Binary License:  GPL due to GPL'ed components: (BFD UNEXEC)
> Modifications of this banner must retain notice of a compatible license
> Dedicated to the memory of W. Schelter
> 
> Use (help) to get some basic information on how to use GCL.
> Temporary directory for compiler files set to /tmp/
> 
> >(compile-file "foo.l")
> 
> Compiling foo.l.
> End of Pass 1.
> End of Pass 2.
> OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
> Finished compiling foo.l.
> #p"foo.o"
> 
> >(load "foo.o")
> 
> Loading foo.o
> 
> Error: Undefined symbol "___srget"
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by EVAL.
> Broken at LOAD.  Type :H for Help.
> >>(quit)
> ppc-osx3:~/osx/axiom.build-improvements $
> 
> Regards,
> Bill Page.
> 
> 
> 
> 
> 

Take care,

-- 
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]