* dynamic loading woes (osf/1 1.3, but not only)
@ 1994-01-27 21:01 Sean Levy
1994-04-19 14:51 ` Thomas Stricker
0 siblings, 1 reply; 3+ messages in thread
From: Sean Levy @ 1994-01-27 21:01 UTC (permalink / raw)
Hi all,
I am attempting to implement dynamic loading of shared objects plus an
image dumpout facility for some software we have written (an
object-oriented programming language, written in terms of a C-based
object system we have developed locally). I develop mainly on Alphas
running OSF/1 (V1.3), but I am attempting to make my solution as
portable (or at least as #ifdef-able) as possible.
Under OSF/1 1.3, I have both dumping out of an executable image from
the running process and dynamic loading/linking of shared objects
working, but the two interact catastrophically; dumped out executables
don't contain code that was loaded at runtime. After many sessions in
the debugger, pondering the dlopen(3), _rdl_new_interface(3), etc...
man pages, looking at the SunOS => OSF/1 Porting Guide, and
disassembling various bits of the system, I am still at a loss. It
seems that what I want to do is have a segment somewhere above
TEXT_START but before _edata into which the new object code gets
loaded. I had been hoping to use the plain old data segment for this
purpose, by way of modifications to malloc.
I have modified GNU malloc to support the notion of multiple arenas,
which can optionally be pointed at static arrays instead of the heap,
and have implemented the rest of our object system in such a way that
it can be told to allocate objects out of "pure" storage instead of
heap (by switching arenas at the appropriate points). This has the
desired effect of putting objects so allocated into the data segment,
and thus gets them written out into dumped binaries.
I had been hoping that dlopen and friends used calls to malloc to
allocate whatever space was needed to hold loaded code, but this
appears not to be the case; in fact, it also appears that they don't
use sbrk, either. The _rdl_new_interface() man page and header file
makes cryptic references to the sbrk interface implemented by some
subcommands of _rdl_new_interface(), but I can't make heads nor tails
of it. In fact, I don't really understand what mechanism is being
used by the dynamic loader to bring the bits into memory; whatever it
is results in addresses in the upper half of the universe (high 32
bits). I have played around with -taso a bit, but according to the
memory map in the SunOS=>OSF/1 guide, it appears that that won't cut
it either, because dynamically loaded code appears above the data
segment.
Since I have lots of other things to hack on, I'm about to punt. If
anyone out there can offer advice or, better yet, sample code that
will allow me to load code on the fly in such a way that I can dump
out an image containing the code, please email me (snl+@CMU.EDU).
Solutions that work on systems other than OSF/1 would be eagerly
accepted. If there is interest, I'll summarize.
Thanks in advance,
-- Sean
P.S. For folks on the GNU patrol, don't worry, I'm going to ship in my
diffs to libmalloc as soon as I can figure this mess out, or figure
out that it isn't figurable.
-- S
--
prototype (n) -
Sean Levy, n-dim Group, EDRC, CMU | +1 412 268- | something you intend to
snl+@CMU.EDU (MIME,ATK) | 5222(vox) | throw away, but somehow
snl@DAMRAK.SLIP.CS.CMU.EDU (NeXT) | 5229(fax) | never do.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1994-04-26 21:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-01-27 21:01 dynamic loading woes (osf/1 1.3, but not only) Sean Levy
1994-04-19 14:51 ` Thomas Stricker
1994-04-26 21:51 ` Thomas Stricker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox