gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] PLT code and Mach-O


From: Aurelien Chanudet
Subject: [Gcl-devel] PLT code and Mach-O
Date: Tue, 9 Mar 2004 09:27:58 +0100

Hi Camm,

A couple of things :

1- I tried out the latest plt code as you instructed. Unfortunately, it does not work for Mach-O. Removing the leading underscore from symbol names in o/plt.h would not make it work. As stated in a mail I send yesterday, Mach-O has no Procedure Linkage Table, although it has a slightly equivalent table serving the same purpose, namely the indirect symbol table. The Apple linker does not support the -Map option, but there's an external object file analysis tool which can be used to get the indirect symbol table. Here is such a table for a really simplistic executable file (the __picsymbol_stub, __symbol_stub and __picsymbolstub1 entries are akin to the PLT and the __la_symbol_ptr and __nl_symbol_ptr entries are akin to the GOT) :

$ otool -IV a.out
a.out:
Indirect symbols for (__TEXT,__picsymbol_stub) 0 entries
address    index name
Indirect symbols for (__TEXT,__symbol_stub) 0 entries
address    index name
Indirect symbols for (__TEXT,__picsymbolstub1) 12 entries
address    index name
0x00001de0   117 _exit
0x00001e00   114 _atexit
0x00001e20   105 ___keymgr_dwarf2_register_sections
0x00001e40   109 __dyld_register_func_for_remove_image
0x00001e60   108 __dyld_register_func_for_add_image
0x00001e80   110 __init_keymgr
0x00001ea0   118 _free
0x00001ec0   113 _abort
0x00001ee0   112 __keymgr_set_and_unlock_processwide_ptr
0x00001f00   111 __keymgr_get_and_lock_processwide_ptr
0x00001f20   115 _calloc
0x00001f40   120 _printf
Indirect symbols for (__DATA,__la_symbol_ptr) 12 entries
address    index name
0x00002020   117 _exit
0x00002024   114 _atexit
0x00002028   105 ___keymgr_dwarf2_register_sections
0x0000202c   109 __dyld_register_func_for_remove_image
0x00002030   108 __dyld_register_func_for_add_image
0x00002034   110 __init_keymgr
0x00002038   118 _free
0x0000203c   113 _abort
0x00002040   112 __keymgr_set_and_unlock_processwide_ptr
0x00002044   111 __keymgr_get_and_lock_processwide_ptr
0x00002048   115 _calloc
0x0000204c   120 _printf
Indirect symbols for (__DATA,__nl_symbol_ptr) 5 entries
address    index name
0x00002050   116 _errno
0x00002054   107 __cthread_init_routine
0x00002058   119 _mach_init_routine
0x0000205c   106 ___keymgr_global
0x00002060   101 _environ

2- I happen to discuss about dynamic code loading with someone working on Lush. Lush (the Lisp Universal SHell, see http://lush.sourceforge.net/) has the ability to load code dynamically in much the same manner as GCL does. Long ago, Lush used the Dld dynamic link editor :

http://swissnet.ai.mit.edu/~jaffer/dld_toc.html

Alas, Dld only supports a.out. For this reason, the Lush people wrote their own dynamic link editor using BFD :

http://cvs.sourceforge.net/viewcvs.py/lush/lush/include/dldbfd.h
http://cvs.sourceforge.net/viewcvs.py/lush/lush/src/dldbfd.c

Lush now supports various Linux platforms, including ELF/MIPS which is known to have odd BFD features, and Cygwin. An effort to support Mach-O is underway.

Aurelien





reply via email to

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