[svlug] Understanding executables
shaeffer at neuralscape.com
Fri Oct 18 21:33:51 PDT 2002
On Fri, Oct 18, 2002 at 08:57:04PM -0500, Jay Link wrote:
> Hi --
> Can anyone recommend a good book or website to help me truly understand
> executables? I want to know:
> * What makes a binary file executable, aside from the permissions flag?
Search google with the phrase: Executable and Linking Format pdf
download the top selection for a good read: "Tool Interface Standard (TIS)
Executable and Linking Format (ELF) Specification Version 1.2"
Does anyone know if that is the current spec on ELF?
Anyway, from a programmers perspective, you'll want to learn about the .fini
and .init sections defined by the ELF spec. These enable you to control the
program flow at startup and termination of the process. This can be very
useful. Basically the code in the .init section will run before the main
function is called. And the code in the .fini section is executed last as a
"info binutils" look into readelf
"info gcc" All kinds of goodies in there, especially under "C Extensions"
Look into the concept of a system call, understanding that many library
calls end up making a system call to the OS. On your linux box, you can
start by looking into these files:
If you grok that, you'll figure out you can even make system calls directly
from your Linux application. For your next project, then you'll want to
invent your own system call, implementing it in a kernel module, and calling
it from your application.
Neuralscape; Santa Cruz, Ca. 95060
shaeffer at neuralscape.com http://www.neuralscape.com
More information about the svlug