Old site added; Modified the main page

This commit is contained in:
Serge Lamikhov-Center 2012-03-09 14:20:44 +02:00
parent 03da533493
commit e8c8a92cd9
11 changed files with 1593 additions and 5 deletions

View File

@ -13,9 +13,6 @@
<td align="left">
<h1>ELFIO - C++ library for reading and generating ELF files</h1>
</td>
<td align="right">
<a href="http://sourceforge.net/projects/elfio"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=76645&amp;type=15" width="150" height="40" alt="Get Templatized C++ Command Line Parser at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</td>
</tr>
</table>
@ -23,10 +20,11 @@
<h3>Links</h3>
<ul class="menu">
<li><a href="http://sourceforge.net/projects/elfio/files/">Download</a> the source</li><br/>
<li>Read the <a href="manual.html">Manual</a></li><br/>
<li>Read the <a href="tutorial.pdf">Users Guide</a></li><br/>
<li>Read the <a href="html/index.html">API documentation</a></li><br/>
<li>Visit the
<a href="http://sourceforge.net/projects/elfio/">SourceForge project page</a></li><br/>
<li><a href="oldsite/index.htm">Old documentation</a> for outdated 1.0.3 version of the library</li><br/>
<li>Send <a href="mailto:to_serge@users.sourceforge.net">feedback, comments, patches, etc.</a></li></br>
</ul>
</div>
@ -42,8 +40,44 @@ reading and generating files in ELF binary format.
It is also cross-platform - the library uses standard ANSI C++ constructions
and runs on wide variety of architectures.
</p>
<p>
While the library's implementation does make your work much easier: basic
knowledge of the ELF binary format is required. Information about ELF
binary format can be found widely on the web.
</p>
<p>
Current version of <em>ELFIO</em> library is 2.0 and it is distributed under
<a href="http://www.opensource.org/licenses/MIT">MIT License</a> conditions.
</p>
<p>
Note for users of previous library versions 1.0.x - Version 2.0 is not source
compatible to earlier versions. But, for many projects, transition to a new library
interface does not take more than several minutes.
</p>
<div class="main">
</div>
<div class="by">
<p class="author">
The library and the page is maintained by
<a href="mailto:to_serge@users.sourceforge.net">Serge Lamikhov-Center</a>.</br>
</p>
<table summary="Title and Sourceforge logo.">
<tr>
<td align="left" class=""author>
<p class="author">
Project Web Hosted by
</p>
</td>
<td align="left">
<a href="http://sourceforge.net/projects/elfio"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=19959&type=2" width="125" height="37" border="0" alt="Get ELFIO library" /></a>
</td>
</tr>
</table>
</div>
</body>

250
doc/site/oldsite/c18.htm Executable file
View File

