[MLton] getText{Start,End} considered harmful

Wesley W. Terpstra wesley at terpstra.ca
Tue Sep 23 05:27:02 PDT 2008


On Tue, Sep 23, 2008 at 7:58 AM, Ville Laurikari <ville at laurikari.net>wrote:

> It took me quite a while to figure out how to do it on HP-UX (it did
> turn out to be quite simple, though).  It works at least for
> standalone executables, but I have no idea about shared libraries.


The problem with shared libraries is that etext will be the main program's
text segment. I don't know about __text_start, but _start and _init also
will refer to the main program. The only way I know of is to find the ELF
headers and try to parse them. Of course, I don't know how to find the
loaded ELF header either. Ironically, windows is the only platform that will
currently work, as __image_base__ refers to the loaded start of the current
DSO on win32.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20080923/49830d44/attachment.html


More information about the MLton mailing list