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

Re: Shared libs.



Wolfgang Lux wrote:
> Michael Hohmuth wrote:

> I recall, that the 68k version of GCC does not (yet?) support -pic (or
> is it -mpic?). BTW., I'm not quite happy if the compiler must have to be
> changed. There (still :-) seem to be people out there that do not use
> GCC (or am I wrong on that subject). Pure C won't work if it even does
> not support baserel addressing, but Lattice C supports it (at least
> that is what I read from the posts on this subject), so I would favor
> if we could get shared libraries working for both, GCC and Lattice.

Too bad the two best commercial compilers don't seem to be supported
anymore...  Anyway, so far nobody has announced to volunteer and write
the shared library support for MiNT, so this doesn't make any
difference. :-]

AFAIK, GCC for NetBSD/m68k does support "-fpic" (yes, it was called
"-fpic" in GCC if memory serves correctly).

> > Because of these two demands, base relative addressing alone will not
> > suffice: We can't dereference an external symbol without relocating
> > the reference first, but since the text segment should be read-only
> > (at least for shared libraries and shared text executables), we can't
> > modify the text segment.  Therefore we need an additional level of
> 
> That's right. The pointer to the libraries data segment must live in
> the executables data segment (and would be initialized at startup time
> when the shared library is actually linked).

Now tell me how do you want to load the new base pointer before
accessing a shared library's data without compiler support?

> Don't confuse shared libraries and dynamic linking. They are both
> related but it is not the same. I have been using dld (3.2.3) some
> time ago when programming with scm (the scheme interpreter which is
> the base of jacal) and it works quite nice under MiNT. But it does not
> help us anything on the subject of shared libraries. Dld loads the
> object modules and libraries into the data segment (sic!) of the
> executable, so you end up with `n' instances of the library if you load
> it into `n' executables. :-(

I know that, but you need dynamic linking for shared libraries; I just
suggested to look at dld as an example of how dynamic linking can be
done.

Michael
-- 
Email: hohmuth@inf.tu-dresden.de
WWW:   http://www.inf.tu-dresden.de/~mh1/