On October 23, 2006 3:53 PM Camm Maguire wrote: > > ... > > 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. >
Aha. No "__srget" symbol defined in the gcl image? Isn't it strange? > 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? No, only saveFP and restFP are removed because the linker complains that the symbols are not used in the context of a function. It is not clear to me why this is not also a problem on other platforms nor exactly what these symbols are for. Although this helps: http://www.astro.gla.ac.uk/users/norman/note/2004/restFP "In particular, the Apple GCC produces object code which includes references to the restFP and saveFP symbols, which refer to assembler routines which manipulate the floating-point state of the processor." ... "The restFP and saveFP functions are defined in Apple's libgcc, and so the fix is simply to include this library in your link line. The best way of doing this is to include the option -lcc_dynamic in your link line." Maybe we need this? > 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. > I have a vague understanding of the purpose of plttest.c and plt.h from the comments in the source about what this is supposed to do. Here is the contents of plt.h: ppc-osx3:~/osx/new/gcl-2.6.8pre $ cat o/plt.h MY_PLT(__srget), MY_PLT(__swbuf), MY_PLT(acos), MY_PLT(acosh), MY_PLT(asin), MY_PLT(asinh), MY_PLT(atan), MY_PLT(atanh), MY_PLT(cos), MY_PLT(cosh), MY_PLT(exp), MY_PLT(log), MY_PLT(setjmp), MY_PLT(sin), MY_PLT(sinh), MY_PLT(tan), MY_PLT(tanh) -------- You will note that "__srget" (two underscores) is present. > 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. > Thanks for the explanation. Note that __srget is not defined in an external library but rather in the /usr/include/stdio.h: ppc-osx3:~/osx/new/gcl-2.6.8pre $ grep srget /usr/include/stdio.h int __srget __P((FILE *)); #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) ppc-osx3:~/osx/new/gcl-2.6.8pre $ ------ Is that significant? Does that affect how gcl should look for this symbol? > 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*. > I get: 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/ >si::*plt-table* NIL > ---------- >... > > > > > 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. Did you mean before the save-system command? First here is the output from compiler::link ------- ppc-osx3:~/osx/new/gcl-2.6.8pre $ echo '(trace system open delete-file) (compiler::link nil "bar") (quit)' | gcl | more 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/ > Warning: SYSTEM is being redefined. Warning: OPEN is being redefined. Warning: DELETE-FILE is being redefined. (SYSTEM OPEN DELETE-FILE) > 1> (OPEN #p"./user-init.c" :DIRECTION :OUTPUT) <1 (OPEN #<output stream "./user-init.c">) 1> (SYSTEM "gcc -no-cpp-precomp -c -Wall -DVOL=volatile -fsigned-char -pipe -I /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../h -O3 -fomit-frame-poin ter -c \"./user-init.c\" -o \"./user-init.o\" -w") <1 (SYSTEM 0 0) 1> (DELETE-FILE #p"./user-init.c") <1 (DELETE-FILE T) 1> (OPEN "./raw_bar_map" :DIRECTION :OUTPUT) <1 (OPEN #<output stream "./raw_bar_map">) 1> (SYSTEM "gcc -no-cpp-precomp -o ./raw_bar ./user-init.o -L/home/users/b/b i/billpage/osx/lib/gcl-2.6.8/unixport/ -lgcl -lm -lc -lgclp ") <1 (SYSTEM 0 0) 1> (DELETE-FILE #p"./user-init.o") <1 (DELETE-FILE T) 1> (OPEN #p"init_bar.lsp" :DIRECTION :OUTPUT) <1 (OPEN #<output stream "init_bar.lsp">) 1> (OPEN "/home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/init_gcl.lsp") <1 (OPEN #<input stream "/home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/ init_gcl.lsp">) 1> (SYSTEM "./raw_bar /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/ < init_bar.lsp") GCL (GNU Common Lisp) April 1994 131072 pages Building symbol table for /private/automount/home/users/b/bi/billpage/osx/new/gc l-2.6.8pre/raw_bar.tmp .. loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/gcl_export.l sp Initializing gcl_defmacro.o Initializing gcl_evalmacros.o Initializing gcl_top.o Initializing gcl_module.o loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/gcl_autoload .lsp > NIL > #<"COMPILER" package> > #<"SLOOP" package> > #<"SERROR" package> > #<"ANSI-LOOP" package> > #<"DEFPACKAGE" package> > #<"TK" package> > #<"SYSTEM" package> SYSTEM> *COMMAND-ARGS* SYSTEM>Initializing gcl_predlib.o Initializing gcl_setf.o Initializing gcl_arraylib.o Initializing gcl_assert.o Initializing gcl_defstruct.o Initializing gcl_describe.o Initializing gcl_iolib.o Initializing gcl_listlib.o Initializing gcl_mislib.o Initializing gcl_numlib.o Initializing gcl_packlib.o Initializing gcl_seq.o Initializing gcl_seqlib.o Initializing gcl_trace.o Initializing gcl_sloop.o Initializing gcl_serror.o Initializing gcl_destructuring_bind.o Initializing gcl_loop.o Initializing gcl_defpackage.o Initializing gcl_make_defpackage.o Initializing gcl_cmpinline.o Initializing gcl_cmputil.o Initializing gcl_debug.o Initializing gcl_info.o Initializing gcl_cmptype.o Initializing gcl_cmpbind.o Initializing gcl_cmpblock.o Initializing gcl_cmpcall.o Initializing gcl_cmpcatch.o Initializing gcl_cmpenv.o Initializing gcl_cmpeval.o Initializing gcl_cmpflet.o Initializing gcl_cmpfun.o Initializing gcl_cmpif.o Initializing gcl_cmplabel.o Initializing gcl_cmplam.o Initializing gcl_cmplet.o Initializing gcl_cmploc.o Initializing gcl_cmpmap.o Initializing gcl_cmpmulti.o Initializing gcl_cmpspecial.o Initializing gcl_cmptag.o Initializing gcl_cmptop.o Initializing gcl_cmpvar.o Initializing gcl_cmpvs.o Initializing gcl_cmpwt.o Loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/sys-proclaim .lisp Finished loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/sys -proclaim.lisp Loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../cmpnew/sys-procl aim.lisp Finished loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../cmpnew/ sys-proclaim.lisp Loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../gcl-tk/tk-packag e.lsp Finished loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../gcl-tk/ tk-package.lsp Loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../cmpnew/gcl_cmpma in.lsp Warning: COMPILE-FILE is being redefined. Warning: COMPILE is being redefined. Warning: DISASSEMBLE is being redefined. Finished loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../cmpnew/ gcl_cmpmain.lsp Loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/gcl_auto_new .lsp Finished loading /home/users/b/bi/billpage/osx/lib/gcl-2.6.8/unixport/../lsp/gcl _auto_new.lsp T >DBEGIN: 0x1c7000 mach_mapstart: 0x5f5000 heap_end: 0xb09000 core_end: 0xb0a000 mach_brkpt: 0x57df000 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 0x1fbd2000 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: 0x2032c000 Lowest offset of all sections in __TEXT segment: 0x1658 --- 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 0x2658 0x1ab044 __picsymbol_stub 0x1ad69c 0x18e4 __symbol_stub 0x1aef80 0 __cstring 0x1aef80 0x15f5c __literal4 0x1c4edc 0x18 __literal8 0x1c4ef8 0x108 __const 0x1c5000 0x1f9c __eh_frame 0x1c6f9c 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 0x416d58 3 LC_SEGMENT 0x7c __DATA 0x5f5000 0x1fbd2000 __data 0x5f5000 0 4 LC_SEGMENT 0x38 __LINKEDIT 0x201c7000 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 - 0x5f3f38 (sz: 0x416d58) Writing segment __DATA at 0x5f4000 - 0xb09000 (sz: 0x515000) Writing segment __LINKEDIT at 0xb09000 - 0xc6d1d4 (sz: 0x1641d4) 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 3948 unused bytes follow Mach-O header <1 (SYSTEM 0 0) 1> (DELETE-FILE #p"./raw_bar") <1 (DELETE-FILE T) 1> (DELETE-FILE #p"init_bar.lsp") <1 (DELETE-FILE T) "bar" > --------- Maybe the anomally that you were worried about is not displayed above? I am not sure what you are looking for. Here is the same output from save-system: --------- ppc-osx3:~/osx/new/gcl-2.6.8pre $ echo '(trace system open delete-file) (si::save-system "foo") (quit)' | gcl | more 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/ > Warning: SYSTEM is being redefined. Warning: OPEN is being redefined. Warning: DELETE-FILE is being redefined. (SYSTEM OPEN DELETE-FILE) >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 -------- Note: no initializing in the above output from save-system. > ... Regards, Bill Page. _______________________________________________ Axiom-developer mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/axiom-developer
