ELF File Structure on FreeBSD and Linux

In PE (for windows), you can read the headers / sections of this structure #include<windows.h>and use struct PIMAGE_DOS_HEADERto read the dos header in any PE file, for example.

How can I do this for the ELF header in FreeBSD / Linux? Which preprocessor needs to be added at the beginning of C / C ++ code? and is there a difference between FreeBSD and Linux regarding the ELF framework?

+3
source share
4 answers

You are looking for libelf .

+5
source

Look at the sources of reading. Or just google. For example, this http://www.scribd.com/doc/7027807/ELF-Format looks promising.

, http://www.linux.com/learn/docs/man/2838-elf5.

+2

Here are some pointers to help you:

+2
source

I cannot vouch for FreeBSD, but on Linux elf(5)there are many details in the man page :

NAME
   elf - format of Executable and Linking Format (ELF) files

SYNOPSIS
   #include <elf.h>

DESCRIPTION
   The header file <elf.h> defines the format of ELF executable
   binary files.  Amongst these files are normal executable
   files, relocatable object files, core files and shared
   libraries.
...

When I needed to understand ELF, I did not find anything more useful than MuppetLabs Tiny Executable . I am sure that many of the techniques are outdated (and have never been a good idea), but they are very well explained.

+1
source

All Articles