@ -0,0 +1,250 @@
<HTML
><HEAD
><TITLE
>Getting Started With ELFIO</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="PREVIOUS"
TITLE="Introduction"
HREF="f14.htm"><LINK
REL="NEXT"
TITLE="ELF File Sections"
HREF="x35.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="f14.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x35.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="get-started"
>Chapter 1. Getting Started With ELFIO</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="c18.htm#AEN20"
>Initialization</A
></DT
><DT
><A
HREF="x35.htm"
>ELF File Sections</A
></DT
><DT
><A
HREF="x45.htm"
>Section Readers</A
></DT
><DT
><A
HREF="x57.htm"
>Finalization</A
></DT
></DL
></DIV
>
<DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN20"
>Initialization</A
></H1
>
<P
> The ELFIO library consists of two independent parts: ELF File Reader
(<FONT
COLOR="RED"
>IELFI</FONT
>)
and ELF Producer (<FONT
COLOR="RED"
>IELFO</FONT
>).
Each is represented by its own set of interfaces.
The library does not contain any classes that need to be explicitly
instantiated. ELFIO itself provides the interfaces that
are used to access the library's functionality.
</P
>
<P
> To make the program recognize all ELFIO interface classes, the ELFIO.h
header file is needed. This header file defines all
standard definitions from the TIS documentation.
<PRE
CLASS="PROGRAMLISTING"
> #include &#60;ELFIO.h&#62;</PRE
>
</P
>
<P
> This chapter will explain how to work with the reader component
of the ELFIO library. The first step is to get a pointer
onto the ELF File Reader:
<PRE
CLASS="PROGRAMLISTING"
> IELFI* pReader;
ELFIO::GetInstance()-&#62;CreateELFI( &#38;pReader );</PRE
>
</P
>
<P
> Now, that there is a pointer on the <FONT
COLOR="RED"
>IELFI</FONT
>
interface: initialize the object by loading the ELF file:
<PRE
CLASS="PROGRAMLISTING"
> char* filename = "file.o";
pReader-&#62;Load( filename );</PRE
>
</P
>
<P
> From here, there is access to the ELF header. This makes it possible to request file
parameters such as encoding, machine type, entry point, etc.
To get the encoding of the file use:
<PRE
CLASS="PROGRAMLISTING"
> unsigned char encoding = pReader-&#62;GetEncoding();</PRE
>
</P
>
<P
> Please note: standard types and constants from the TIS document are defined
in the ELFTypes.h header file. This file is included automatically into the
project. For example: ELFDATA2LSB and ELFDATA2MSB constants
define a value for little and big endian encoding.
</P
>
</DIV
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="f14.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x35.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Introduction</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ELF File Sections</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

146
doc/site/oldsite/c63.htm Executable file
View File

@ -0,0 +1,146 @@
<HTML
><HEAD
><TITLE
>ELFDump Utility</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="PREVIOUS"
TITLE="Finalization"
HREF="x57.htm"><LINK
REL="NEXT"
TITLE=" IELFO - ELF File Producer Interface
"
HREF="c66.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x57.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c66.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="elfdump"
>Chapter 2. ELFDump Utility</A
></H1
>
<P
> The source code for the ELF Dumping Utility can be found in the "Examples"
directory; included there are more examples on how to use different ELFIO
reader interfaces.
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x57.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="c66.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Finalization</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><FONT
COLOR="RED"
>IELFO</FONT
> - ELF File Producer Interface</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

264
doc/site/oldsite/c66.htm Executable file
View File

