attila@nmpbas.nmpcad.se (Attila Nemeth) (10/04/90)
I have an application (interpreter) written under UNIX that
are using dynamic linking. I want to port this application
to BSD4.3 on Apollo.
The application is an extension language interpreter. One of
the features is the possibility to write a module, in let
say C, and then load the module dynamically without
relinking the interpreter.
The interpreter achieves this by using ld -A option (on SUN
and HP), which unfortunately has a different semantics under
Apollo.
The following steps are done in the interpreter to fix
dynamic linking:
1. Call sbrk(0) to find out where the new module is going to
be mapped. Set a pointer to this address.
2. Relink the core interpreter with the new module (ld -A ....)
This gives a new -o file in the filesystem.
3. Open this file (COFF format), and read the header to
find out the size of text, data, and bss. i.e. size = text +
data + bss .
4. Call sbrk(size), then copy text and data of the new file
to the old image (the pointer where to copy is given by step 1)
5. Use the relinked file in the filesystem, and access the symbol
table (the interpreter needs some initialization routines)
So my question is:
Is it possible to obtain a relinked file in the filesystem
and use its symbol table, i.e. I want to do the steps done
in 3 and 5.
How do you achieve dynamic linking under Apollo, what system
calls are involved? Where is the new symbol table located,
in the KGT?
I would really appreciate if someone could give some help on this.
---------------------------------------------------------------------
Attila Nemeth | Box 1193 | Electronic Mail: attila@inmic.se |
IM/NMPCAD | 164 22 KISTA | Voice: +46 8 752 11 75 |
| SWEDEN | Fax: +46 8 750 80 56 |
---------------------------------------------------------------------
nazgul@alphalpha.com (Kee Hinckley) (10/05/90)
In article <1990Oct4.150210.17095@sics.se> attila@nmpbas.nmpcad.se (Attila Nemeth) writes: >I have an application (interpreter) written under UNIX that >are using dynamic linking. I want to port this application >to BSD4.3 on Apollo. This is certainly possible to do, although I'm afraid I no longer have the code to do it. It turns out to be really trivial, but it requires undoc'd code. All I recall (this was back in 9.5 days) is that you make one call to load the binary, another call to take a string and look up the address, and then you just call it through the returned pointer. If you think about it, this is nothing more than an 'inlib' followed by an 'esa'. But for the life of me I can't remember the calls. I suppose you could do a 'nm' on /lib/* and guess :-). Sorry. -kee -- Alphalpha Software, Inc. | motif-request@alphalpha.com nazgul@alphalpha.com |----------------------------------- 617/646-7703 (voice/fax) | Proline BBS: 617/641-3722 I'm not sure which upsets me more; that people are so unwilling to accept responsibility for their own actions, or that they are so eager to regulate everyone else's.
bernard@shapec.mdcbbs.com (10/09/90)
In article <1990Oct4.150210.17095@sics.se>, attila@nmpbas.nmpcad.se (Attila Nemeth) writes: > I have an application (interpreter) written under UNIX that > are using dynamic linking. I want to port this application > to BSD4.3 on Apollo. > I haven't done this stuff myself but I have dynamically bound to stuff in installed libraries and I suggest you look in /usr/include/apollo/loader.h or even find the correpsonding documentation. It looks like it should contain routines that you want. -- Bernard Solomon Shape Data Limited (McDonnell Douglas) Internet: bernard@sdl.mdcbbs.com 46 Regent Street UUCP: ...!uunet!sdl.mdcbbs.com!bernard Cambridge CB2 1DB Voice: +44 223 316673 Fax: +44 223 316931 United Kingdom
vasta@apollo.HP.COM (John Vasta) (10/10/90)
In article <1990Oct5.021647.3398@alphalpha.com> nazgul@alphalpha.com (Kee Hinckley) writes: >In article <1990Oct4.150210.17095@sics.se> attila@nmpbas.nmpcad.se (Attila Nemeth) writes: >>I have an application (interpreter) written under UNIX that >>are using dynamic linking. I want to port this application >>to BSD4.3 on Apollo. > >This is certainly possible to do, although I'm afraid I no longer >have the code to do it. It turns out to be really trivial, but >it requires undoc'd code. I think what Kee is referring to is now documented. Check out the loader_$ calls in the latest Domain/OS Call Reference, or do "man a loader_intro" to get an introductory man page (assuming you have the Apollo man pages installed). This should be in SR10.2 at least. John Vasta Hewlett-Packard Apollo Systems Division vasta@apollo.hp.com M.S. CHR-03-DW (508) 256-6600 x5978 300 Apollo Drive, Chelmsford, MA 01824 UUCP: {decwrl!decvax, mit-eddie, attunix}!apollo!vasta