Subject: Re: When is ELF coming?
To: John Birrell <jb@cimlogic.com.au>
From: Curt Sampson <cjs@portal.ca>
List: port-alpha
Date: 11/21/1996 17:27:15
On Thu, 21 Nov 1996, John Birrell wrote:

> If libc is changed to use hidden names (like _sys_read) to solve
> Chris' problem with ELF shared libraries then it will function 
> exactly like it does now, until you try to use libpthread.
> 
> With libpthread (which is when things turn non-blocking internally and
> the potential for EAGAIN occurs), the design comes unstuck because
> libpthread wants to replace the _sys_read that libc is using.
> ...
> Can you see a solution (assuming that I've explained the problem 8-)?

Well, again, I'm still reading up on this stuff, and have not yet
started reading code, so there may be something completely wrong
in what I'm thinking here. But from the looks of it to me at this
point, weak symbols are a bad hack, and not at all the proper
solution to the problem.

I think that dynamic library linking should work just as static
library linking does. (This appears to be the case on the i386.)
For each function, it searches first the binary and then all the
libraries in order, and binds the first one that it finds. So if
you link like this:

	cc program.o libone.so.1.1 libtwo.so.1.1

and anything, anywhere in your program calls foo(), it will search
in the following order for foo()

    program.o
    libone.so.1.1
    libtwo.so.1.1

You can have foo defined in any of these, and it will find it. You
can have foo defined in more than one, even all three, without
problems.

I still don't know what order the shared libs in the hints file
get linked in, which could have a pretty big effect on pthreads,
but that's something that can be hacked on.

In other words, in my limited scope of vision at this time I don't
see why we can't just add i386-type shared libraries to the alpha
ECOFF format files and solve all of our problems in one fell swoop.
Not to mention that we'll avoid the `is this a NetBSD ELF file or
a Digital UNIX ELF file?' question when we load a binary. (ELF
doesn't appear to have any OS type; just CPU type.)

cjs

Curt Sampson    cjs@portal.ca		Info at http://www.portal.ca/
Internet Portal Services, Inc.	
Vancouver, BC   (604) 257-9400		De gustibus, aut bene aut nihil.