@ -0,0 +1,264 @@
<HTML
><HEAD
><TITLE
> IELFO - ELF File Producer Interface
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="PREVIOUS"
TITLE="ELFDump Utility"
HREF="c63.htm"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c63.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="ielfo"
>Chapter 3. <FONT
COLOR="RED"
>IELFO</FONT
> - ELF File Producer Interface
</A
></H1
>
<P
> The ELFIO library can help you build a very short ELF executable file.
This chapter shows how to build an executable file that will run on
x86 Linux machines and print "Hello World!" on your console.
</P
>
<P
> Just as with the reader, the first step is to get
a pointer onto the ELF File Writer (Producer):
<PRE
CLASS="PROGRAMLISTING"
> IELFO* pELFO;
ELFIO::GetInstance()-&#62;CreateELFO( &#38;pELFO );</PRE
>
</P
>
<P
> Before continuing, the library must be informed about the main
attributes of the executable file to be built. To do this, declare
that the executable ELF file will run on a 32 bit x86 machine; has little
endian encoding and uses the current version of the ELF file format:
<PRE
CLASS="PROGRAMLISTING"
> // You can't proceed without this function call!
pELFO-&#62;SetAttr( ELFCLASS32, ELFDATA2LSB, EV_CURRENT,
ET_EXEC, EM_386, EV_CURRENT, 0 );</PRE
>
</P
>
<P
> Some sections of an ELF executable file should reside in the program
segments. To create this loadable segment call the
<TT
CLASS="METHODNAME"
>AddSegment()</TT
> function.
<PRE
CLASS="PROGRAMLISTING"
> // Create a loadable segment
IELFOSegment* pSegment = pELFO-&#62;AddSegment( PT_LOAD,
0x08040000,
0x08040000,
PF_X | PF_R,
0x1000 );</PRE
>
</P
>
<P
> The following segment serves as a placeholder for our code section. To create
this code section call the AddSection() function:
<PRE
CLASS="PROGRAMLISTING"
> // Create code section
IELFOSection* pTextSec = pELFO-&#62;AddSection( ".text",
SHT_PROGBITS,
SHF_ALLOC | SHF_EXECINSTR,
0,
0x10,
0 );</PRE
>
</P
>
<P
> Then, add the executable code for the section:
<PRE
CLASS="PROGRAMLISTING"
> char text[] =
{ '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
'\xB9', '\xFD', '\x00', '\x04', '\x08', // mov ecx, msg
'\xBA', '\x0E', '\x00', '\x00', '\x00', // mov edx, 14
'\xCD', '\x80', // int 0x80
'\xB8', '\x01', '\x00', '\x00', '\x00', // mov eax, 1
'\xCD', '\x80', // int 0x80
'\x48', '\x65', '\x6C', '\x6C', '\x6F', // db 'Hello'
'\x2C', '\x20', '\x57', '\x6F', '\x72', // db ', Wor'
'\x6C', '\x64', '\x21', '\x0A' // db 'ld!', 10
};
pTextSec-&#62;SetData( text, sizeof( text ) );</PRE
>
</P
>
<P
> Next, this code section is put into the loadable segment:
<PRE
CLASS="PROGRAMLISTING"
> // Add code section into program segment
pSegment-&#62;AddSection( pTextSec );
pTextSec-&#62;Release();
pSegment-&#62;Release();</PRE
>
</P
>
<P
> Finally, define the start address of the program
and create the result file:
<PRE
CLASS="PROGRAMLISTING"
> // Set program entry point
pELFO-&#62;SetEntry( 0x08040000 );
// Create ELF file
pELFO-&#62;Save( "test.elf" );
pELFO-&#62;Release();</PRE
>
</P
>
<P
> Please note: Call the <TT
CLASS="METHODNAME"
>Release()</TT
> functions
for each interface you have used.
This will free all resources the ELFIO library has created.
</P
>
<P
> Now compile the program and run it. The result is a new ELF file
called "test.elf". The size of this working executable file is only
267 bytes! Run it on your Linux machine with the following commands:
<PRE
CLASS="PROGRAMLISTING"
> [Writer]$ ./Writer
[Writer]$ chmod +x test.elf
[Writer]$ ./test.elf
Hello, World!</PRE
>
</P
>
<P
> The full text for this program can be found in the "Writer" directory.
Also, in the "Examples" directory, two other programs "WriteObj"
and "WriteObj2" demonstrate the creation of ELF object files.
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="c63.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ELFDump Utility</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

151
doc/site/oldsite/f14.htm Executable file
View File

@ -0,0 +1,151 @@
<HTML
><HEAD
><TITLE
>Introduction</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="PREVIOUS"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="NEXT"
TITLE="Getting Started With ELFIO"
HREF="c18.htm"></HEAD
><BODY
CLASS="PREFACE"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="index.php"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c18.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="PREFACE"
><H1
><A
NAME="introduction"
>Introduction</A
></H1
>
<P
> ELFIO is a C++ library for reading and generating files
in the ELF binary format. This library is unique and not based on
any other product. It is also platform independent.
The library uses standard ANSI C++ constructions and
runs on a wide variety of architectures.
</P
>
<P
> While the library's implementation does make your work easier:
a basic knowledge of the ELF binary format is required. Information about ELF
is included in the TIS (Tool Interface Standards) documentation you received
with the library's source code.
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="c18.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ELFIO</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Getting Started With ELFIO</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

165
doc/site/oldsite/index.htm Executable file
View File

