ELF: Difference between revisions

619 bytes added ,  6 years ago
no edit summary
[unchecked revision][unchecked revision]
No edit summary
Line 281:
The most common architectures are in bold.
 
An example C struct declaration for the file header (from Levine[http://www.iecc.com/linker/linker03.html 1999Levine]) would look like this:
struct ELF_fh {
Line 302:
short phdrcnt; // number of entries in section header or 0
short strsec; // section number that contains section name strings
};
 
=== Program header ===
Line 372:
 
Flags: 1 = executable, 2 = writable, 4 = readable.
 
An example C struct for the 32-bit (also from Levine) might be:
 
 
struct ELF_progh {
int type; // loadable code or data, dynamic linking info, etc.
int offset; // file offset of segment
int virtaddr; // virtual address to map segment
int physaddr; // physical address, not used
int filesize; // size of segment in file
int memsize; // size of segment in memory (bigger if contains BSS)
int flags; // Read, Write, Execute bits
int align; // required alignment, invariably hardware page size
};
 
 
 
 
=== Using the PIC with programs ===
Anonymous user