home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!daresbury!doc.ic.ac.uk!ibmassc!yktnews!admin!yktnews!prener
- From: prener@watson.ibm.com (Dan Prener)
- Newsgroups: comp.unix.aix
- Subject: Re: Help with nlist(), XCOFF, and memory architecture...
- Message-ID: <PRENER.92Aug20200654@prener.watson.ibm.com>
- Date: 21 Aug 92 01:06:54 GMT
- References: <PAVEL.92Aug15180402@pixel.SLAC.Stanford.EDU>
- <PAVEL.92Aug19163010@pixel.SLAC.Stanford.EDU>
- Sender: news@watson.ibm.com (NNTP News Poster)
- Organization: IBM T.J. Watson Research Center, Hawthorne, New York
- Lines: 43
- In-Reply-To: pavel@pixel.SLAC.Stanford.EDU's message of 19 Aug 92 23:30:10 GMT
- Disclaimer: This posting represents the poster's views, not necessarily those of IBM
- Nntp-Posting-Host: prener.watson.ibm.com
-
- In article <PAVEL.92Aug19163010@pixel.SLAC.Stanford.EDU> pavel@pixel.SLAC.Stanford.EDU (Tom Pavel) writes:
-
- [ . . . ]
-
- >However, I still have many questions:
-
- >- Where is all this function-descriptor stuff documented? I scoured
- >through everything I could find, and I didn't see a trace of it (we're
- >still running 3.1.7, if that makes any diff in the docs).
-
- Look in InfoExplorer under "linkage conventions" in the section on
- function pointers.
-
- >- So far, what I can do works ok IF all the functions I want to
- >dynamically call are STATICALLY LINKED. I can compute the text
- >address of the function code by adding 0x10000200 to the nlist value,
- >or by comparing the nlist value of ".main" with the text address in
- >its function descriptor.
-
- The second is better. You don't know that your program will always
- be loaded at that address.
-
- [ . . . ]
-
- >- What is the TOC really, and how can I get its value for a given
- >memory segment?
-
- The TOC is really a pool of address constants, put together by the linker.
- There is one per separately-linked object, not one per memory segment.
- All shared libraries are in a single segment.
-
- >- Finally, I still have no clue why IBM chose "." instead of "_" to
- >prepend to all global symbols...
-
- If you have a global piece of data named "foo" then the global symbol is
- "foo". If you have a global function named "bar" then the name of the
- beginning of the program text is ".bar" but the name of the function
- descriptor is "bar". That choice was made so that someone who wanted
- to import or export a function named "bar" would write the natural
- thing, namely that he was importing or exporting "bar" rather than some
- derived name.
- --
- Dan Prener (prener@watson.ibm.com)
-