@ -0,0 +1,165 @@
<HTML
><HEAD
><TITLE
>ELFIO</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="NEXT"
TITLE="Introduction"
HREF="f14.htm"></HEAD
><BODY
CLASS="BOOK"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><A
NAME="AEN1"
>
<div align="right"><A href="http://sourceforge.net"><IMG src="http://sourceforge.net/sflogo.php?group_id=19959&type=2" width="125" height="37" border="0" alt="SourceForge Logo"></A></div>
</A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
><A
NAME="AEN2"
>ELFIO</A
></H1
><H2
CLASS="SUBTITLE"
>Tutorial</H2
> <H3
CLASS="AUTHOR"
><A
NAME="AEN7"
>Allan Finch</A
></H3
>
<H3
CLASS="AUTHOR"
><A
NAME="AEN10"
>Serge Lamikhov-Center</A
></H3
>
<HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="f14.htm"
>Introduction</A
></DT
><DT
>1. <A
HREF="c18.htm"
>Getting Started With ELFIO</A
></DT
><DD
><DL
><DT
><A
HREF="c18.htm#AEN20"
>Initialization</A
></DT
><DT
><A
HREF="x35.htm"
>ELF File Sections</A
></DT
><DT
><A
HREF="x45.htm"
>Section Readers</A
></DT
><DT
><A
HREF="x57.htm"
>Finalization</A
></DT
></DL
></DD
><DT
>2. <A
HREF="c63.htm"
>ELFDump Utility</A
></DT
><DT
>3. <A
HREF="c66.htm"
><FONT
COLOR="RED"
>IELFO</FONT
> - ELF File Producer Interface</A
></DT
></DL
></DIV
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="f14.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Introduction</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

187
doc/site/oldsite/x35.htm Executable file
View File

@ -0,0 +1,187 @@
<HTML
><HEAD
><TITLE
>ELF File Sections</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="UP"
TITLE="Getting Started With ELFIO"
HREF="c18.htm"><LINK
REL="PREVIOUS"
TITLE="Getting Started With ELFIO"
HREF="c18.htm"><LINK
REL="NEXT"
TITLE="Section Readers"
HREF="x45.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c18.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. Getting Started With ELFIO</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x45.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN35"
>ELF File Sections</A
></H1
>
<P
> ELF binary files consist of several sections. Each section has it's own
responsibility: some contain executable code; others describe program dependencies;
others symbol tables and so on. See the TIS documentation for a full description of each section.
</P
>
<P
> To see how many sections the ELF file contains, including their
names and sizes, is demonstated in the following code:
<PRE
CLASS="PROGRAMLISTING"
> int nSecNo = pReader-&#62;GetSectionsNum();
for ( int i = 0; i &#60; nSecNo; ++i ) { // For all sections
const IELFISection* pSec = pReader-&#62;GetSection( i );
std::cout &#60;&#60; pSec-&#62;GetName() &#60;&#60; '' ''
&#60;&#60; pSec-&#62;GetSize() &#60;&#60; std::endl;
pSec-&#62;Release();
}</PRE
>
</P
>
<P
> First, the number of sections are received; next, a pointer
on the <FONT
COLOR="RED"
>IELFISection</FONT
> interface. Using this interface,
access is gained to the different section attributes: size, type, flags and address.
To get a buffer that contains the section's bytes use the
<TT
CLASS="METHODNAME"
>GetData()</TT
> member function of this interface.
See the <FONT
COLOR="RED"
>IELFISection</FONT
> declaration for a full
description of the <FONT
COLOR="RED"
>IELFISection</FONT
> interface.
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="c18.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x45.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Getting Started With ELFIO</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c18.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Section Readers</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

214
doc/site/oldsite/x45.htm Executable file
View File

