Date: Mon, 29 Apr 1996 08:26:39 +0200 (MET DST) From: sos@FreeBSD.org To: chuckr@Glue.umd.edu (Chuck Robey) Cc: FreeBSD-current@FreeBSD.org Subject: Re: ELF executeables Message-ID: <199604290626.IAA11981@ra.dkuug.dk> In-Reply-To: <Pine.OSF.3.91.960428121918.30493A-100000@professor.eng.umd.edu> from "Chuck Robey" at Apr 28, 96 12:29:24 pm
next in thread | previous in thread | raw e-mail | index | archive | help
In reply to Chuck Robey who wrote:
>
> I'm trying to understand how ELF executeables work, and having a little
> trouble. I found information (from an SVR4 manual) on the structure of
> ELF executables, and I've read it. Now I'm trying to understand how an
> executable gets started. I thought I had it that crt0 loaded an ld.so
> image, which determined if (or if not) it was a shared image, and started
> off loading any shared stuff via mmap calls. Because of this, I went
> looking at the crt0 and ld.so code, but found no provision for
> recognizing ELF execuables.
>
> I have found in /usr/src/sys/kern the files imgact_aout and imgact_elf, I
> can see that they must be doing the magic, but I don't understand at what
> point in starting execution of a program that they get involved. Could
> someone explain some of the strategy, or point me at something else to read?
Well, it goes like this:
The kernel reads in the first page (4K) of the file that you
gave as a prgramname, then it calls all the imgact_* functions
to see if the format is understood by one of the loaders.
Then in case of ELF the ELF headers are scanned to load the
text & data segments. Also it looks for a "interpreter" that if
found gets called to load in shared libs etc. Then the actual
crt0 is called and the program is run.
> Thanks. I think that the ELF stuff is really neat, I'm just exercising
> my curiosity. This is all raising some interesting questions in my mind,
> as to the ultimate (12-18 months) goal of FreeBSD. Is a.out possibly on
> it's way out? Does the size of current bloat out, during a possible
> conversion to ELF (dual libs?)?
Your'e welcome, and NO we have no plans for migrating to ELF in the near
future, at this point in time there is really no advantage in doing so.
I know this has been discussed to great lenght here, but IMNHO this
is still the case, as much as I love ELF (hey I wrote the loader :) )
This situation can change though, but it need ALOT of work in other
areas in the system, to really make a switch desireable.
> Sorry for all the questions, I'd really be interested in some comments.
> I'd move this to FreeBSD-chat if folks want.
No need to feel sorry for asking, thats the way to learn...
If the flamefest about ELF starts again, it can move to /dev/null for
all I care :) :)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Soren Schmidt (sos@FreeBSD.org) FreeBSD Core Team
So much code to hack -- so little time.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604290626.IAA11981>