@ -0,0 +1,214 @@
<HTML
><HEAD
><TITLE
>Section Readers</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="UP"
TITLE="Getting Started With ELFIO"
HREF="c18.htm"><LINK
REL="PREVIOUS"
TITLE="ELF File Sections"
HREF="x35.htm"><LINK
REL="NEXT"
TITLE="Finalization"
HREF="x57.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x35.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. Getting Started With ELFIO</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x57.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN45"
>Section Readers</A
></H1
>
<P
> After the section data is received through the <TT
CLASS="METHODNAME"
>GetData()</TT
>
function call, the data can be manipulated.
There are special sections
that provide information in predefined forms. The ELFIO library
processes these sections. The library provides a set of
section readers that understand these predefined formats and how to process their data.
The ELFIO.h header file currently defines the types of readers as:
<PRE
CLASS="PROGRAMLISTING"
> enum ReaderType {
ELFI_STRING, // Strings reader
ELFI_SYMBOL, // Symbol table reader
ELFI_RELOCATION, // Relocation table reader
ELFI_NOTE, // Notes reader
ELFI_DYNAMIC, // Dynamic section reader
ELFI_HASH // Hash
};</PRE
>
</P
>
<P
> How to use the symbol table reader will be demonstated in the following example:
</P
>
<P
> First, get the symbol section:
<PRE
CLASS="PROGRAMLISTING"
> const IELFISection* pSec = pReader-&#62;GetSection( ''.symtab'' );</PRE
>
</P
>
<P
> Second, create a symbol section reader:
<PRE
CLASS="PROGRAMLISTING"
> IELFISymbolTable* pSymTbl = 0;
pReader-&#62;CreateSectionReader( IELFI::ELFI_SYMBOL,
pSec,
(void**)&#38;pSymTbl );</PRE
>
</P
>
<P
> And finally, use the section reader to process all entries
(print operations are omitted):
<PRE
CLASS="PROGRAMLISTING"
> std::string name;
Elf32_Addr value;
Elf32_Word size;
unsigned char bind;
unsigned char type;
Elf32_Half section;
int nSymNo = pSymTbl-&#62;GetSymbolNum();
if ( 0 &#60; nSymNo ) {
for ( int i = 0; i &#60; nSymNo; ++i ) {
pSymTbl-&#62;GetSymbol( i, name, value, size,
bind, type, section );
}
}
pSymTbl-&#62;Release();
pSec-&#62;Release();</PRE
>
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x35.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x57.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ELF File Sections</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c18.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Finalization</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

163
doc/site/oldsite/x57.htm Executable file
View File

@ -0,0 +1,163 @@
<HTML
><HEAD
><TITLE
>Finalization</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.74b"><LINK
REL="HOME"
TITLE="ELFIO"
HREF="index.php"><LINK
REL="UP"
TITLE="Getting Started With ELFIO"
HREF="c18.htm"><LINK
REL="PREVIOUS"
TITLE="Section Readers"
HREF="x45.htm"><LINK
REL="NEXT"
TITLE="ELFDump Utility"
HREF="c63.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>ELFIO: Tutorial</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x45.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 1. Getting Started With ELFIO</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c63.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN57"
>Finalization</A
></H1
>
<P
> All interfaces from the ELFIO library should be freed after
use. Each interface has a <TT
CLASS="METHODNAME"
>Release()</TT
> function.
It is not enough to only free the high level interface because
one of the sections or readers will still be held and its resources will not be cleared.
</P
>
<P
> The interfaces are freed immediately after their use, in this
example we will free only the pReader object:
<PRE
CLASS="PROGRAMLISTING"
> pReader-&#62;Release();</PRE
>
</P
>
</DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x45.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.php"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="c63.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Section Readers</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c18.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ELFDump Utility</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View File

@ -94,6 +94,12 @@ p {
}
p.author {
/* line-height: 0.5em; */
font-size:70%;
}
div.links{
float: left;
clear: left;
@ -115,3 +121,11 @@ div.main{
padding: 0.5em 0.5em 0.5em 0.5em;
}
div.by{
line-height: 0.5em;
border-width:1px;
border-color:#d0d0d0;
margin: 0.5em 0em 0.5em 14em;
padding: 0.5em 0.5em 0.5em 0.5em;
}