mirror of
https://github.com/serge1/ELFIO.git
synced 2025-01-29 21:32:44 +00:00
Convert all files to UNIX EOL
This commit is contained in:
parent
effa95c718
commit
b78c0aca3d
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,10 +1,10 @@
|
||||
autom4te.cache
|
||||
build
|
||||
Debug
|
||||
ELFIO.sdf
|
||||
ELFIO.v11.suo
|
||||
ELFIO.opensdf
|
||||
|
||||
ELFIOTest/Debug
|
||||
|
||||
examples/ELFDump/Debug
|
||||
autom4te.cache
|
||||
build
|
||||
Debug
|
||||
ELFIO.sdf
|
||||
ELFIO.v11.suo
|
||||
ELFIO.opensdf
|
||||
|
||||
ELFIOTest/Debug
|
||||
|
||||
examples/ELFDump/Debug
|
||||
|
7
AUTHORS
7
AUTHORS
@ -1,5 +1,2 @@
|
||||
ELFIO library implemented by
|
||||
Serge Lamikhov-Center <to_serge@users.sourceforge.net>
|
||||
|
||||
ELFIO tutorial - Serge Lamikhov-Center
|
||||
Allan Finch
|
||||
ELFIO library implemented by
|
||||
Serge Lamikhov-Center <to_serge@users.sourceforge.net>
|
||||
|
42
COPYING
42
COPYING
@ -1,21 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,345 +1,345 @@
|
||||
#ifdef _MSC_VER
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
#define ELFIO_NO_INTTYPES
|
||||
#endif
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/output_test_stream.hpp>
|
||||
using boost::test_tools::output_test_stream;
|
||||
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
|
||||
bool write_obj_i386( bool is64bit )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
writer.create( is64bit ? ELFCLASS64 : ELFCLASS32, ELFDATA2LSB );
|
||||
writer.set_type( ET_REL );
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_machine( is64bit ? EM_X86_64 : EM_386 );
|
||||
|
||||
// Create code section*
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x00', '\x00', '\x00', '\x00', // 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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
section* str_sec = writer.sections.add( ".strtab" );
|
||||
str_sec->set_type( SHT_STRTAB );
|
||||
str_sec->set_addr_align( 0x1 );
|
||||
|
||||
string_section_accessor str_writer( str_sec );
|
||||
Elf_Word nStrIndex = str_writer.add_string( "msg" );
|
||||
|
||||
section* sym_sec = writer.sections.add( ".symtab" );
|
||||
sym_sec->set_type( SHT_SYMTAB );
|
||||
sym_sec->set_info( 2 );
|
||||
sym_sec->set_link( str_sec->get_index() );
|
||||
sym_sec->set_addr_align( 4 );
|
||||
sym_sec->set_entry_size( writer.get_default_entry_size( SHT_SYMTAB ) );
|
||||
|
||||
symbol_section_accessor symbol_writer( writer, sym_sec );
|
||||
Elf_Word nSymIndex = symbol_writer.add_symbol( nStrIndex, 0, 0,
|
||||
STB_LOCAL, STT_NOTYPE, 0,
|
||||
data_sec->get_index() );
|
||||
|
||||
// Another way to add symbol
|
||||
symbol_writer.add_symbol( str_writer, "_start", 0x00000000, 0,
|
||||
STB_WEAK, STT_FUNC, 0,
|
||||
text_sec->get_index() );
|
||||
|
||||
// Create relocation table section*
|
||||
section* rel_sec = writer.sections.add( ".rel.text" );
|
||||
rel_sec->set_type( SHT_REL );
|
||||
rel_sec->set_info( text_sec->get_index() );
|
||||
rel_sec->set_link( sym_sec->get_index() );
|
||||
rel_sec->set_addr_align( 4 );
|
||||
rel_sec->set_entry_size( writer.get_default_entry_size( SHT_REL ) );
|
||||
|
||||
relocation_section_accessor rel_writer( writer, rel_sec );
|
||||
rel_writer.add_entry( 11, nSymIndex, (unsigned char)R_386_RELATIVE );
|
||||
|
||||
// Another method to add the same relocation entry
|
||||
// pRelWriter->AddEntry( pStrWriter, "msg",
|
||||
// pSymWriter, 29, 0,
|
||||
// ELF32_ST_INFO( STB_GLOBAL, STT_OBJECT ), 0,
|
||||
// data_sec->GetIndex(),
|
||||
// 0, (unsigned char)R_386_RELATIVE );
|
||||
|
||||
// Create note section*
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
|
||||
// Create notes writer
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x77, "Created by ELFIO", 0, 0 );
|
||||
|
||||
// Create ELF file
|
||||
writer.save(
|
||||
is64bit ?
|
||||
"../elf_examples/write_obj_i386_64.o" :
|
||||
"../elf_examples/write_obj_i386_32.o"
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_obj_i386_32 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_obj_i386( false ) );
|
||||
output_test_stream output( "../elf_examples/write_obj_i386_32_match.o", true, false );
|
||||
std::ifstream input( "../elf_examples/write_obj_i386_32.o", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_obj_i386_64 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_obj_i386( true ) );
|
||||
output_test_stream output( "../elf_examples/write_obj_i386_64_match.o", true, false );
|
||||
std::ifstream input( "../elf_examples/write_obj_i386_64.o", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
bool write_exe_i386( bool is64bit, bool set_addr = false, Elf64_Addr addr = 0 )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
writer.create( is64bit ? ELFCLASS64 : ELFCLASS32, ELFDATA2LSB );
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_type( ET_EXEC );
|
||||
writer.set_machine( is64bit ? EM_X86_64 : EM_386 );
|
||||
|
||||
// Create code section*
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
if ( set_addr ) {
|
||||
text_sec->set_address( addr );
|
||||
}
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x20', '\x80', '\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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
segment* text_seg = writer.segments.add();
|
||||
text_seg->set_type( PT_LOAD );
|
||||
text_seg->set_virtual_address( 0x08048000 );
|
||||
text_seg->set_physical_address( 0x08048000 );
|
||||
text_seg->set_flags( PF_X | PF_R );
|
||||
text_seg->set_align( 0x1000 );
|
||||
text_seg->add_section_index( text_sec->get_index(), text_sec->get_addr_align() );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 0x4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
segment* data_seg = writer.segments.add();
|
||||
data_seg->set_type( PT_LOAD );
|
||||
data_seg->set_virtual_address( 0x08048020 );
|
||||
data_seg->set_physical_address( 0x08048020 );
|
||||
data_seg->set_flags( PF_W | PF_R );
|
||||
data_seg->set_align( 0x10 );
|
||||
data_seg->add_section_index( data_sec->get_index(), data_sec->get_addr_align() );
|
||||
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x01, "Created by ELFIO", 0, 0 );
|
||||
char descr[6] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36};
|
||||
note_writer.add_note( 0x01, "Never easier!", descr, sizeof( descr ) );
|
||||
|
||||
// Create ELF file
|
||||
writer.set_entry( 0x08048000 );
|
||||
|
||||
writer.save(
|
||||
is64bit ?
|
||||
"../elf_examples/write_exe_i386_64" :
|
||||
"../elf_examples/write_exe_i386_32"
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_exe_i386_32 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_exe_i386( false ) );
|
||||
output_test_stream output( "../elf_examples/write_exe_i386_32_match", true, false );
|
||||
std::ifstream input( "../elf_examples/write_exe_i386_32", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
|
||||
void checkObjestsAreEqual( std::string file_name1, std::string file_name2 )
|
||||
{
|
||||
elfio file1;
|
||||
elfio file2;
|
||||
BOOST_REQUIRE_EQUAL( file1.load( file_name1 ), true );
|
||||
BOOST_CHECK_EQUAL( file1.save( file_name2 ), true );
|
||||
BOOST_REQUIRE_EQUAL( file2.load( file_name2 ), true );
|
||||
|
||||
for (int i = 0; i < file1.sections.size(); ++i ) {
|
||||
const char* pdata1 = file1.sections[i]->get_data();
|
||||
const char* pdata2 = file2.sections[i]->get_data();
|
||||
|
||||
BOOST_CHECK_EQUAL( file1.sections[i]->get_size(),
|
||||
file2.sections[i]->get_size() );
|
||||
if ( ( file2.sections[i]->get_type() != SHT_NULL ) &&
|
||||
( file2.sections[i]->get_type() != SHT_NOBITS ) ) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( pdata1,
|
||||
pdata1 + file1.sections[i]->get_size(),
|
||||
pdata2,
|
||||
pdata2 + file2.sections[i]->get_size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void checkExeAreEqual( std::string file_name1, std::string file_name2 )
|
||||
{
|
||||
checkObjestsAreEqual( file_name1, file_name2 );
|
||||
|
||||
elfio file1;
|
||||
elfio file2;
|
||||
BOOST_REQUIRE_EQUAL( file1.load( file_name1 ), true );
|
||||
BOOST_CHECK_EQUAL( file1.save( file_name2 ), true );
|
||||
BOOST_REQUIRE_EQUAL( file2.load( file_name2 ), true );
|
||||
|
||||
for (int i = 0; i < file1.segments.size(); ++i ) {
|
||||
const char* pdata1 = file1.segments[i]->get_data();
|
||||
const char* pdata2 = file2.segments[i]->get_data();
|
||||
|
||||
BOOST_CHECK_EQUAL( file1.segments[i]->get_file_size(),
|
||||
file2.segments[i]->get_file_size() );
|
||||
if ( ( file2.segments[i]->get_type() != SHT_NULL ) &&
|
||||
( file2.segments[i]->get_type() != SHT_NOBITS ) ) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( pdata1,
|
||||
pdata1 + file1.segments[i]->get_file_size(),
|
||||
pdata2,
|
||||
pdata2 + file2.segments[i]->get_file_size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elf_object_copy_32 )
|
||||
{
|
||||
checkObjestsAreEqual( "../elf_examples/hello_32.o",
|
||||
"../elf_examples/hello_32_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/hello_64.o",
|
||||
"../elf_examples/hello_64_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/test_ppc.o",
|
||||
"../elf_examples/test_ppc_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_32.o",
|
||||
"../elf_examples/write_obj_i386_32_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_64.o",
|
||||
"../elf_examples/write_obj_i386_64_copy.o" );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elf_exe_copy_32 )
|
||||
{
|
||||
checkExeAreEqual( "../elf_examples/asm",
|
||||
"../elf_examples/asm_copy" );
|
||||
checkExeAreEqual( "../elf_examples/asm64",
|
||||
"../elf_examples/asm64_copy" );
|
||||
checkExeAreEqual( "../elf_examples/hello_32",
|
||||
"../elf_examples/hello_32_copy" );
|
||||
checkExeAreEqual( "../elf_examples/hello_64",
|
||||
"../elf_examples/hello_64_copy" );
|
||||
checkExeAreEqual( "../elf_examples/test_ppc",
|
||||
"../elf_examples/test_ppc_copy" );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( section_header_address_update )
|
||||
{
|
||||
elfio reader;
|
||||
|
||||
write_exe_i386( false, true, 0x0100 );
|
||||
|
||||
reader.load( "../elf_examples/write_exe_i386_32" );
|
||||
section* sec = reader.sections[".text"];
|
||||
BOOST_REQUIRE_NE( sec, (section*)0 );
|
||||
BOOST_CHECK_EQUAL( sec->get_address(), 0x00000100 );
|
||||
|
||||
write_exe_i386( false, false, 0 );
|
||||
|
||||
reader.load( "../elf_examples/write_exe_i386_32" );
|
||||
sec = reader.sections[".text"];
|
||||
BOOST_REQUIRE_NE( sec, (section*)0 );
|
||||
BOOST_CHECK_EQUAL( sec->get_address(), 0x08048000 );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elfio_copy )
|
||||
{
|
||||
elfio e;
|
||||
|
||||
write_exe_i386( false, true, 0x0100 );
|
||||
|
||||
e.load( "../elf_examples/write_exe_i386_32" );
|
||||
Elf_Half num = e.sections.size();
|
||||
section* new_sec = e.sections.add( "new" );
|
||||
e.save( "../elf_examples/write_exe_i386_32" );
|
||||
BOOST_CHECK_EQUAL( num + 1, e.sections.size() );
|
||||
|
||||
// Just return back the overwritten file
|
||||
write_exe_i386( false, false, 0 );
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
#define ELFIO_NO_INTTYPES
|
||||
#endif
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/output_test_stream.hpp>
|
||||
using boost::test_tools::output_test_stream;
|
||||
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
|
||||
bool write_obj_i386( bool is64bit )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
writer.create( is64bit ? ELFCLASS64 : ELFCLASS32, ELFDATA2LSB );
|
||||
writer.set_type( ET_REL );
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_machine( is64bit ? EM_X86_64 : EM_386 );
|
||||
|
||||
// Create code section*
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x00', '\x00', '\x00', '\x00', // 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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
section* str_sec = writer.sections.add( ".strtab" );
|
||||
str_sec->set_type( SHT_STRTAB );
|
||||
str_sec->set_addr_align( 0x1 );
|
||||
|
||||
string_section_accessor str_writer( str_sec );
|
||||
Elf_Word nStrIndex = str_writer.add_string( "msg" );
|
||||
|
||||
section* sym_sec = writer.sections.add( ".symtab" );
|
||||
sym_sec->set_type( SHT_SYMTAB );
|
||||
sym_sec->set_info( 2 );
|
||||
sym_sec->set_link( str_sec->get_index() );
|
||||
sym_sec->set_addr_align( 4 );
|
||||
sym_sec->set_entry_size( writer.get_default_entry_size( SHT_SYMTAB ) );
|
||||
|
||||
symbol_section_accessor symbol_writer( writer, sym_sec );
|
||||
Elf_Word nSymIndex = symbol_writer.add_symbol( nStrIndex, 0, 0,
|
||||
STB_LOCAL, STT_NOTYPE, 0,
|
||||
data_sec->get_index() );
|
||||
|
||||
// Another way to add symbol
|
||||
symbol_writer.add_symbol( str_writer, "_start", 0x00000000, 0,
|
||||
STB_WEAK, STT_FUNC, 0,
|
||||
text_sec->get_index() );
|
||||
|
||||
// Create relocation table section*
|
||||
section* rel_sec = writer.sections.add( ".rel.text" );
|
||||
rel_sec->set_type( SHT_REL );
|
||||
rel_sec->set_info( text_sec->get_index() );
|
||||
rel_sec->set_link( sym_sec->get_index() );
|
||||
rel_sec->set_addr_align( 4 );
|
||||
rel_sec->set_entry_size( writer.get_default_entry_size( SHT_REL ) );
|
||||
|
||||
relocation_section_accessor rel_writer( writer, rel_sec );
|
||||
rel_writer.add_entry( 11, nSymIndex, (unsigned char)R_386_RELATIVE );
|
||||
|
||||
// Another method to add the same relocation entry
|
||||
// pRelWriter->AddEntry( pStrWriter, "msg",
|
||||
// pSymWriter, 29, 0,
|
||||
// ELF32_ST_INFO( STB_GLOBAL, STT_OBJECT ), 0,
|
||||
// data_sec->GetIndex(),
|
||||
// 0, (unsigned char)R_386_RELATIVE );
|
||||
|
||||
// Create note section*
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
|
||||
// Create notes writer
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x77, "Created by ELFIO", 0, 0 );
|
||||
|
||||
// Create ELF file
|
||||
writer.save(
|
||||
is64bit ?
|
||||
"../elf_examples/write_obj_i386_64.o" :
|
||||
"../elf_examples/write_obj_i386_32.o"
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_obj_i386_32 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_obj_i386( false ) );
|
||||
output_test_stream output( "../elf_examples/write_obj_i386_32_match.o", true, false );
|
||||
std::ifstream input( "../elf_examples/write_obj_i386_32.o", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_obj_i386_64 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_obj_i386( true ) );
|
||||
output_test_stream output( "../elf_examples/write_obj_i386_64_match.o", true, false );
|
||||
std::ifstream input( "../elf_examples/write_obj_i386_64.o", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
bool write_exe_i386( bool is64bit, bool set_addr = false, Elf64_Addr addr = 0 )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
writer.create( is64bit ? ELFCLASS64 : ELFCLASS32, ELFDATA2LSB );
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_type( ET_EXEC );
|
||||
writer.set_machine( is64bit ? EM_X86_64 : EM_386 );
|
||||
|
||||
// Create code section*
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
if ( set_addr ) {
|
||||
text_sec->set_address( addr );
|
||||
}
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x20', '\x80', '\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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
segment* text_seg = writer.segments.add();
|
||||
text_seg->set_type( PT_LOAD );
|
||||
text_seg->set_virtual_address( 0x08048000 );
|
||||
text_seg->set_physical_address( 0x08048000 );
|
||||
text_seg->set_flags( PF_X | PF_R );
|
||||
text_seg->set_align( 0x1000 );
|
||||
text_seg->add_section_index( text_sec->get_index(), text_sec->get_addr_align() );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 0x4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
segment* data_seg = writer.segments.add();
|
||||
data_seg->set_type( PT_LOAD );
|
||||
data_seg->set_virtual_address( 0x08048020 );
|
||||
data_seg->set_physical_address( 0x08048020 );
|
||||
data_seg->set_flags( PF_W | PF_R );
|
||||
data_seg->set_align( 0x10 );
|
||||
data_seg->add_section_index( data_sec->get_index(), data_sec->get_addr_align() );
|
||||
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x01, "Created by ELFIO", 0, 0 );
|
||||
char descr[6] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36};
|
||||
note_writer.add_note( 0x01, "Never easier!", descr, sizeof( descr ) );
|
||||
|
||||
// Create ELF file
|
||||
writer.set_entry( 0x08048000 );
|
||||
|
||||
writer.save(
|
||||
is64bit ?
|
||||
"../elf_examples/write_exe_i386_64" :
|
||||
"../elf_examples/write_exe_i386_32"
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( write_exe_i386_32 )
|
||||
{
|
||||
BOOST_CHECK_EQUAL( true, write_exe_i386( false ) );
|
||||
output_test_stream output( "../elf_examples/write_exe_i386_32_match", true, false );
|
||||
std::ifstream input( "../elf_examples/write_exe_i386_32", std::ios::binary );
|
||||
output << input.rdbuf();
|
||||
BOOST_CHECK( output.match_pattern() );
|
||||
}
|
||||
|
||||
|
||||
void checkObjestsAreEqual( std::string file_name1, std::string file_name2 )
|
||||
{
|
||||
elfio file1;
|
||||
elfio file2;
|
||||
BOOST_REQUIRE_EQUAL( file1.load( file_name1 ), true );
|
||||
BOOST_CHECK_EQUAL( file1.save( file_name2 ), true );
|
||||
BOOST_REQUIRE_EQUAL( file2.load( file_name2 ), true );
|
||||
|
||||
for (int i = 0; i < file1.sections.size(); ++i ) {
|
||||
const char* pdata1 = file1.sections[i]->get_data();
|
||||
const char* pdata2 = file2.sections[i]->get_data();
|
||||
|
||||
BOOST_CHECK_EQUAL( file1.sections[i]->get_size(),
|
||||
file2.sections[i]->get_size() );
|
||||
if ( ( file2.sections[i]->get_type() != SHT_NULL ) &&
|
||||
( file2.sections[i]->get_type() != SHT_NOBITS ) ) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( pdata1,
|
||||
pdata1 + file1.sections[i]->get_size(),
|
||||
pdata2,
|
||||
pdata2 + file2.sections[i]->get_size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void checkExeAreEqual( std::string file_name1, std::string file_name2 )
|
||||
{
|
||||
checkObjestsAreEqual( file_name1, file_name2 );
|
||||
|
||||
elfio file1;
|
||||
elfio file2;
|
||||
BOOST_REQUIRE_EQUAL( file1.load( file_name1 ), true );
|
||||
BOOST_CHECK_EQUAL( file1.save( file_name2 ), true );
|
||||
BOOST_REQUIRE_EQUAL( file2.load( file_name2 ), true );
|
||||
|
||||
for (int i = 0; i < file1.segments.size(); ++i ) {
|
||||
const char* pdata1 = file1.segments[i]->get_data();
|
||||
const char* pdata2 = file2.segments[i]->get_data();
|
||||
|
||||
BOOST_CHECK_EQUAL( file1.segments[i]->get_file_size(),
|
||||
file2.segments[i]->get_file_size() );
|
||||
if ( ( file2.segments[i]->get_type() != SHT_NULL ) &&
|
||||
( file2.segments[i]->get_type() != SHT_NOBITS ) ) {
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( pdata1,
|
||||
pdata1 + file1.segments[i]->get_file_size(),
|
||||
pdata2,
|
||||
pdata2 + file2.segments[i]->get_file_size() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elf_object_copy_32 )
|
||||
{
|
||||
checkObjestsAreEqual( "../elf_examples/hello_32.o",
|
||||
"../elf_examples/hello_32_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/hello_64.o",
|
||||
"../elf_examples/hello_64_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/test_ppc.o",
|
||||
"../elf_examples/test_ppc_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_32.o",
|
||||
"../elf_examples/write_obj_i386_32_copy.o" );
|
||||
checkObjestsAreEqual( "../elf_examples/write_obj_i386_64.o",
|
||||
"../elf_examples/write_obj_i386_64_copy.o" );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elf_exe_copy_32 )
|
||||
{
|
||||
checkExeAreEqual( "../elf_examples/asm",
|
||||
"../elf_examples/asm_copy" );
|
||||
checkExeAreEqual( "../elf_examples/asm64",
|
||||
"../elf_examples/asm64_copy" );
|
||||
checkExeAreEqual( "../elf_examples/hello_32",
|
||||
"../elf_examples/hello_32_copy" );
|
||||
checkExeAreEqual( "../elf_examples/hello_64",
|
||||
"../elf_examples/hello_64_copy" );
|
||||
checkExeAreEqual( "../elf_examples/test_ppc",
|
||||
"../elf_examples/test_ppc_copy" );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( section_header_address_update )
|
||||
{
|
||||
elfio reader;
|
||||
|
||||
write_exe_i386( false, true, 0x0100 );
|
||||
|
||||
reader.load( "../elf_examples/write_exe_i386_32" );
|
||||
section* sec = reader.sections[".text"];
|
||||
BOOST_REQUIRE_NE( sec, (section*)0 );
|
||||
BOOST_CHECK_EQUAL( sec->get_address(), 0x00000100 );
|
||||
|
||||
write_exe_i386( false, false, 0 );
|
||||
|
||||
reader.load( "../elf_examples/write_exe_i386_32" );
|
||||
sec = reader.sections[".text"];
|
||||
BOOST_REQUIRE_NE( sec, (section*)0 );
|
||||
BOOST_CHECK_EQUAL( sec->get_address(), 0x08048000 );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
BOOST_AUTO_TEST_CASE( elfio_copy )
|
||||
{
|
||||
elfio e;
|
||||
|
||||
write_exe_i386( false, true, 0x0100 );
|
||||
|
||||
e.load( "../elf_examples/write_exe_i386_32" );
|
||||
Elf_Half num = e.sections.size();
|
||||
section* new_sec = e.sections.add( "new" );
|
||||
e.save( "../elf_examples/write_exe_i386_32" );
|
||||
BOOST_CHECK_EQUAL( num + 1, e.sections.size() );
|
||||
|
||||
// Just return back the overwritten file
|
||||
write_exe_i386( false, false, 0 );
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
CXX=g++
|
||||
CPPFLAGS=-c -Wall -std=c++0x -I../elfio
|
||||
LDLIBS=-lboost_test_exec_monitor-mt
|
||||
|
||||
ELFIODIR=../elfio/
|
||||
SOURCES=ELFIOTest.cpp ELFIOTest1.cpp
|
||||
INCLUDES=$(ELFIODIR)elfio.hpp $(ELFIODIR)elfio_header.hpp \
|
||||
$(ELFIODIR)elfio_note.hpp $(ELFIODIR)elfio_section.hpp \
|
||||
$(ELFIODIR)elfio_segment.hpp $(ELFIODIR)elfio_strings.hpp \
|
||||
$(ELFIODIR)elfio_symbols.hpp $(ELFIODIR)elfio_utils.hpp \
|
||||
$(ELFIODIR)elf_types.hpp
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
EXECUTABLE=ELFIOTest
|
||||
|
||||
all: $(SOURCES) $(EXECUTABLE) $(INCLUDES)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CXX) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CPPFLAGS) $< -o $@
|
||||
|
||||
test: $(EXECUTABLE)
|
||||
./$(EXECUTABLE) -r short
|
||||
|
||||
clean:
|
||||
rm $(OBJECTS) $(EXECUTABLE)
|
||||
CXX=g++
|
||||
CPPFLAGS=-c -Wall -std=c++0x -I../elfio
|
||||
LDLIBS=-lboost_test_exec_monitor-mt
|
||||
|
||||
ELFIODIR=../elfio/
|
||||
SOURCES=ELFIOTest.cpp ELFIOTest1.cpp
|
||||
INCLUDES=$(ELFIODIR)elfio.hpp $(ELFIODIR)elfio_header.hpp \
|
||||
$(ELFIODIR)elfio_note.hpp $(ELFIODIR)elfio_section.hpp \
|
||||
$(ELFIODIR)elfio_segment.hpp $(ELFIODIR)elfio_strings.hpp \
|
||||
$(ELFIODIR)elfio_symbols.hpp $(ELFIODIR)elfio_utils.hpp \
|
||||
$(ELFIODIR)elf_types.hpp
|
||||
OBJECTS=$(SOURCES:.cpp=.o)
|
||||
EXECUTABLE=ELFIOTest
|
||||
|
||||
all: $(SOURCES) $(EXECUTABLE) $(INCLUDES)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CXX) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $@
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CPPFLAGS) $< -o $@
|
||||
|
||||
test: $(EXECUTABLE)
|
||||
./$(EXECUTABLE) -r short
|
||||
|
||||
clean:
|
||||
rm $(OBJECTS) $(EXECUTABLE)
|
||||
|
18
Makefile.am
18
Makefile.am
@ -1,9 +1,9 @@
|
||||
SUBDIRS = examples
|
||||
nobase_include_HEADERS = elfio/elf_types.hpp elfio/elfi_dynamic.hpp \
|
||||
elfio/elfio.hpp elfio/elfio_header.hpp \
|
||||
elfio/elfio_note.hpp elfio/elfio_relocation.hpp \
|
||||
elfio/elfio_section.hpp elfio/elfio_segment.hpp \
|
||||
elfio/elfio_strings.hpp elfio/elfio_symbols.hpp \
|
||||
elfio/elfio_utils.hpp elfio/elfo_dynamic.hpp \
|
||||
elfio/elfio_dump.hpp
|
||||
EXTRA_DIST = doc/elfio.pdf
|
||||
SUBDIRS = examples
|
||||
nobase_include_HEADERS = elfio/elf_types.hpp elfio/elfi_dynamic.hpp \
|
||||
elfio/elfio.hpp elfio/elfio_header.hpp \
|
||||
elfio/elfio_note.hpp elfio/elfio_relocation.hpp \
|
||||
elfio/elfio_section.hpp elfio/elfio_segment.hpp \
|
||||
elfio/elfio_strings.hpp elfio/elfio_symbols.hpp \
|
||||
elfio/elfio_utils.hpp elfio/elfo_dynamic.hpp \
|
||||
elfio/elfio_dump.hpp
|
||||
EXTRA_DIST = doc/elfio.pdf
|
||||
|
10
Makefile.in
10
Makefile.in
@ -38,7 +38,7 @@ DIST_COMMON = README $(am__configure_deps) $(nobase_include_HEADERS) \
|
||||
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
|
||||
depcomp install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
@ -234,15 +234,15 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
$(AUTOMAKE) --foreign Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
8
README
8
README
@ -1,4 +1,4 @@
|
||||
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.
|
||||
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.
|
||||
|
30
configure
vendored
30
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for ELFIO 2.0.0.
|
||||
# Generated by GNU Autoconf 2.68 for ELFIO 2.0.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@ -556,8 +556,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='ELFIO'
|
||||
PACKAGE_TARNAME='elfio'
|
||||
PACKAGE_VERSION='2.0.0'
|
||||
PACKAGE_STRING='ELFIO 2.0.0'
|
||||
PACKAGE_VERSION='2.0'
|
||||
PACKAGE_STRING='ELFIO 2.0'
|
||||
PACKAGE_BUGREPORT=''
|
||||
PACKAGE_URL=''
|
||||
|
||||
@ -1199,7 +1199,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures ELFIO 2.0.0 to adapt to many kinds of systems.
|
||||
\`configure' configures ELFIO 2.0 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -1265,7 +1265,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of ELFIO 2.0.0:";;
|
||||
short | recursive ) echo "Configuration of ELFIO 2.0:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -1351,7 +1351,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
ELFIO configure 2.0.0
|
||||
ELFIO configure 2.0
|
||||
generated by GNU Autoconf 2.68
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
@ -1406,7 +1406,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by ELFIO $as_me 2.0.0, which was
|
||||
It was created by ELFIO $as_me 2.0, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -1754,7 +1754,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
am__api_version='1.11'
|
||||
|
||||
ac_aux_dir=
|
||||
@ -2221,8 +2220,8 @@ fi
|
||||
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE=ELFIO
|
||||
VERSION=2.0.0
|
||||
PACKAGE='elfio'
|
||||
VERSION='2.0'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -2262,7 +2261,6 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
|
||||
|
||||
|
||||
|
||||
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -2961,12 +2959,6 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile examples/Makefile examples/elfdump/Makefile examples/tutorial/Makefile examples/writer/Makefile examples/write_obj/Makefile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
@ -3539,7 +3531,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by ELFIO $as_me 2.0.0, which was
|
||||
This file was extended by ELFIO $as_me 2.0, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -3596,7 +3588,7 @@ _ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
ELFIO config.status 2.0.0
|
||||
ELFIO config.status 2.0
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
12
configure.ac
Normal file
12
configure.ac
Normal file
@ -0,0 +1,12 @@
|
||||
AC_INIT([ELFIO], [2.0])
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
|
||||
AC_PROG_CXX
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
examples/Makefile
|
||||
examples/elfdump/Makefile
|
||||
examples/tutorial/Makefile
|
||||
examples/writer/Makefile
|
||||
examples/write_obj/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
23
configure.in
23
configure.in
@ -1,23 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(ELFIO, 2.0.0)
|
||||
|
||||
AM_INIT_AUTOMAKE(ELFIO, 2.0.0)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_INSTALL
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
dnl Checks for library functions.
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
examples/Makefile
|
||||
examples/elfdump/Makefile
|
||||
examples/tutorial/Makefile
|
||||
examples/writer/Makefile
|
||||
examples/write_obj/Makefile])
|
@ -1,62 +1,62 @@
|
||||
ELFIO-1.0.0
|
||||
------------------------------------------
|
||||
ELFIO is a C++ library for reading and generating files in the
|
||||
ELF (Executable and Linkable Format) 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.
|
||||
|
||||
More examples for using this library located at Examples directory
|
||||
of the source package distribution.
|
||||
|
||||
|
||||
Runtime requirements:
|
||||
cygwin-1.3.10 or newer
|
||||
|
||||
Build requirements:
|
||||
cygwin-1.3.10 or newer
|
||||
|
||||
Canonical homepage:
|
||||
http://sourceforge.net/projects/elfio
|
||||
|
||||
Canonical download:
|
||||
http://sourceforge.net/project/showfiles.php?group_id=19959
|
||||
|
||||
------------------------------------
|
||||
|
||||
Build instructions:
|
||||
unpack ELFIO-1.0.0-1-src.tar.bz2
|
||||
cd /usr/src
|
||||
./ELFIO-1.0.0-1.sh all
|
||||
|
||||
This will create:
|
||||
/usr/src/ELFIO-1.0.0-1.tar.bz2
|
||||
/usr/src/ELFIO-1.0.0-1-src.tar.bz2
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Files included in the binary distro
|
||||
|
||||
/lib/libELFIO.a
|
||||
/usr/bin/ELFDump
|
||||
/usr/include/ELFIO.h
|
||||
/usr/include/ELFI.h
|
||||
/usr/include/ELFO.h
|
||||
/usr/include/ELFTypes.h
|
||||
/usr/doc/ELFIO-1.0.0/AUTHORS
|
||||
/usr/doc/ELFIO-1.0.0/COPYING
|
||||
/usr/doc/ELFIO-1.0.0/README
|
||||
/usr/doc/ELFIO-1.0.0/tutorial.pdf
|
||||
/usr/doc/ELFIO-1.0.0/tutorial.cpp
|
||||
/usr/doc/Cygwin/ELFIO-1.0.0.README
|
||||
|
||||
------------------
|
||||
|
||||
Port Notes:
|
||||
|
||||
----- version 1.0.0 -----
|
||||
Initial release
|
||||
|
||||
|
||||
Cygwin port maintained by: Serge Lamikhov-Center to_serge@sourceforge.net
|
||||
|
||||
ELFIO-1.0.0
|
||||
------------------------------------------
|
||||
ELFIO is a C++ library for reading and generating files in the
|
||||
ELF (Executable and Linkable Format) 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.
|
||||
|
||||
More examples for using this library located at Examples directory
|
||||
of the source package distribution.
|
||||
|
||||
|
||||
Runtime requirements:
|
||||
cygwin-1.3.10 or newer
|
||||
|
||||
Build requirements:
|
||||
cygwin-1.3.10 or newer
|
||||
|
||||
Canonical homepage:
|
||||
http://sourceforge.net/projects/elfio
|
||||
|
||||
Canonical download:
|
||||
http://sourceforge.net/project/showfiles.php?group_id=19959
|
||||
|
||||
------------------------------------
|
||||
|
||||
Build instructions:
|
||||
unpack ELFIO-1.0.0-1-src.tar.bz2
|
||||
cd /usr/src
|
||||
./ELFIO-1.0.0-1.sh all
|
||||
|
||||
This will create:
|
||||
/usr/src/ELFIO-1.0.0-1.tar.bz2
|
||||
/usr/src/ELFIO-1.0.0-1-src.tar.bz2
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
Files included in the binary distro
|
||||
|
||||
/lib/libELFIO.a
|
||||
/usr/bin/ELFDump
|
||||
/usr/include/ELFIO.h
|
||||
/usr/include/ELFI.h
|
||||
/usr/include/ELFO.h
|
||||
/usr/include/ELFTypes.h
|
||||
/usr/doc/ELFIO-1.0.0/AUTHORS
|
||||
/usr/doc/ELFIO-1.0.0/COPYING
|
||||
/usr/doc/ELFIO-1.0.0/README
|
||||
/usr/doc/ELFIO-1.0.0/tutorial.pdf
|
||||
/usr/doc/ELFIO-1.0.0/tutorial.cpp
|
||||
/usr/doc/Cygwin/ELFIO-1.0.0.README
|
||||
|
||||
------------------
|
||||
|
||||
Port Notes:
|
||||
|
||||
----- version 1.0.0 -----
|
||||
Initial release
|
||||
|
||||
|
||||
Cygwin port maintained by: Serge Lamikhov-Center to_serge@sourceforge.net
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
# ELFIO library
|
||||
category: Devel Libs
|
||||
requires: cygwin
|
||||
sdesc: "ELF file reader and producer implemented as a C++ library"
|
||||
ldesc: "ELFIO is a C++ library for reading and generating files in the
|
||||
ELF (Executable and Linkable Format) 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."
|
||||
# ELFIO library
|
||||
category: Devel Libs
|
||||
requires: cygwin
|
||||
sdesc: "ELF file reader and producer implemented as a C++ library"
|
||||
ldesc: "ELFIO is a C++ library for reading and generating files in the
|
||||
ELF (Executable and Linkable Format) 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."
|
||||
|
@ -1,179 +1,179 @@
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch}
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch}
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
|
@ -1,179 +1,179 @@
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch}
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch}
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
|
@ -1,179 +1,179 @@
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch} \
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
# find out where the build script is located
|
||||
tdir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
|
||||
test "x$tdir" = "x$0" && tdir=.
|
||||
scriptdir=`cd $tdir; pwd`
|
||||
# find src directory.
|
||||
# If scriptdir ends in SPECS, then topdir is $scriptdir/..
|
||||
# If scriptdir ends in CYGWIN-PATCHES, then topdir is $scriptdir/../..
|
||||
# Otherwise, we assume that topdir = scriptdir
|
||||
topdir1=`echo ${scriptdir} | sed 's%/SPECS$%%'`
|
||||
topdir2=`echo ${scriptdir} | sed 's%/CYGWIN-PATCHES$%%'`
|
||||
if [ "x$topdir1" != "x$scriptdir" ] ; then # SPECS
|
||||
topdir=`cd ${scriptdir}/..; pwd`
|
||||
else
|
||||
if [ "x$topdir2" != "x$scriptdir" ] ; then # CYGWIN-PATCHES
|
||||
topdir=`cd ${scriptdir}/../..; pwd`
|
||||
else
|
||||
topdir=`cd ${scriptdir}; pwd`
|
||||
fi
|
||||
fi
|
||||
|
||||
tscriptname=`basename $0 .sh`
|
||||
export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
|
||||
export VER=`echo $tscriptname | sed -e 's/^[^\-]*\-//' -e 's/\-[^\-]*$//'`
|
||||
export REL=`echo $tscriptname | sed -e 's/^[^\-]*\-[^\-]*\-//'`
|
||||
export FULLPKG=${PKG}-${VER}-${REL}
|
||||
# if the orig src package is bzip2'ed, remember to
|
||||
# change 'z' to 'j' in the 'tar xvzf' commands in the
|
||||
# prep) and mkpatch) sections
|
||||
export src_orig_pkg_name=${PKG}-${VER}.tar.gz
|
||||
export src_pkg_name=${FULLPKG}-src.tar.bz2
|
||||
export src_patch_name=${FULLPKG}.patch
|
||||
export bin_pkg_name=${FULLPKG}.tar.bz2
|
||||
|
||||
export src_orig_pkg=${topdir}/${src_orig_pkg_name}
|
||||
export src_pkg=${topdir}/${src_pkg_name}
|
||||
export src_patch=${topdir}/${src_patch_name}
|
||||
export bin_pkg=${topdir}/${bin_pkg_name}
|
||||
export srcdir=${topdir}/${PKG}-${VER}
|
||||
export objdir=${srcdir}/.build
|
||||
export instdir=${srcdir}/.inst
|
||||
export srcinstdir=${srcdir}/.sinst
|
||||
export checkfile=${topdir}/${FULLPKG}.check
|
||||
# run on
|
||||
host=i686-pc-cygwin
|
||||
# if this package creates binaries, they run on
|
||||
target=i686-pc-cygwin
|
||||
prefix=/usr
|
||||
sysconfdir=/etc
|
||||
MY_CFLAGS="-O2"
|
||||
MY_CXXFLAGS="-O2"
|
||||
MY_LDFLAGS=
|
||||
|
||||
mkdirs() {
|
||||
(cd ${topdir} && \
|
||||
mkdir -p ${objdir} && \
|
||||
mkdir -p ${instdir} && \
|
||||
mkdir -p ${srcinstdir} )
|
||||
}
|
||||
prep() {
|
||||
(cd ${topdir} && \
|
||||
tar xvzf ${src_orig_pkg} ; \
|
||||
cd ${topdir} && \
|
||||
patch -p0 < ${src_patch} \
|
||||
&& mkdirs )
|
||||
}
|
||||
conf() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
CXXFLAGS="${MY_CXXFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
|
||||
${srcdir}/configure --host=${host} --target=${target} \
|
||||
--srcdir=${srcdir} --prefix=${prefix} \
|
||||
--exec-prefix=${prefix} --sysconfdir=${sysconfdir} \
|
||||
--libdir=/lib --includedir=${prefix}/include \
|
||||
--libexecdir='${sbindir}' --localstatedir=/var \
|
||||
--datadir='${prefix}/share'
|
||||
)
|
||||
}
|
||||
build() {
|
||||
(cd ${objdir} && \
|
||||
CFLAGS="${MY_CFLAGS}" make )
|
||||
}
|
||||
check() {
|
||||
(cd ${objdir} && \
|
||||
make test | tee ${checkfile} 2>&1 )
|
||||
}
|
||||
clean() {
|
||||
(cd ${objdir} && \
|
||||
make clean )
|
||||
}
|
||||
install() {
|
||||
(cd ${objdir} && \
|
||||
make install DESTDIR=${instdir}
|
||||
if [ -f ${instdir}${prefix}/info/dir ] ; then \
|
||||
rm ${instdir}${prefix}/info/dir ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/${PKG}-${VER} ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/${PKG}-${VER} ; \
|
||||
fi && \
|
||||
if [ ! -d ${instdir}${prefix}/doc/Cygwin ]; then \
|
||||
mkdir -p ${instdir}${prefix}/doc/Cygwin ; \
|
||||
fi && \
|
||||
templist=""; \
|
||||
for f in ${srcdir}/ANNOUNCE ${srcdir}/CHANGES ${srcdir}/INSTALL \
|
||||
${srcdir}/KNOWNBUG ${srcdir}/LICENSE ${srcdir}/README \
|
||||
${srcdir}/AUTHORS ${srcdir}/KNOWNBUG ${srcdir}/COPYING \
|
||||
${srcdir}/doc/tutorial.pdf \
|
||||
${srcdir}/Examples/tutorial/tutorial.cpp \
|
||||
${srcdir}/TODO ; do \
|
||||
if [ -f $f ] ; then \
|
||||
templist="$templist $f"; \
|
||||
fi ; \
|
||||
done && \
|
||||
if [ ! "x$templist" = "x" ]; then \
|
||||
/usr/bin/install -m 644 $templist \
|
||||
${instdir}${prefix}/doc/${PKG}-${VER} ;
|
||||
fi && \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/${PKG}-${VER}.README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
else \
|
||||
if [ -f ${srcdir}/CYGWIN-PATCHES/README ]; then \
|
||||
/usr/bin/install -m 644 ${srcdir}/CYGWIN-PATCHES/README \
|
||||
${instdir}${prefix}/doc/Cygwin/${PKG}-${VER}.README ; \
|
||||
fi ;\
|
||||
fi ; )
|
||||
}
|
||||
strip() {
|
||||
(cd ${instdir} && \
|
||||
find . -name "*.dll" | xargs strip > /dev/null 2>&1
|
||||
find . -name "*.exe" | xargs strip > /dev/null 2>&1 )
|
||||
}
|
||||
pkg() {
|
||||
(cd ${instdir} && \
|
||||
tar cvjf ${bin_pkg} * )
|
||||
}
|
||||
mkpatch() {
|
||||
(cd ${srcdir} && \
|
||||
tar xvzf ${src_orig_pkg} ;\
|
||||
mv ${PKG}-${VER} ../${PKG}-${VER}-orig && \
|
||||
cd ${topdir} && \
|
||||
diff -urN -x '.build' -x '.inst' -x '.sinst' \
|
||||
${PKG}-${VER}-orig ${PKG}-${VER} > \
|
||||
${srcinstdir}/${src_patch_name} ; \
|
||||
rm -rf ${PKG}-${VER}-orig )
|
||||
}
|
||||
spkg() {
|
||||
(mkpatch && \
|
||||
cp ${src_orig_pkg} ${srcinstdir}/${src_orig_pkg_name} && \
|
||||
cp $0 ${srcinstdir}/`basename $0` && \
|
||||
cd ${srcinstdir} && \
|
||||
tar cvjf ${src_pkg} * )
|
||||
}
|
||||
finish() {
|
||||
rm -rf ${srcdir}
|
||||
}
|
||||
case $1 in
|
||||
prep) prep ; STATUS=$? ;;
|
||||
mkdirs) mkdirs; STATUS=$? ;;
|
||||
conf) conf ; STATUS=$? ;;
|
||||
build) build ; STATUS=$? ;;
|
||||
check) check ; STATUS=$? ;;
|
||||
clean) clean ; STATUS=$? ;;
|
||||
install) install ; STATUS=$? ;;
|
||||
strip) strip ; STATUS=$? ;;
|
||||
package) pkg ; STATUS=$? ;;
|
||||
pkg) pkg ; STATUS=$? ;;
|
||||
mkpatch) mkpatch ; STATUS=$? ;;
|
||||
src-package) spkg ; STATUS=$? ;;
|
||||
spkg) spkg ; STATUS=$? ;;
|
||||
finish) finish ; STATUS=$? ;;
|
||||
all) prep && conf && build && install && \
|
||||
strip && pkg && spkg && finish ; \
|
||||
STATUS=$? ;;
|
||||
*) echo "Error: bad arguments" ; exit 1 ;;
|
||||
esac
|
||||
exit ${STATUS}
|
||||
|
||||
|
||||
|
315
doc/Makefile.in
315
doc/Makefile.in
@ -1,315 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = doc
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = elfio.docbook elfio.pdf
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu doc/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
@ -1,84 +1,84 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>ELFIO - C++ library for reading and generating ELF files</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table summary="Title and Sourceforge logo.">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<h1>ELFIO - C++ library for reading and generating ELF files</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="links">
|
||||
<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="elfio.pdf">User's 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>
|
||||
|
||||
<div class="main">
|
||||
|
||||
<p>
|
||||
<em>ELFIO</em> is a small, header only C++ library that provides a simple interface for
|
||||
reading and generating files in ELF binary format.
|
||||
</p>
|
||||
<p>
|
||||
<em>ELFIO</em> library is independent and does not rely on any other additional projects.
|
||||
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>
|
||||
|
||||
<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=10" width="80" height="15" border="0" alt="Get ELFIO library" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>ELFIO - C++ library for reading and generating ELF files</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table summary="Title and Sourceforge logo.">
|
||||
<tr>
|
||||
<td align="left">
|
||||
<h1>ELFIO - C++ library for reading and generating ELF files</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="links">
|
||||
<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="elfio.pdf">User's 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>
|
||||
|
||||
<div class="main">
|
||||
|
||||
<p>
|
||||
<em>ELFIO</em> is a small, header only C++ library that provides a simple interface for
|
||||
reading and generating files in ELF binary format.
|
||||
</p>
|
||||
<p>
|
||||
<em>ELFIO</em> library is independent and does not rely on any other additional projects.
|
||||
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>
|
||||
|
||||
<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=10" width="80" height="15" border="0" alt="Get ELFIO library" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
@ -1,131 +1,131 @@
|
||||
/*
|
||||
color:#ffffff; white
|
||||
color:#e0e0e0; light gray
|
||||
color:#f8f8f8; light gray
|
||||
color:#003366; dark blue
|
||||
color:#555555; gray
|
||||
color:#ff9933; light orange
|
||||
color:#cc3300; red/brown/orange
|
||||
color:#660066; purple
|
||||
color:#669900; green
|
||||
*/
|
||||
|
||||
a {
|
||||
color:#003366;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#ff9933;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: verdana, tahoma, helvetica, arial, sans-serif;
|
||||
font-size: 90%;
|
||||
background-color:#ffffff;
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: courier, serif;
|
||||
background-color:#f8f8f8;
|
||||
margin: 1.5em;
|
||||
font-size:90%;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: circle outside;
|
||||
font-stretch:extra-expanded;
|
||||
/* font-size:90%;*/
|
||||
}
|
||||
|
||||
ul.menu { /* inherits from ul */
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
|
||||
em {
|
||||
color:#FF7700;
|
||||
font-size:110%;
|
||||
}
|
||||
|
||||
h1,h2,h3{
|
||||
color:#FF7700;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-color:#d0d0d0;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
font-weight:bold;
|
||||
padding: 0.2em;
|
||||
background-color:#f8f8f8
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size:120%;
|
||||
font-weight:bold;
|
||||
border-bottom-style:solid;
|
||||
border-bottom-width:1px;
|
||||
border-bottom-color:#d0d0d0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size:110%;
|
||||
font-weight:bold;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: courier, serif;
|
||||
}
|
||||
|
||||
tt.classname {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
tt.constant {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
p.author {
|
||||
/* line-height: 0.5em; */
|
||||
font-size:70%;
|
||||
}
|
||||
|
||||
|
||||
div.links{
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 12em;
|
||||
background-color:#f8f8f8;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#d0d0d0;
|
||||
margin-bottom: 0.5em;
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
margin: 0.5em 0.5em 0em 0em;
|
||||
}
|
||||
|
||||
div.main{
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#d0d0d0;
|
||||
margin: 0.5em 0em 0.5em 14em;
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
color:#ffffff; white
|
||||
color:#e0e0e0; light gray
|
||||
color:#f8f8f8; light gray
|
||||
color:#003366; dark blue
|
||||
color:#555555; gray
|
||||
color:#ff9933; light orange
|
||||
color:#cc3300; red/brown/orange
|
||||
color:#660066; purple
|
||||
color:#669900; green
|
||||
*/
|
||||
|
||||
a {
|
||||
color:#003366;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#ff9933;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: verdana, tahoma, helvetica, arial, sans-serif;
|
||||
font-size: 90%;
|
||||
background-color:#ffffff;
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: courier, serif;
|
||||
background-color:#f8f8f8;
|
||||
margin: 1.5em;
|
||||
font-size:90%;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: circle outside;
|
||||
font-stretch:extra-expanded;
|
||||
/* font-size:90%;*/
|
||||
}
|
||||
|
||||
ul.menu { /* inherits from ul */
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
|
||||
em {
|
||||
color:#FF7700;
|
||||
font-size:110%;
|
||||
}
|
||||
|
||||
h1,h2,h3{
|
||||
color:#FF7700;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-color:#d0d0d0;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
font-weight:bold;
|
||||
padding: 0.2em;
|
||||
background-color:#f8f8f8
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size:120%;
|
||||
font-weight:bold;
|
||||
border-bottom-style:solid;
|
||||
border-bottom-width:1px;
|
||||
border-bottom-color:#d0d0d0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size:110%;
|
||||
font-weight:bold;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: courier, serif;
|
||||
}
|
||||
|
||||
tt.classname {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
tt.constant {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
|
||||
p {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
p.author {
|
||||
/* line-height: 0.5em; */
|
||||
font-size:70%;
|
||||
}
|
||||
|
||||
|
||||
div.links{
|
||||
float: left;
|
||||
clear: left;
|
||||
width: 12em;
|
||||
background-color:#f8f8f8;
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#d0d0d0;
|
||||
margin-bottom: 0.5em;
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
margin: 0.5em 0.5em 0em 0em;
|
||||
}
|
||||
|
||||
div.main{
|
||||
border-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#d0d0d0;
|
||||
margin: 0.5em 0em 0.5em 14em;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
1 ; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
2 ; ld -s -o hello hello.o # this will produce hello executable
|
||||
3
|
||||
4 section .text
|
||||
5 global _start ;must be declared for linker (ld)
|
||||
6
|
||||
7 _start: ;tell linker entry point
|
||||
8
|
||||
9 00000000 BA0E000000 mov edx,len ;message length
|
||||
10 00000005 B9[00000000] mov ecx,msg ;message to write
|
||||
11 0000000A BB01000000 mov ebx,1 ;file descriptor (stdout)
|
||||
12 0000000F B804000000 mov eax,4 ;system call number (sys_write)
|
||||
13 00000014 CD80 int 0x80 ;call kernel
|
||||
14
|
||||
15 00000016 B801000000 mov eax,1 ;system call number (sys_exit)
|
||||
16 0000001B CD80 int 0x80 ;call kernel
|
||||
17
|
||||
18 section .data
|
||||
19
|
||||
20 00000000 48656C6C6F2C20776F- msg db 'Hello, world!',0xa ;our dear string
|
||||
21 00000009 726C64210A
|
||||
22 len equ $ - msg ;length of our dear string
|
||||
23
|
||||
1 ; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
2 ; ld -s -o hello hello.o # this will produce hello executable
|
||||
3
|
||||
4 section .text
|
||||
5 global _start ;must be declared for linker (ld)
|
||||
6
|
||||
7 _start: ;tell linker entry point
|
||||
8
|
||||
9 00000000 BA0E000000 mov edx,len ;message length
|
||||
10 00000005 B9[00000000] mov ecx,msg ;message to write
|
||||
11 0000000A BB01000000 mov ebx,1 ;file descriptor (stdout)
|
||||
12 0000000F B804000000 mov eax,4 ;system call number (sys_write)
|
||||
13 00000014 CD80 int 0x80 ;call kernel
|
||||
14
|
||||
15 00000016 B801000000 mov eax,1 ;system call number (sys_exit)
|
||||
16 0000001B CD80 int 0x80 ;call kernel
|
||||
17
|
||||
18 section .data
|
||||
19
|
||||
20 00000000 48656C6C6F2C20776F- msg db 'Hello, world!',0xa ;our dear string
|
||||
21 00000009 726C64210A
|
||||
22 len equ $ - msg ;length of our dear string
|
||||
23
|
||||
|
@ -1,22 +1,22 @@
|
||||
; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
; ld -s -o hello hello.o # this will produce hello executable
|
||||
|
||||
section .text
|
||||
global _start ;must be declared for linker (ld)
|
||||
|
||||
_start: ;tell linker entry point
|
||||
|
||||
mov edx,len ;message length
|
||||
mov ecx,msg ;message to write
|
||||
mov ebx,1 ;file descriptor (stdout)
|
||||
mov eax,4 ;system call number (sys_write)
|
||||
int 0x80 ;call kernel
|
||||
|
||||
mov eax,1 ;system call number (sys_exit)
|
||||
int 0x80 ;call kernel
|
||||
|
||||
section .data
|
||||
|
||||
msg db 'Hello, world!',0xa ;our dear string
|
||||
len equ $ - msg ;length of our dear string
|
||||
|
||||
; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
; ld -s -o hello hello.o # this will produce hello executable
|
||||
|
||||
section .text
|
||||
global _start ;must be declared for linker (ld)
|
||||
|
||||
_start: ;tell linker entry point
|
||||
|
||||
mov edx,len ;message length
|
||||
mov ecx,msg ;message to write
|
||||
mov ebx,1 ;file descriptor (stdout)
|
||||
mov eax,4 ;system call number (sys_write)
|
||||
int 0x80 ;call kernel
|
||||
|
||||
mov eax,1 ;system call number (sys_exit)
|
||||
int 0x80 ;call kernel
|
||||
|
||||
section .data
|
||||
|
||||
msg db 'Hello, world!',0xa ;our dear string
|
||||
len equ $ - msg ;length of our dear string
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
1 ; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
2 ; ld -s -o hello hello.o # this will produce hello executable
|
||||
3
|
||||
4 section .text
|
||||
5 global _start ;must be declared for linker (ld)
|
||||
6
|
||||
7 _start: ;tell linker entry point
|
||||
8
|
||||
9 00000000 BA0E000000 mov edx,len ;message length
|
||||
10 00000005 B9[00000000] mov ecx,msg ;message to write
|
||||
11 0000000A BB01000000 mov ebx,1 ;file descriptor (stdout)
|
||||
12 0000000F B804000000 mov eax,4 ;system call number (sys_write)
|
||||
13 00000014 CD80 int 0x80 ;call kernel
|
||||
14
|
||||
15 00000016 B801000000 mov eax,1 ;system call number (sys_exit)
|
||||
16 0000001B CD80 int 0x80 ;call kernel
|
||||
17
|
||||
18 section .data
|
||||
19
|
||||
20 00000000 48656C6C6F2C20776F- msg db 'Hello, world!',0xa ;our dear string
|
||||
21 00000009 726C64210A
|
||||
22 len equ $ - msg ;length of our dear string
|
||||
23
|
||||
1 ; nasm -f elf hello.asm # this will produce hello.o ELF object file
|
||||
2 ; ld -s -o hello hello.o # this will produce hello executable
|
||||
3
|
||||
4 section .text
|
||||
5 global _start ;must be declared for linker (ld)
|
||||
6
|
||||
7 _start: ;tell linker entry point
|
||||
8
|
||||
9 00000000 BA0E000000 mov edx,len ;message length
|
||||
10 00000005 B9[00000000] mov ecx,msg ;message to write
|
||||
11 0000000A BB01000000 mov ebx,1 ;file descriptor (stdout)
|
||||
12 0000000F B804000000 mov eax,4 ;system call number (sys_write)
|
||||
13 00000014 CD80 int 0x80 ;call kernel
|
||||
14
|
||||
15 00000016 B801000000 mov eax,1 ;system call number (sys_exit)
|
||||
16 0000001B CD80 int 0x80 ;call kernel
|
||||
17
|
||||
18 section .data
|
||||
19
|
||||
20 00000000 48656C6C6F2C20776F- msg db 'Hello, world!',0xa ;our dear string
|
||||
21 00000009 726C64210A
|
||||
22 len equ $ - msg ;length of our dear string
|
||||
23
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf( "Hello\n" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf( "Hello\n" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,211 +1,211 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: Intel 80386
|
||||
Version: 0x1
|
||||
Entry point address: 0x80482b0
|
||||
Start of program headers: 52 (bytes into file)
|
||||
Start of section headers: 1912 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 32 (bytes)
|
||||
Number of program headers: 7
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 28
|
||||
Section header string table index: 25
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .interp PROGBITS 08048114 000114 000013 00 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 08048128 000128 000020 00 A 0 0 4
|
||||
[ 3] .gnu.hash GNU_HASH 08048148 000148 000020 04 A 4 0 4
|
||||
[ 4] .dynsym DYNSYM 08048168 000168 000050 10 A 5 1 4
|
||||
[ 5] .dynstr STRTAB 080481b8 0001b8 00004a 00 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 08048202 000202 00000a 02 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 0804820c 00020c 000020 00 A 5 1 4
|
||||
[ 8] .rel.dyn REL 0804822c 00022c 000008 08 A 4 0 4
|
||||
[ 9] .rel.plt REL 08048234 000234 000018 08 A 4 11 4
|
||||
[10] .init PROGBITS 0804824c 00024c 000017 00 AX 0 0 4
|
||||
[11] .plt PROGBITS 08048264 000264 000040 04 AX 0 0 4
|
||||
[12] .text PROGBITS 080482b0 0002b0 0001a8 00 AX 0 0 16
|
||||
[13] .fini PROGBITS 08048458 000458 00001c 00 AX 0 0 4
|
||||
[14] .rodata PROGBITS 08048474 000474 000012 00 A 0 0 4
|
||||
[15] .eh_frame PROGBITS 08048488 000488 000004 00 A 0 0 4
|
||||
[16] .ctors PROGBITS 0804948c 00048c 000008 00 WA 0 0 4
|
||||
[17] .dtors PROGBITS 08049494 000494 000008 00 WA 0 0 4
|
||||
[18] .jcr PROGBITS 0804949c 00049c 000004 00 WA 0 0 4
|
||||
[19] .dynamic DYNAMIC 080494a0 0004a0 0000c8 08 WA 5 0 4
|
||||
[20] .got PROGBITS 08049568 000568 000004 04 WA 0 0 4
|
||||
[21] .got.plt PROGBITS 0804956c 00056c 000018 04 WA 0 0 4
|
||||
[22] .data PROGBITS 08049584 000584 000004 00 WA 0 0 4
|
||||
[23] .bss NOBITS 08049588 000588 000008 00 WA 0 0 4
|
||||
[24] .comment PROGBITS 00000000 000588 000114 00 0 0 1
|
||||
[25] .shstrtab STRTAB 00000000 00069c 0000db 00 0 0 1
|
||||
[26] .symtab SYMTAB 00000000 000bd8 000440 10 27 48 4
|
||||
[27] .strtab STRTAB 00000000 001018 000259 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
PHDR 0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
|
||||
INTERP 0x000114 0x08048114 0x08048114 0x00013 0x00013 R 0x1
|
||||
[Requesting program interpreter: /lib/ld-linux.so.2]
|
||||
LOAD 0x000000 0x08048000 0x08048000 0x0048c 0x0048c R E 0x1000
|
||||
LOAD 0x00048c 0x0804948c 0x0804948c 0x000fc 0x00104 RW 0x1000
|
||||
DYNAMIC 0x0004a0 0x080494a0 0x080494a0 0x000c8 0x000c8 RW 0x4
|
||||
NOTE 0x000128 0x08048128 0x08048128 0x00020 0x00020 R 0x4
|
||||
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
|
||||
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06
|
||||
|
||||
Dynamic section at offset 0x4a0 contains 20 entries:
|
||||
Tag Type Name/Value
|
||||
0x00000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x0000000c (INIT) 0x804824c
|
||||
0x0000000d (FINI) 0x8048458
|
||||
0x6ffffef5 (GNU_HASH) 0x8048148
|
||||
0x00000005 (STRTAB) 0x80481b8
|
||||
0x00000006 (SYMTAB) 0x8048168
|
||||
0x0000000a (STRSZ) 74 (bytes)
|
||||
0x0000000b (SYMENT) 16 (bytes)
|
||||
0x00000015 (DEBUG) 0x0
|
||||
0x00000003 (PLTGOT) 0x804956c
|
||||
0x00000002 (PLTRELSZ) 24 (bytes)
|
||||
0x00000014 (PLTREL) REL
|
||||
0x00000017 (JMPREL) 0x8048234
|
||||
0x00000011 (REL) 0x804822c
|
||||
0x00000012 (RELSZ) 8 (bytes)
|
||||
0x00000013 (RELENT) 8 (bytes)
|
||||
0x6ffffffe (VERNEED) 0x804820c
|
||||
0x6fffffff (VERNEEDNUM) 1
|
||||
0x6ffffff0 (VERSYM) 0x8048202
|
||||
0x00000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rel.dyn' at offset 0x22c contains 1 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
08049568 00000106 R_386_GLOB_DAT 00000000 __gmon_start__
|
||||
|
||||
Relocation section '.rel.plt' at offset 0x234 contains 3 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
08049578 00000107 R_386_JUMP_SLOT 00000000 __gmon_start__
|
||||
0804957c 00000207 R_386_JUMP_SLOT 00000000 __libc_start_main
|
||||
08049580 00000307 R_386_JUMP_SLOT 00000000 puts
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 5 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
2: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (2)
|
||||
3: 00000000 399 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.0 (2)
|
||||
4: 08048478 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
|
||||
Symbol table '.symtab' contains 68 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 08048114 0 SECTION LOCAL DEFAULT 1
|
||||
2: 08048128 0 SECTION LOCAL DEFAULT 2
|
||||
3: 08048148 0 SECTION LOCAL DEFAULT 3
|
||||
4: 08048168 0 SECTION LOCAL DEFAULT 4
|
||||
5: 080481b8 0 SECTION LOCAL DEFAULT 5
|
||||
6: 08048202 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0804820c 0 SECTION LOCAL DEFAULT 7
|
||||
8: 0804822c 0 SECTION LOCAL DEFAULT 8
|
||||
9: 08048234 0 SECTION LOCAL DEFAULT 9
|
||||
10: 0804824c 0 SECTION LOCAL DEFAULT 10
|
||||
11: 08048264 0 SECTION LOCAL DEFAULT 11
|
||||
12: 080482b0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 08048458 0 SECTION LOCAL DEFAULT 13
|
||||
14: 08048474 0 SECTION LOCAL DEFAULT 14
|
||||
15: 08048488 0 SECTION LOCAL DEFAULT 15
|
||||
16: 0804948c 0 SECTION LOCAL DEFAULT 16
|
||||
17: 08049494 0 SECTION LOCAL DEFAULT 17
|
||||
18: 0804949c 0 SECTION LOCAL DEFAULT 18
|
||||
19: 080494a0 0 SECTION LOCAL DEFAULT 19
|
||||
20: 08049568 0 SECTION LOCAL DEFAULT 20
|
||||
21: 0804956c 0 SECTION LOCAL DEFAULT 21
|
||||
22: 08049584 0 SECTION LOCAL DEFAULT 22
|
||||
23: 08049588 0 SECTION LOCAL DEFAULT 23
|
||||
24: 00000000 0 SECTION LOCAL DEFAULT 24
|
||||
25: 080482d4 0 FUNC LOCAL DEFAULT 12 call_gmon_start
|
||||
26: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
27: 0804948c 0 OBJECT LOCAL DEFAULT 16 __CTOR_LIST__
|
||||
28: 08049494 0 OBJECT LOCAL DEFAULT 17 __DTOR_LIST__
|
||||
29: 0804949c 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
|
||||
30: 08049588 4 OBJECT LOCAL DEFAULT 23 dtor_idx.5805
|
||||
31: 0804958c 1 OBJECT LOCAL DEFAULT 23 completed.5803
|
||||
32: 08048300 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
|
||||
33: 08048360 0 FUNC LOCAL DEFAULT 12 frame_dummy
|
||||
34: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
35: 08049490 0 OBJECT LOCAL DEFAULT 16 __CTOR_END__
|
||||
36: 08048488 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
|
||||
37: 0804949c 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
|
||||
38: 08048430 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
|
||||
39: 00000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
40: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_start
|
||||
41: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __fini_array_end
|
||||
42: 0804956c 0 OBJECT LOCAL HIDDEN 21 _GLOBAL_OFFSET_TABLE_
|
||||
43: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_end
|
||||
44: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __fini_array_start
|
||||
45: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __init_array_end
|
||||
46: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __init_array_start
|
||||
47: 080494a0 0 OBJECT LOCAL HIDDEN 19 _DYNAMIC
|
||||
48: 08049584 0 NOTYPE WEAK DEFAULT 22 data_start
|
||||
49: 080483b0 5 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
|
||||
50: 080482b0 0 FUNC GLOBAL DEFAULT 12 _start
|
||||
51: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
52: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
53: 08048474 4 OBJECT GLOBAL DEFAULT 14 _fp_hw
|
||||
54: 08048458 0 FUNC GLOBAL DEFAULT 13 _fini
|
||||
55: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
56: 08048478 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
57: 08049584 0 NOTYPE GLOBAL DEFAULT 22 __data_start
|
||||
58: 0804847c 0 OBJECT GLOBAL HIDDEN 14 __dso_handle
|
||||
59: 08049498 0 OBJECT GLOBAL HIDDEN 17 __DTOR_END__
|
||||
60: 080483c0 105 FUNC GLOBAL DEFAULT 12 __libc_csu_init
|
||||
61: 08049588 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
62: 08049590 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
63: 00000000 399 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.0
|
||||
64: 08049588 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
65: 08048429 0 FUNC GLOBAL HIDDEN 12 __i686.get_pc_thunk.bx
|
||||
66: 08048384 43 FUNC GLOBAL DEFAULT 12 main
|
||||
67: 0804824c 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Histogram for `.gnu.hash' bucket list length (total of 2 buckets):
|
||||
Length Number % of total Coverage
|
||||
0 1 ( 50.0%)
|
||||
1 1 ( 50.0%) 100.0%
|
||||
|
||||
Version symbols section '.gnu.version' contains 5 entries:
|
||||
Addr: 0000000008048202 Offset: 0x000202 Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 0 (*local*) 2 (GLIBC_2.0) 2 (GLIBC_2.0)
|
||||
004: 1 (*global*)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 1 entries:
|
||||
Addr: 0x000000000804820c Offset: 0x00020c Link to section: 5 (.dynstr)
|
||||
000000: Version: 1 File: libc.so.6 Cnt: 1
|
||||
0x0010: Name: GLIBC_2.0 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x00000128 with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_VERSION (version)
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: Intel 80386
|
||||
Version: 0x1
|
||||
Entry point address: 0x80482b0
|
||||
Start of program headers: 52 (bytes into file)
|
||||
Start of section headers: 1912 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 32 (bytes)
|
||||
Number of program headers: 7
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 28
|
||||
Section header string table index: 25
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .interp PROGBITS 08048114 000114 000013 00 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 08048128 000128 000020 00 A 0 0 4
|
||||
[ 3] .gnu.hash GNU_HASH 08048148 000148 000020 04 A 4 0 4
|
||||
[ 4] .dynsym DYNSYM 08048168 000168 000050 10 A 5 1 4
|
||||
[ 5] .dynstr STRTAB 080481b8 0001b8 00004a 00 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 08048202 000202 00000a 02 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 0804820c 00020c 000020 00 A 5 1 4
|
||||
[ 8] .rel.dyn REL 0804822c 00022c 000008 08 A 4 0 4
|
||||
[ 9] .rel.plt REL 08048234 000234 000018 08 A 4 11 4
|
||||
[10] .init PROGBITS 0804824c 00024c 000017 00 AX 0 0 4
|
||||
[11] .plt PROGBITS 08048264 000264 000040 04 AX 0 0 4
|
||||
[12] .text PROGBITS 080482b0 0002b0 0001a8 00 AX 0 0 16
|
||||
[13] .fini PROGBITS 08048458 000458 00001c 00 AX 0 0 4
|
||||
[14] .rodata PROGBITS 08048474 000474 000012 00 A 0 0 4
|
||||
[15] .eh_frame PROGBITS 08048488 000488 000004 00 A 0 0 4
|
||||
[16] .ctors PROGBITS 0804948c 00048c 000008 00 WA 0 0 4
|
||||
[17] .dtors PROGBITS 08049494 000494 000008 00 WA 0 0 4
|
||||
[18] .jcr PROGBITS 0804949c 00049c 000004 00 WA 0 0 4
|
||||
[19] .dynamic DYNAMIC 080494a0 0004a0 0000c8 08 WA 5 0 4
|
||||
[20] .got PROGBITS 08049568 000568 000004 04 WA 0 0 4
|
||||
[21] .got.plt PROGBITS 0804956c 00056c 000018 04 WA 0 0 4
|
||||
[22] .data PROGBITS 08049584 000584 000004 00 WA 0 0 4
|
||||
[23] .bss NOBITS 08049588 000588 000008 00 WA 0 0 4
|
||||
[24] .comment PROGBITS 00000000 000588 000114 00 0 0 1
|
||||
[25] .shstrtab STRTAB 00000000 00069c 0000db 00 0 0 1
|
||||
[26] .symtab SYMTAB 00000000 000bd8 000440 10 27 48 4
|
||||
[27] .strtab STRTAB 00000000 001018 000259 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
PHDR 0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
|
||||
INTERP 0x000114 0x08048114 0x08048114 0x00013 0x00013 R 0x1
|
||||
[Requesting program interpreter: /lib/ld-linux.so.2]
|
||||
LOAD 0x000000 0x08048000 0x08048000 0x0048c 0x0048c R E 0x1000
|
||||
LOAD 0x00048c 0x0804948c 0x0804948c 0x000fc 0x00104 RW 0x1000
|
||||
DYNAMIC 0x0004a0 0x080494a0 0x080494a0 0x000c8 0x000c8 RW 0x4
|
||||
NOTE 0x000128 0x08048128 0x08048128 0x00020 0x00020 R 0x4
|
||||
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
|
||||
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06
|
||||
|
||||
Dynamic section at offset 0x4a0 contains 20 entries:
|
||||
Tag Type Name/Value
|
||||
0x00000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x0000000c (INIT) 0x804824c
|
||||
0x0000000d (FINI) 0x8048458
|
||||
0x6ffffef5 (GNU_HASH) 0x8048148
|
||||
0x00000005 (STRTAB) 0x80481b8
|
||||
0x00000006 (SYMTAB) 0x8048168
|
||||
0x0000000a (STRSZ) 74 (bytes)
|
||||
0x0000000b (SYMENT) 16 (bytes)
|
||||
0x00000015 (DEBUG) 0x0
|
||||
0x00000003 (PLTGOT) 0x804956c
|
||||
0x00000002 (PLTRELSZ) 24 (bytes)
|
||||
0x00000014 (PLTREL) REL
|
||||
0x00000017 (JMPREL) 0x8048234
|
||||
0x00000011 (REL) 0x804822c
|
||||
0x00000012 (RELSZ) 8 (bytes)
|
||||
0x00000013 (RELENT) 8 (bytes)
|
||||
0x6ffffffe (VERNEED) 0x804820c
|
||||
0x6fffffff (VERNEEDNUM) 1
|
||||
0x6ffffff0 (VERSYM) 0x8048202
|
||||
0x00000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rel.dyn' at offset 0x22c contains 1 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
08049568 00000106 R_386_GLOB_DAT 00000000 __gmon_start__
|
||||
|
||||
Relocation section '.rel.plt' at offset 0x234 contains 3 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
08049578 00000107 R_386_JUMP_SLOT 00000000 __gmon_start__
|
||||
0804957c 00000207 R_386_JUMP_SLOT 00000000 __libc_start_main
|
||||
08049580 00000307 R_386_JUMP_SLOT 00000000 puts
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 5 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
2: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (2)
|
||||
3: 00000000 399 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.0 (2)
|
||||
4: 08048478 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
|
||||
Symbol table '.symtab' contains 68 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 08048114 0 SECTION LOCAL DEFAULT 1
|
||||
2: 08048128 0 SECTION LOCAL DEFAULT 2
|
||||
3: 08048148 0 SECTION LOCAL DEFAULT 3
|
||||
4: 08048168 0 SECTION LOCAL DEFAULT 4
|
||||
5: 080481b8 0 SECTION LOCAL DEFAULT 5
|
||||
6: 08048202 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0804820c 0 SECTION LOCAL DEFAULT 7
|
||||
8: 0804822c 0 SECTION LOCAL DEFAULT 8
|
||||
9: 08048234 0 SECTION LOCAL DEFAULT 9
|
||||
10: 0804824c 0 SECTION LOCAL DEFAULT 10
|
||||
11: 08048264 0 SECTION LOCAL DEFAULT 11
|
||||
12: 080482b0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 08048458 0 SECTION LOCAL DEFAULT 13
|
||||
14: 08048474 0 SECTION LOCAL DEFAULT 14
|
||||
15: 08048488 0 SECTION LOCAL DEFAULT 15
|
||||
16: 0804948c 0 SECTION LOCAL DEFAULT 16
|
||||
17: 08049494 0 SECTION LOCAL DEFAULT 17
|
||||
18: 0804949c 0 SECTION LOCAL DEFAULT 18
|
||||
19: 080494a0 0 SECTION LOCAL DEFAULT 19
|
||||
20: 08049568 0 SECTION LOCAL DEFAULT 20
|
||||
21: 0804956c 0 SECTION LOCAL DEFAULT 21
|
||||
22: 08049584 0 SECTION LOCAL DEFAULT 22
|
||||
23: 08049588 0 SECTION LOCAL DEFAULT 23
|
||||
24: 00000000 0 SECTION LOCAL DEFAULT 24
|
||||
25: 080482d4 0 FUNC LOCAL DEFAULT 12 call_gmon_start
|
||||
26: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
27: 0804948c 0 OBJECT LOCAL DEFAULT 16 __CTOR_LIST__
|
||||
28: 08049494 0 OBJECT LOCAL DEFAULT 17 __DTOR_LIST__
|
||||
29: 0804949c 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
|
||||
30: 08049588 4 OBJECT LOCAL DEFAULT 23 dtor_idx.5805
|
||||
31: 0804958c 1 OBJECT LOCAL DEFAULT 23 completed.5803
|
||||
32: 08048300 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
|
||||
33: 08048360 0 FUNC LOCAL DEFAULT 12 frame_dummy
|
||||
34: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
35: 08049490 0 OBJECT LOCAL DEFAULT 16 __CTOR_END__
|
||||
36: 08048488 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
|
||||
37: 0804949c 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
|
||||
38: 08048430 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
|
||||
39: 00000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
40: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_start
|
||||
41: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __fini_array_end
|
||||
42: 0804956c 0 OBJECT LOCAL HIDDEN 21 _GLOBAL_OFFSET_TABLE_
|
||||
43: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_end
|
||||
44: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __fini_array_start
|
||||
45: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __init_array_end
|
||||
46: 0804948c 0 NOTYPE LOCAL HIDDEN 16 __init_array_start
|
||||
47: 080494a0 0 OBJECT LOCAL HIDDEN 19 _DYNAMIC
|
||||
48: 08049584 0 NOTYPE WEAK DEFAULT 22 data_start
|
||||
49: 080483b0 5 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
|
||||
50: 080482b0 0 FUNC GLOBAL DEFAULT 12 _start
|
||||
51: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
52: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
53: 08048474 4 OBJECT GLOBAL DEFAULT 14 _fp_hw
|
||||
54: 08048458 0 FUNC GLOBAL DEFAULT 13 _fini
|
||||
55: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
56: 08048478 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
57: 08049584 0 NOTYPE GLOBAL DEFAULT 22 __data_start
|
||||
58: 0804847c 0 OBJECT GLOBAL HIDDEN 14 __dso_handle
|
||||
59: 08049498 0 OBJECT GLOBAL HIDDEN 17 __DTOR_END__
|
||||
60: 080483c0 105 FUNC GLOBAL DEFAULT 12 __libc_csu_init
|
||||
61: 08049588 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
62: 08049590 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
63: 00000000 399 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.0
|
||||
64: 08049588 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
65: 08048429 0 FUNC GLOBAL HIDDEN 12 __i686.get_pc_thunk.bx
|
||||
66: 08048384 43 FUNC GLOBAL DEFAULT 12 main
|
||||
67: 0804824c 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Histogram for `.gnu.hash' bucket list length (total of 2 buckets):
|
||||
Length Number % of total Coverage
|
||||
0 1 ( 50.0%)
|
||||
1 1 ( 50.0%) 100.0%
|
||||
|
||||
Version symbols section '.gnu.version' contains 5 entries:
|
||||
Addr: 0000000008048202 Offset: 0x000202 Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 0 (*local*) 2 (GLIBC_2.0) 2 (GLIBC_2.0)
|
||||
004: 1 (*global*)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 1 entries:
|
||||
Addr: 0x000000000804820c Offset: 0x00020c Link to section: 5 (.dynstr)
|
||||
000000: Version: 1 File: libc.so.6 Cnt: 1
|
||||
0x0010: Name: GLIBC_2.0 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x00000128 with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_VERSION (version)
|
||||
|
@ -1,64 +1,64 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: Intel 80386
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 232 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 11
|
||||
Section header string table index: 8
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .text PROGBITS 00000000 000034 00002b 00 AX 0 0 4
|
||||
[ 2] .rel.text REL 00000000 000354 000010 08 9 1 4
|
||||
[ 3] .data PROGBITS 00000000 000060 000000 00 WA 0 0 4
|
||||
[ 4] .bss NOBITS 00000000 000060 000000 00 WA 0 0 4
|
||||
[ 5] .rodata PROGBITS 00000000 000060 000006 00 A 0 0 1
|
||||
[ 6] .comment PROGBITS 00000000 000066 00002e 00 0 0 1
|
||||
[ 7] .note.GNU-stack PROGBITS 00000000 000094 000000 00 0 0 1
|
||||
[ 8] .shstrtab STRTAB 00000000 000094 000051 00 0 0 1
|
||||
[ 9] .symtab SYMTAB 00000000 0002a0 0000a0 10 10 8 4
|
||||
[10] .strtab STRTAB 00000000 000340 000013 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rel.text' at offset 0x354 contains 2 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
00000014 00000501 R_386_32 00000000 .rodata
|
||||
00000019 00000902 R_386_PC32 00000000 puts
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 10 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
2: 00000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 00000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 00000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 00000000 0 SECTION LOCAL DEFAULT 7
|
||||
7: 00000000 0 SECTION LOCAL DEFAULT 6
|
||||
8: 00000000 43 FUNC GLOBAL DEFAULT 1 main
|
||||
9: 00000000 0 NOTYPE GLOBAL DEFAULT UND puts
|
||||
|
||||
No version information found in this file.
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: Intel 80386
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 232 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 11
|
||||
Section header string table index: 8
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .text PROGBITS 00000000 000034 00002b 00 AX 0 0 4
|
||||
[ 2] .rel.text REL 00000000 000354 000010 08 9 1 4
|
||||
[ 3] .data PROGBITS 00000000 000060 000000 00 WA 0 0 4
|
||||
[ 4] .bss NOBITS 00000000 000060 000000 00 WA 0 0 4
|
||||
[ 5] .rodata PROGBITS 00000000 000060 000006 00 A 0 0 1
|
||||
[ 6] .comment PROGBITS 00000000 000066 00002e 00 0 0 1
|
||||
[ 7] .note.GNU-stack PROGBITS 00000000 000094 000000 00 0 0 1
|
||||
[ 8] .shstrtab STRTAB 00000000 000094 000051 00 0 0 1
|
||||
[ 9] .symtab SYMTAB 00000000 0002a0 0000a0 10 10 8 4
|
||||
[10] .strtab STRTAB 00000000 000340 000013 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rel.text' at offset 0x354 contains 2 entries:
|
||||
Offset Info Type Sym.Value Sym. Name
|
||||
00000014 00000501 R_386_32 00000000 .rodata
|
||||
00000019 00000902 R_386_PC32 00000000 puts
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 10 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
2: 00000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 00000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 00000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 00000000 0 SECTION LOCAL DEFAULT 7
|
||||
7: 00000000 0 SECTION LOCAL DEFAULT 6
|
||||
8: 00000000 43 FUNC GLOBAL DEFAULT 1 main
|
||||
9: 00000000 0 NOTYPE GLOBAL DEFAULT UND puts
|
||||
|
||||
No version information found in this file.
|
||||
|
@ -1,244 +1,244 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF64
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: Advanced Micro Devices X86-64
|
||||
Version: 0x1
|
||||
Entry point address: 0x4003c0
|
||||
Start of program headers: 64 (bytes into file)
|
||||
Start of section headers: 2656 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 64 (bytes)
|
||||
Size of program headers: 56 (bytes)
|
||||
Number of program headers: 8
|
||||
Size of section headers: 64 (bytes)
|
||||
Number of section headers: 29
|
||||
Section header string table index: 26
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Address Offset
|
||||
Size EntSize Flags Link Info Align
|
||||
[ 0] NULL 0000000000000000 00000000
|
||||
0000000000000000 0000000000000000 0 0 0
|
||||
[ 1] .interp PROGBITS 0000000000400200 00000200
|
||||
000000000000001c 0000000000000000 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 000000000040021c 0000021c
|
||||
0000000000000020 0000000000000000 A 0 0 4
|
||||
[ 3] .gnu.hash GNU_HASH 0000000000400240 00000240
|
||||
000000000000001c 0000000000000000 A 4 0 8
|
||||
[ 4] .dynsym DYNSYM 0000000000400260 00000260
|
||||
0000000000000060 0000000000000018 A 5 1 8
|
||||
[ 5] .dynstr STRTAB 00000000004002c0 000002c0
|
||||
000000000000003d 0000000000000000 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 00000000004002fe 000002fe
|
||||
0000000000000008 0000000000000002 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 0000000000400308 00000308
|
||||
0000000000000020 0000000000000000 A 5 1 8
|
||||
[ 8] .rela.dyn RELA 0000000000400328 00000328
|
||||
0000000000000018 0000000000000018 A 4 0 8
|
||||
[ 9] .rela.plt RELA 0000000000400340 00000340
|
||||
0000000000000030 0000000000000018 A 4 11 8
|
||||
[10] .init PROGBITS 0000000000400370 00000370
|
||||
0000000000000018 0000000000000000 AX 0 0 4
|
||||
[11] .plt PROGBITS 0000000000400388 00000388
|
||||
0000000000000030 0000000000000010 AX 0 0 4
|
||||
[12] .text PROGBITS 00000000004003c0 000003c0
|
||||
00000000000001c8 0000000000000000 AX 0 0 16
|
||||
[13] .fini PROGBITS 0000000000400588 00000588
|
||||
000000000000000e 0000000000000000 AX 0 0 4
|
||||
[14] .rodata PROGBITS 0000000000400598 00000598
|
||||
0000000000000016 0000000000000000 A 0 0 8
|
||||
[15] .eh_frame_hdr PROGBITS 00000000004005b0 000005b0
|
||||
0000000000000024 0000000000000000 A 0 0 4
|
||||
[16] .eh_frame PROGBITS 00000000004005d8 000005d8
|
||||
0000000000000094 0000000000000000 A 0 0 8
|
||||
[17] .ctors PROGBITS 0000000000600670 00000670
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[18] .dtors PROGBITS 0000000000600680 00000680
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[19] .jcr PROGBITS 0000000000600690 00000690
|
||||
0000000000000008 0000000000000000 WA 0 0 8
|
||||
[20] .dynamic DYNAMIC 0000000000600698 00000698
|
||||
0000000000000190 0000000000000010 WA 5 0 8
|
||||
[21] .got PROGBITS 0000000000600828 00000828
|
||||
0000000000000008 0000000000000008 WA 0 0 8
|
||||
[22] .got.plt PROGBITS 0000000000600830 00000830
|
||||
0000000000000028 0000000000000008 WA 0 0 8
|
||||
[23] .data PROGBITS 0000000000600858 00000858
|
||||
0000000000000004 0000000000000000 WA 0 0 4
|
||||
[24] .bss NOBITS 0000000000600860 0000085c
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[25] .comment PROGBITS 0000000000000000 0000085c
|
||||
0000000000000114 0000000000000000 0 0 1
|
||||
[26] .shstrtab STRTAB 0000000000000000 00000970
|
||||
00000000000000eb 0000000000000000 0 0 1
|
||||
[27] .symtab SYMTAB 0000000000000000 000011a0
|
||||
0000000000000648 0000000000000018 28 49 8
|
||||
[28] .strtab STRTAB 0000000000000000 000017e8
|
||||
000000000000023f 0000000000000000 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr
|
||||
FileSiz MemSiz Flags Align
|
||||
PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040
|
||||
0x00000000000001c0 0x00000000000001c0 R E 8
|
||||
INTERP 0x0000000000000200 0x0000000000400200 0x0000000000400200
|
||||
0x000000000000001c 0x000000000000001c R 1
|
||||
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
|
||||
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
|
||||
0x000000000000066c 0x000000000000066c R E 200000
|
||||
LOAD 0x0000000000000670 0x0000000000600670 0x0000000000600670
|
||||
0x00000000000001ec 0x0000000000000200 RW 200000
|
||||
DYNAMIC 0x0000000000000698 0x0000000000600698 0x0000000000600698
|
||||
0x0000000000000190 0x0000000000000190 RW 8
|
||||
NOTE 0x000000000000021c 0x000000000040021c 0x000000000040021c
|
||||
0x0000000000000020 0x0000000000000020 R 4
|
||||
GNU_EH_FRAME 0x00000000000005b0 0x00000000004005b0 0x00000000004005b0
|
||||
0x0000000000000024 0x0000000000000024 R 4
|
||||
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
|
||||
0x0000000000000000 0x0000000000000000 RW 8
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
|
||||
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06 .eh_frame_hdr
|
||||
07
|
||||
|
||||
Dynamic section at offset 0x698 contains 20 entries:
|
||||
Tag Type Name/Value
|
||||
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x000000000000000c (INIT) 0x400370
|
||||
0x000000000000000d (FINI) 0x400588
|
||||
0x000000006ffffef5 (GNU_HASH) 0x400240
|
||||
0x0000000000000005 (STRTAB) 0x4002c0
|
||||
0x0000000000000006 (SYMTAB) 0x400260
|
||||
0x000000000000000a (STRSZ) 61 (bytes)
|
||||
0x000000000000000b (SYMENT) 24 (bytes)
|
||||
0x0000000000000015 (DEBUG) 0x0
|
||||
0x0000000000000003 (PLTGOT) 0x600830
|
||||
0x0000000000000002 (PLTRELSZ) 48 (bytes)
|
||||
0x0000000000000014 (PLTREL) RELA
|
||||
0x0000000000000017 (JMPREL) 0x400340
|
||||
0x0000000000000007 (RELA) 0x400328
|
||||
0x0000000000000008 (RELASZ) 24 (bytes)
|
||||
0x0000000000000009 (RELAENT) 24 (bytes)
|
||||
0x000000006ffffffe (VERNEED) 0x400308
|
||||
0x000000006fffffff (VERNEEDNUM) 1
|
||||
0x000000006ffffff0 (VERSYM) 0x4002fe
|
||||
0x0000000000000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rela.dyn' at offset 0x328 contains 1 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000600828 000100000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
|
||||
|
||||
Relocation section '.rela.plt' at offset 0x340 contains 2 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000600848 000200000007 R_X86_64_JUMP_SLO 0000000000000000 puts + 0
|
||||
000000600850 000300000007 R_X86_64_JUMP_SLO 0000000000000000 __libc_start_main + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 4 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
2: 0000000000000000 396 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
|
||||
3: 0000000000000000 421 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
|
||||
|
||||
Symbol table '.symtab' contains 67 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000400200 0 SECTION LOCAL DEFAULT 1
|
||||
2: 000000000040021c 0 SECTION LOCAL DEFAULT 2
|
||||
3: 0000000000400240 0 SECTION LOCAL DEFAULT 3
|
||||
4: 0000000000400260 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000004002c0 0 SECTION LOCAL DEFAULT 5
|
||||
6: 00000000004002fe 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0000000000400308 0 SECTION LOCAL DEFAULT 7
|
||||
8: 0000000000400328 0 SECTION LOCAL DEFAULT 8
|
||||
9: 0000000000400340 0 SECTION LOCAL DEFAULT 9
|
||||
10: 0000000000400370 0 SECTION LOCAL DEFAULT 10
|
||||
11: 0000000000400388 0 SECTION LOCAL DEFAULT 11
|
||||
12: 00000000004003c0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 0000000000400588 0 SECTION LOCAL DEFAULT 13
|
||||
14: 0000000000400598 0 SECTION LOCAL DEFAULT 14
|
||||
15: 00000000004005b0 0 SECTION LOCAL DEFAULT 15
|
||||
16: 00000000004005d8 0 SECTION LOCAL DEFAULT 16
|
||||
17: 0000000000600670 0 SECTION LOCAL DEFAULT 17
|
||||
18: 0000000000600680 0 SECTION LOCAL DEFAULT 18
|
||||
19: 0000000000600690 0 SECTION LOCAL DEFAULT 19
|
||||
20: 0000000000600698 0 SECTION LOCAL DEFAULT 20
|
||||
21: 0000000000600828 0 SECTION LOCAL DEFAULT 21
|
||||
22: 0000000000600830 0 SECTION LOCAL DEFAULT 22
|
||||
23: 0000000000600858 0 SECTION LOCAL DEFAULT 23
|
||||
24: 0000000000600860 0 SECTION LOCAL DEFAULT 24
|
||||
25: 0000000000000000 0 SECTION LOCAL DEFAULT 25
|
||||
26: 00000000004003ec 0 FUNC LOCAL DEFAULT 12 call_gmon_start
|
||||
27: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
28: 0000000000600670 0 OBJECT LOCAL DEFAULT 17 __CTOR_LIST__
|
||||
29: 0000000000600680 0 OBJECT LOCAL DEFAULT 18 __DTOR_LIST__
|
||||
30: 0000000000600690 0 OBJECT LOCAL DEFAULT 19 __JCR_LIST__
|
||||
31: 0000000000600860 8 OBJECT LOCAL DEFAULT 24 dtor_idx.6147
|
||||
32: 0000000000600868 1 OBJECT LOCAL DEFAULT 24 completed.6145
|
||||
33: 0000000000400410 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
|
||||
34: 0000000000400470 0 FUNC LOCAL DEFAULT 12 frame_dummy
|
||||
35: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
36: 0000000000600678 0 OBJECT LOCAL DEFAULT 17 __CTOR_END__
|
||||
37: 0000000000400668 0 OBJECT LOCAL DEFAULT 16 __FRAME_END__
|
||||
38: 0000000000600690 0 OBJECT LOCAL DEFAULT 19 __JCR_END__
|
||||
39: 0000000000400550 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
|
||||
40: 0000000000000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
41: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __preinit_array_start
|
||||
42: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __fini_array_end
|
||||
43: 0000000000600830 0 OBJECT LOCAL HIDDEN 22 _GLOBAL_OFFSET_TABLE_
|
||||
44: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __preinit_array_end
|
||||
45: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __fini_array_start
|
||||
46: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __init_array_end
|
||||
47: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __init_array_start
|
||||
48: 0000000000600698 0 OBJECT LOCAL HIDDEN 20 _DYNAMIC
|
||||
49: 0000000000600858 0 NOTYPE WEAK DEFAULT 23 data_start
|
||||
50: 00000000004004b0 2 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
|
||||
51: 00000000004003c0 0 FUNC GLOBAL DEFAULT 12 _start
|
||||
52: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
53: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
54: 0000000000000000 396 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5
|
||||
55: 0000000000400588 0 FUNC GLOBAL DEFAULT 13 _fini
|
||||
56: 0000000000000000 421 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
57: 0000000000400598 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
58: 0000000000600858 0 NOTYPE GLOBAL DEFAULT 23 __data_start
|
||||
59: 00000000004005a0 0 OBJECT GLOBAL HIDDEN 14 __dso_handle
|
||||
60: 0000000000600688 0 OBJECT GLOBAL HIDDEN 18 __DTOR_END__
|
||||
61: 00000000004004c0 139 FUNC GLOBAL DEFAULT 12 __libc_csu_init
|
||||
62: 000000000060085c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
63: 0000000000600870 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
64: 000000000060085c 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
65: 0000000000400498 21 FUNC GLOBAL DEFAULT 12 main
|
||||
66: 0000000000400370 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Version symbols section '.gnu.version' contains 4 entries:
|
||||
Addr: 00000000004002fe Offset: 0x0002fe Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 0 (*local*) 2 (GLIBC_2.2.5) 2 (GLIBC_2.2.5)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 1 entries:
|
||||
Addr: 0x0000000000400308 Offset: 0x000308 Link to section: 5 (.dynstr)
|
||||
000000: Version: 1 File: libc.so.6 Cnt: 1
|
||||
0x0010: Name: GLIBC_2.2.5 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x0000021c with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_VERSION (version)
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF64
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: Advanced Micro Devices X86-64
|
||||
Version: 0x1
|
||||
Entry point address: 0x4003c0
|
||||
Start of program headers: 64 (bytes into file)
|
||||
Start of section headers: 2656 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 64 (bytes)
|
||||
Size of program headers: 56 (bytes)
|
||||
Number of program headers: 8
|
||||
Size of section headers: 64 (bytes)
|
||||
Number of section headers: 29
|
||||
Section header string table index: 26
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Address Offset
|
||||
Size EntSize Flags Link Info Align
|
||||
[ 0] NULL 0000000000000000 00000000
|
||||
0000000000000000 0000000000000000 0 0 0
|
||||
[ 1] .interp PROGBITS 0000000000400200 00000200
|
||||
000000000000001c 0000000000000000 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 000000000040021c 0000021c
|
||||
0000000000000020 0000000000000000 A 0 0 4
|
||||
[ 3] .gnu.hash GNU_HASH 0000000000400240 00000240
|
||||
000000000000001c 0000000000000000 A 4 0 8
|
||||
[ 4] .dynsym DYNSYM 0000000000400260 00000260
|
||||
0000000000000060 0000000000000018 A 5 1 8
|
||||
[ 5] .dynstr STRTAB 00000000004002c0 000002c0
|
||||
000000000000003d 0000000000000000 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 00000000004002fe 000002fe
|
||||
0000000000000008 0000000000000002 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 0000000000400308 00000308
|
||||
0000000000000020 0000000000000000 A 5 1 8
|
||||
[ 8] .rela.dyn RELA 0000000000400328 00000328
|
||||
0000000000000018 0000000000000018 A 4 0 8
|
||||
[ 9] .rela.plt RELA 0000000000400340 00000340
|
||||
0000000000000030 0000000000000018 A 4 11 8
|
||||
[10] .init PROGBITS 0000000000400370 00000370
|
||||
0000000000000018 0000000000000000 AX 0 0 4
|
||||
[11] .plt PROGBITS 0000000000400388 00000388
|
||||
0000000000000030 0000000000000010 AX 0 0 4
|
||||
[12] .text PROGBITS 00000000004003c0 000003c0
|
||||
00000000000001c8 0000000000000000 AX 0 0 16
|
||||
[13] .fini PROGBITS 0000000000400588 00000588
|
||||
000000000000000e 0000000000000000 AX 0 0 4
|
||||
[14] .rodata PROGBITS 0000000000400598 00000598
|
||||
0000000000000016 0000000000000000 A 0 0 8
|
||||
[15] .eh_frame_hdr PROGBITS 00000000004005b0 000005b0
|
||||
0000000000000024 0000000000000000 A 0 0 4
|
||||
[16] .eh_frame PROGBITS 00000000004005d8 000005d8
|
||||
0000000000000094 0000000000000000 A 0 0 8
|
||||
[17] .ctors PROGBITS 0000000000600670 00000670
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[18] .dtors PROGBITS 0000000000600680 00000680
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[19] .jcr PROGBITS 0000000000600690 00000690
|
||||
0000000000000008 0000000000000000 WA 0 0 8
|
||||
[20] .dynamic DYNAMIC 0000000000600698 00000698
|
||||
0000000000000190 0000000000000010 WA 5 0 8
|
||||
[21] .got PROGBITS 0000000000600828 00000828
|
||||
0000000000000008 0000000000000008 WA 0 0 8
|
||||
[22] .got.plt PROGBITS 0000000000600830 00000830
|
||||
0000000000000028 0000000000000008 WA 0 0 8
|
||||
[23] .data PROGBITS 0000000000600858 00000858
|
||||
0000000000000004 0000000000000000 WA 0 0 4
|
||||
[24] .bss NOBITS 0000000000600860 0000085c
|
||||
0000000000000010 0000000000000000 WA 0 0 8
|
||||
[25] .comment PROGBITS 0000000000000000 0000085c
|
||||
0000000000000114 0000000000000000 0 0 1
|
||||
[26] .shstrtab STRTAB 0000000000000000 00000970
|
||||
00000000000000eb 0000000000000000 0 0 1
|
||||
[27] .symtab SYMTAB 0000000000000000 000011a0
|
||||
0000000000000648 0000000000000018 28 49 8
|
||||
[28] .strtab STRTAB 0000000000000000 000017e8
|
||||
000000000000023f 0000000000000000 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr
|
||||
FileSiz MemSiz Flags Align
|
||||
PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040
|
||||
0x00000000000001c0 0x00000000000001c0 R E 8
|
||||
INTERP 0x0000000000000200 0x0000000000400200 0x0000000000400200
|
||||
0x000000000000001c 0x000000000000001c R 1
|
||||
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
|
||||
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
|
||||
0x000000000000066c 0x000000000000066c R E 200000
|
||||
LOAD 0x0000000000000670 0x0000000000600670 0x0000000000600670
|
||||
0x00000000000001ec 0x0000000000000200 RW 200000
|
||||
DYNAMIC 0x0000000000000698 0x0000000000600698 0x0000000000600698
|
||||
0x0000000000000190 0x0000000000000190 RW 8
|
||||
NOTE 0x000000000000021c 0x000000000040021c 0x000000000040021c
|
||||
0x0000000000000020 0x0000000000000020 R 4
|
||||
GNU_EH_FRAME 0x00000000000005b0 0x00000000004005b0 0x00000000004005b0
|
||||
0x0000000000000024 0x0000000000000024 R 4
|
||||
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
|
||||
0x0000000000000000 0x0000000000000000 RW 8
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
|
||||
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06 .eh_frame_hdr
|
||||
07
|
||||
|
||||
Dynamic section at offset 0x698 contains 20 entries:
|
||||
Tag Type Name/Value
|
||||
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x000000000000000c (INIT) 0x400370
|
||||
0x000000000000000d (FINI) 0x400588
|
||||
0x000000006ffffef5 (GNU_HASH) 0x400240
|
||||
0x0000000000000005 (STRTAB) 0x4002c0
|
||||
0x0000000000000006 (SYMTAB) 0x400260
|
||||
0x000000000000000a (STRSZ) 61 (bytes)
|
||||
0x000000000000000b (SYMENT) 24 (bytes)
|
||||
0x0000000000000015 (DEBUG) 0x0
|
||||
0x0000000000000003 (PLTGOT) 0x600830
|
||||
0x0000000000000002 (PLTRELSZ) 48 (bytes)
|
||||
0x0000000000000014 (PLTREL) RELA
|
||||
0x0000000000000017 (JMPREL) 0x400340
|
||||
0x0000000000000007 (RELA) 0x400328
|
||||
0x0000000000000008 (RELASZ) 24 (bytes)
|
||||
0x0000000000000009 (RELAENT) 24 (bytes)
|
||||
0x000000006ffffffe (VERNEED) 0x400308
|
||||
0x000000006fffffff (VERNEEDNUM) 1
|
||||
0x000000006ffffff0 (VERSYM) 0x4002fe
|
||||
0x0000000000000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rela.dyn' at offset 0x328 contains 1 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000600828 000100000006 R_X86_64_GLOB_DAT 0000000000000000 __gmon_start__ + 0
|
||||
|
||||
Relocation section '.rela.plt' at offset 0x340 contains 2 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000600848 000200000007 R_X86_64_JUMP_SLO 0000000000000000 puts + 0
|
||||
000000600850 000300000007 R_X86_64_JUMP_SLO 0000000000000000 __libc_start_main + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 4 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
2: 0000000000000000 396 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
|
||||
3: 0000000000000000 421 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.2.5 (2)
|
||||
|
||||
Symbol table '.symtab' contains 67 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000400200 0 SECTION LOCAL DEFAULT 1
|
||||
2: 000000000040021c 0 SECTION LOCAL DEFAULT 2
|
||||
3: 0000000000400240 0 SECTION LOCAL DEFAULT 3
|
||||
4: 0000000000400260 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000004002c0 0 SECTION LOCAL DEFAULT 5
|
||||
6: 00000000004002fe 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0000000000400308 0 SECTION LOCAL DEFAULT 7
|
||||
8: 0000000000400328 0 SECTION LOCAL DEFAULT 8
|
||||
9: 0000000000400340 0 SECTION LOCAL DEFAULT 9
|
||||
10: 0000000000400370 0 SECTION LOCAL DEFAULT 10
|
||||
11: 0000000000400388 0 SECTION LOCAL DEFAULT 11
|
||||
12: 00000000004003c0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 0000000000400588 0 SECTION LOCAL DEFAULT 13
|
||||
14: 0000000000400598 0 SECTION LOCAL DEFAULT 14
|
||||
15: 00000000004005b0 0 SECTION LOCAL DEFAULT 15
|
||||
16: 00000000004005d8 0 SECTION LOCAL DEFAULT 16
|
||||
17: 0000000000600670 0 SECTION LOCAL DEFAULT 17
|
||||
18: 0000000000600680 0 SECTION LOCAL DEFAULT 18
|
||||
19: 0000000000600690 0 SECTION LOCAL DEFAULT 19
|
||||
20: 0000000000600698 0 SECTION LOCAL DEFAULT 20
|
||||
21: 0000000000600828 0 SECTION LOCAL DEFAULT 21
|
||||
22: 0000000000600830 0 SECTION LOCAL DEFAULT 22
|
||||
23: 0000000000600858 0 SECTION LOCAL DEFAULT 23
|
||||
24: 0000000000600860 0 SECTION LOCAL DEFAULT 24
|
||||
25: 0000000000000000 0 SECTION LOCAL DEFAULT 25
|
||||
26: 00000000004003ec 0 FUNC LOCAL DEFAULT 12 call_gmon_start
|
||||
27: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
28: 0000000000600670 0 OBJECT LOCAL DEFAULT 17 __CTOR_LIST__
|
||||
29: 0000000000600680 0 OBJECT LOCAL DEFAULT 18 __DTOR_LIST__
|
||||
30: 0000000000600690 0 OBJECT LOCAL DEFAULT 19 __JCR_LIST__
|
||||
31: 0000000000600860 8 OBJECT LOCAL DEFAULT 24 dtor_idx.6147
|
||||
32: 0000000000600868 1 OBJECT LOCAL DEFAULT 24 completed.6145
|
||||
33: 0000000000400410 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
|
||||
34: 0000000000400470 0 FUNC LOCAL DEFAULT 12 frame_dummy
|
||||
35: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
36: 0000000000600678 0 OBJECT LOCAL DEFAULT 17 __CTOR_END__
|
||||
37: 0000000000400668 0 OBJECT LOCAL DEFAULT 16 __FRAME_END__
|
||||
38: 0000000000600690 0 OBJECT LOCAL DEFAULT 19 __JCR_END__
|
||||
39: 0000000000400550 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
|
||||
40: 0000000000000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
41: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __preinit_array_start
|
||||
42: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __fini_array_end
|
||||
43: 0000000000600830 0 OBJECT LOCAL HIDDEN 22 _GLOBAL_OFFSET_TABLE_
|
||||
44: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __preinit_array_end
|
||||
45: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __fini_array_start
|
||||
46: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __init_array_end
|
||||
47: 000000000060066c 0 NOTYPE LOCAL HIDDEN 17 __init_array_start
|
||||
48: 0000000000600698 0 OBJECT LOCAL HIDDEN 20 _DYNAMIC
|
||||
49: 0000000000600858 0 NOTYPE WEAK DEFAULT 23 data_start
|
||||
50: 00000000004004b0 2 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
|
||||
51: 00000000004003c0 0 FUNC GLOBAL DEFAULT 12 _start
|
||||
52: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
53: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
54: 0000000000000000 396 FUNC GLOBAL DEFAULT UND puts@@GLIBC_2.2.5
|
||||
55: 0000000000400588 0 FUNC GLOBAL DEFAULT 13 _fini
|
||||
56: 0000000000000000 421 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
57: 0000000000400598 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
|
||||
58: 0000000000600858 0 NOTYPE GLOBAL DEFAULT 23 __data_start
|
||||
59: 00000000004005a0 0 OBJECT GLOBAL HIDDEN 14 __dso_handle
|
||||
60: 0000000000600688 0 OBJECT GLOBAL HIDDEN 18 __DTOR_END__
|
||||
61: 00000000004004c0 139 FUNC GLOBAL DEFAULT 12 __libc_csu_init
|
||||
62: 000000000060085c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
63: 0000000000600870 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
64: 000000000060085c 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
65: 0000000000400498 21 FUNC GLOBAL DEFAULT 12 main
|
||||
66: 0000000000400370 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Version symbols section '.gnu.version' contains 4 entries:
|
||||
Addr: 00000000004002fe Offset: 0x0002fe Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 0 (*local*) 2 (GLIBC_2.2.5) 2 (GLIBC_2.2.5)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 1 entries:
|
||||
Addr: 0x0000000000400308 Offset: 0x000308 Link to section: 5 (.dynstr)
|
||||
000000: Version: 1 File: libc.so.6 Cnt: 1
|
||||
0x0010: Name: GLIBC_2.2.5 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x0000021c with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_VERSION (version)
|
||||
|
@ -1,85 +1,85 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF64
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: Advanced Micro Devices X86-64
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 296 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 64 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 64 (bytes)
|
||||
Number of section headers: 13
|
||||
Section header string table index: 10
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Address Offset
|
||||
Size EntSize Flags Link Info Align
|
||||
[ 0] NULL 0000000000000000 00000000
|
||||
0000000000000000 0000000000000000 0 0 0
|
||||
[ 1] .text PROGBITS 0000000000000000 00000040
|
||||
0000000000000015 0000000000000000 AX 0 0 4
|
||||
[ 2] .rela.text RELA 0000000000000000 00000588
|
||||
0000000000000030 0000000000000018 11 1 8
|
||||
[ 3] .data PROGBITS 0000000000000000 00000058
|
||||
0000000000000000 0000000000000000 WA 0 0 4
|
||||
[ 4] .bss NOBITS 0000000000000000 00000058
|
||||
0000000000000000 0000000000000000 WA 0 0 4
|
||||
[ 5] .rodata PROGBITS 0000000000000000 00000058
|
||||
0000000000000006 0000000000000000 A 0 0 1
|
||||
[ 6] .eh_frame PROGBITS 0000000000000000 00000060
|
||||
0000000000000038 0000000000000000 A 0 0 8
|
||||
[ 7] .rela.eh_frame RELA 0000000000000000 000005b8
|
||||
0000000000000018 0000000000000018 11 6 8
|
||||
[ 8] .comment PROGBITS 0000000000000000 00000098
|
||||
000000000000002e 0000000000000000 0 0 1
|
||||
[ 9] .note.GNU-stack PROGBITS 0000000000000000 000000c6
|
||||
0000000000000000 0000000000000000 0 0 1
|
||||
[10] .shstrtab STRTAB 0000000000000000 000000c6
|
||||
0000000000000061 0000000000000000 0 0 1
|
||||
[11] .symtab SYMTAB 0000000000000000 00000468
|
||||
0000000000000108 0000000000000018 12 9 8
|
||||
[12] .strtab STRTAB 0000000000000000 00000570
|
||||
0000000000000013 0000000000000000 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rela.text' at offset 0x588 contains 2 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000000005 00050000000a R_X86_64_32 0000000000000000 .rodata + 0
|
||||
00000000000a 000a00000002 R_X86_64_PC32 0000000000000000 puts + fffffffffffffffc
|
||||
|
||||
Relocation section '.rela.eh_frame' at offset 0x5b8 contains 1 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000000020 00020000000a R_X86_64_32 0000000000000000 .text + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 11 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 0000000000000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 0000000000000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 0000000000000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 0000000000000000 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0000000000000000 0 SECTION LOCAL DEFAULT 9
|
||||
8: 0000000000000000 0 SECTION LOCAL DEFAULT 8
|
||||
9: 0000000000000000 21 FUNC GLOBAL DEFAULT 1 main
|
||||
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND puts
|
||||
|
||||
No version information found in this file.
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF64
|
||||
Data: 2's complement, little endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: Advanced Micro Devices X86-64
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 296 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 64 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 64 (bytes)
|
||||
Number of section headers: 13
|
||||
Section header string table index: 10
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Address Offset
|
||||
Size EntSize Flags Link Info Align
|
||||
[ 0] NULL 0000000000000000 00000000
|
||||
0000000000000000 0000000000000000 0 0 0
|
||||
[ 1] .text PROGBITS 0000000000000000 00000040
|
||||
0000000000000015 0000000000000000 AX 0 0 4
|
||||
[ 2] .rela.text RELA 0000000000000000 00000588
|
||||
0000000000000030 0000000000000018 11 1 8
|
||||
[ 3] .data PROGBITS 0000000000000000 00000058
|
||||
0000000000000000 0000000000000000 WA 0 0 4
|
||||
[ 4] .bss NOBITS 0000000000000000 00000058
|
||||
0000000000000000 0000000000000000 WA 0 0 4
|
||||
[ 5] .rodata PROGBITS 0000000000000000 00000058
|
||||
0000000000000006 0000000000000000 A 0 0 1
|
||||
[ 6] .eh_frame PROGBITS 0000000000000000 00000060
|
||||
0000000000000038 0000000000000000 A 0 0 8
|
||||
[ 7] .rela.eh_frame RELA 0000000000000000 000005b8
|
||||
0000000000000018 0000000000000018 11 6 8
|
||||
[ 8] .comment PROGBITS 0000000000000000 00000098
|
||||
000000000000002e 0000000000000000 0 0 1
|
||||
[ 9] .note.GNU-stack PROGBITS 0000000000000000 000000c6
|
||||
0000000000000000 0000000000000000 0 0 1
|
||||
[10] .shstrtab STRTAB 0000000000000000 000000c6
|
||||
0000000000000061 0000000000000000 0 0 1
|
||||
[11] .symtab SYMTAB 0000000000000000 00000468
|
||||
0000000000000108 0000000000000018 12 9 8
|
||||
[12] .strtab STRTAB 0000000000000000 00000570
|
||||
0000000000000013 0000000000000000 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rela.text' at offset 0x588 contains 2 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000000005 00050000000a R_X86_64_32 0000000000000000 .rodata + 0
|
||||
00000000000a 000a00000002 R_X86_64_PC32 0000000000000000 puts + fffffffffffffffc
|
||||
|
||||
Relocation section '.rela.eh_frame' at offset 0x5b8 contains 1 entries:
|
||||
Offset Info Type Sym. Value Sym. Name + Addend
|
||||
000000000020 00020000000a R_X86_64_32 0000000000000000 .text + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 11 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 0000000000000000 0 FILE LOCAL DEFAULT ABS hello.c
|
||||
2: 0000000000000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 0000000000000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 0000000000000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 0000000000000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 0000000000000000 0 SECTION LOCAL DEFAULT 6
|
||||
7: 0000000000000000 0 SECTION LOCAL DEFAULT 9
|
||||
8: 0000000000000000 0 SECTION LOCAL DEFAULT 8
|
||||
9: 0000000000000000 21 FUNC GLOBAL DEFAULT 1 main
|
||||
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND puts
|
||||
|
||||
No version information found in this file.
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,263 +1,263 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, big endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: PowerPC
|
||||
Version: 0x1
|
||||
Entry point address: 0x10000550
|
||||
Start of program headers: 52 (bytes into file)
|
||||
Start of section headers: 3484 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 32 (bytes)
|
||||
Number of program headers: 8
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 31
|
||||
Section header string table index: 28
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .interp PROGBITS 10000134 000134 00000d 00 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 10000144 000144 000020 00 A 0 0 4
|
||||
[ 3] .hash HASH 10000164 000164 000048 04 A 4 0 4
|
||||
[ 4] .dynsym DYNSYM 100001ac 0001ac 0000d0 10 A 5 1 4
|
||||
[ 5] .dynstr STRTAB 1000027c 00027c 000183 00 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 10000400 000400 00001a 02 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 1000041c 00041c 000060 00 A 5 2 4
|
||||
[ 8] .rela.dyn RELA 1000047c 00047c 000018 0c A 4 0 4
|
||||
[ 9] .rela.plt RELA 10000494 000494 00006c 0c A 4 22 4
|
||||
[10] .init PROGBITS 10000500 000500 00004c 00 AX 0 0 4
|
||||
[11] .text PROGBITS 10000550 000550 000480 00 AX 0 0 16
|
||||
[12] .fini PROGBITS 100009d0 0009d0 000038 00 AX 0 0 4
|
||||
[13] .rodata PROGBITS 10000a08 000a08 00001a 00 A 0 0 4
|
||||
[14] .eh_frame_hdr PROGBITS 10000a24 000a24 000024 00 A 0 0 4
|
||||
[15] .eh_frame PROGBITS 10000a48 000a48 000084 00 A 0 0 4
|
||||
[16] .ctors PROGBITS 10010acc 000acc 00000c 00 WA 0 0 4
|
||||
[17] .dtors PROGBITS 10010ad8 000ad8 000008 00 WA 0 0 4
|
||||
[18] .jcr PROGBITS 10010ae0 000ae0 000004 00 WA 0 0 4
|
||||
[19] .got2 PROGBITS 10010ae4 000ae4 000008 00 WA 0 0 1
|
||||
[20] .dynamic DYNAMIC 10010aec 000aec 0000e8 08 WA 5 0 4
|
||||
[21] .got PROGBITS 10010bd4 000bd4 000010 04 WA 0 0 4
|
||||
[22] .plt PROGBITS 10010be4 000be4 000024 00 WA 0 0 4
|
||||
[23] .data PROGBITS 10010c08 000c08 000004 00 WA 0 0 4
|
||||
[24] .bss NOBITS 10010c0c 000c0c 000098 00 WA 0 0 4
|
||||
[25] .comment PROGBITS 00000000 000c0c 000027 00 0 0 1
|
||||
[26] .debug_frame PROGBITS 00000000 000c34 000050 00 0 0 4
|
||||
[27] .gnu.attributes LOOS+ffffff5 00000000 000c84 000014 00 0 0 1
|
||||
[28] .shstrtab STRTAB 00000000 000c98 000101 00 0 0 1
|
||||
[29] .symtab SYMTAB 00000000 001274 000500 10 30 54 4
|
||||
[30] .strtab STRTAB 00000000 001774 0003cc 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
|
||||
INTERP 0x000134 0x10000134 0x10000134 0x0000d 0x0000d R 0x1
|
||||
[Requesting program interpreter: /lib/ld.so.1]
|
||||
LOAD 0x000000 0x10000000 0x10000000 0x00acc 0x00acc R E 0x10000
|
||||
LOAD 0x000acc 0x10010acc 0x10010acc 0x00140 0x001d8 RW 0x10000
|
||||
DYNAMIC 0x000aec 0x10010aec 0x10010aec 0x000e8 0x000e8 RW 0x4
|
||||
NOTE 0x000144 0x10000144 0x10000144 0x00020 0x00020 R 0x4
|
||||
GNU_EH_FRAME 0x000a24 0x10000a24 0x10000a24 0x00024 0x00024 R 0x4
|
||||
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata .eh_frame_hdr .eh_frame
|
||||
03 .ctors .dtors .jcr .got2 .dynamic .got .plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06 .eh_frame_hdr
|
||||
07
|
||||
|
||||
Dynamic section at offset 0xaec contains 24 entries:
|
||||
Tag Type Name/Value
|
||||
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libm.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x0000000c (INIT) 0x10000500
|
||||
0x0000000d (FINI) 0x100009d0
|
||||
0x00000004 (HASH) 0x10000164
|
||||
0x00000005 (STRTAB) 0x1000027c
|
||||
0x00000006 (SYMTAB) 0x100001ac
|
||||
0x0000000a (STRSZ) 387 (bytes)
|
||||
0x0000000b (SYMENT) 16 (bytes)
|
||||
0x00000015 (DEBUG) 0x0
|
||||
0x00000003 (PLTGOT) 0x10010be4
|
||||
0x00000002 (PLTRELSZ) 108 (bytes)
|
||||
0x00000014 (PLTREL) RELA
|
||||
0x00000017 (JMPREL) 0x10000494
|
||||
0x70000000 (PPC_GOT) 0x10010bd8
|
||||
0x00000007 (RELA) 0x1000047c
|
||||
0x00000008 (RELASZ) 132 (bytes)
|
||||
0x00000009 (RELAENT) 12 (bytes)
|
||||
0x6ffffffe (VERNEED) 0x1000041c
|
||||
0x6fffffff (VERNEEDNUM) 2
|
||||
0x6ffffff0 (VERSYM) 0x10000400
|
||||
0x00000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rela.dyn' at offset 0x47c contains 2 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
10010bd4 00000214 R_PPC_GLOB_DAT 00000000 __gmon_start__ + 0
|
||||
10010c0c 00000913 R_PPC_COPY 10010c0c _ZSt4cout + 0
|
||||
|
||||
Relocation section '.rela.plt' at offset 0x494 contains 9 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
10010be4 00000115 R_PPC_JMP_SLOT 100008e0 __cxa_atexit + 0
|
||||
10010be8 00000215 R_PPC_JMP_SLOT 00000000 __gmon_start__ + 0
|
||||
10010bec 00000415 R_PPC_JMP_SLOT 10000900 _ZNSt8ios_base4InitC1E + 0
|
||||
10010bf0 00000515 R_PPC_JMP_SLOT 10000910 __libc_start_main + 0
|
||||
10010bf4 00000615 R_PPC_JMP_SLOT 10000920 _ZNSt8ios_base4InitD1E + 0
|
||||
10010bf8 00000715 R_PPC_JMP_SLOT 10000930 _ZStlsISt11char_traits + 0
|
||||
10010bfc 00000a15 R_PPC_JMP_SLOT 10000940 _ZNSolsEPFRSoS_E + 0
|
||||
10010c00 00000b15 R_PPC_JMP_SLOT 10000950 _ZSt4endlIcSt11char_tr + 0
|
||||
10010c04 00000c15 R_PPC_JMP_SLOT 10000960 __gxx_personality_v0 + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 13 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 100008e0 144 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.1.3 (2)
|
||||
2: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
3: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
4: 10000900 1452 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev@GLIBCXX_3.4 (3)
|
||||
5: 10000910 232 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (4)
|
||||
6: 10000920 204 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev@GLIBCXX_3.4 (3)
|
||||
7: 10000930 164 FUNC GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE@GLIBCXX_3.4 (3)
|
||||
8: 10000a18 4 OBJECT GLOBAL DEFAULT 13 _IO_stdin_used
|
||||
9: 10010c0c 140 OBJECT GLOBAL DEFAULT 24 _ZSt4cout@GLIBCXX_3.4 (3)
|
||||
10: 10000940 36 FUNC GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E@GLIBCXX_3.4 (3)
|
||||
11: 10000950 336 FUNC GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait@GLIBCXX_3.4 (3)
|
||||
12: 10000960 1420 FUNC GLOBAL DEFAULT UND __gxx_personality_v0@CXXABI_1.3 (5)
|
||||
|
||||
Symbol table '.symtab' contains 80 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 10000134 0 SECTION LOCAL DEFAULT 1
|
||||
2: 10000144 0 SECTION LOCAL DEFAULT 2
|
||||
3: 10000164 0 SECTION LOCAL DEFAULT 3
|
||||
4: 100001ac 0 SECTION LOCAL DEFAULT 4
|
||||
5: 1000027c 0 SECTION LOCAL DEFAULT 5
|
||||
6: 10000400 0 SECTION LOCAL DEFAULT 6
|
||||
7: 1000041c 0 SECTION LOCAL DEFAULT 7
|
||||
8: 1000047c 0 SECTION LOCAL DEFAULT 8
|
||||
9: 10000494 0 SECTION LOCAL DEFAULT 9
|
||||
10: 10000500 0 SECTION LOCAL DEFAULT 10
|
||||
11: 10000550 0 SECTION LOCAL DEFAULT 11
|
||||
12: 100009d0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 10000a08 0 SECTION LOCAL DEFAULT 13
|
||||
14: 10000a24 0 SECTION LOCAL DEFAULT 14
|
||||
15: 10000a48 0 SECTION LOCAL DEFAULT 15
|
||||
16: 10010acc 0 SECTION LOCAL DEFAULT 16
|
||||
17: 10010ad8 0 SECTION LOCAL DEFAULT 17
|
||||
18: 10010ae0 0 SECTION LOCAL DEFAULT 18
|
||||
19: 10010ae4 0 SECTION LOCAL DEFAULT 19
|
||||
20: 10010aec 0 SECTION LOCAL DEFAULT 20
|
||||
21: 10010bd4 0 SECTION LOCAL DEFAULT 21
|
||||
22: 10010be4 0 SECTION LOCAL DEFAULT 22
|
||||
23: 10010c08 0 SECTION LOCAL DEFAULT 23
|
||||
24: 10010c0c 0 SECTION LOCAL DEFAULT 24
|
||||
25: 00000000 0 SECTION LOCAL DEFAULT 25
|
||||
26: 00000000 0 SECTION LOCAL DEFAULT 26
|
||||
27: 00000000 0 SECTION LOCAL DEFAULT 27
|
||||
28: 00000000 0 FILE LOCAL DEFAULT ABS init.c
|
||||
29: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
30: 10010acc 0 OBJECT LOCAL DEFAULT 16 __CTOR_LIST__
|
||||
31: 10010ad8 0 OBJECT LOCAL DEFAULT 17 __DTOR_LIST__
|
||||
32: 10010ae0 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
|
||||
33: 10000574 0 FUNC LOCAL DEFAULT 11 __do_global_dtors_aux
|
||||
34: 10010c98 1 OBJECT LOCAL DEFAULT 24 completed.6348
|
||||
35: 10010c9c 4 OBJECT LOCAL DEFAULT 24 dtor_idx.6350
|
||||
36: 1000061c 0 FUNC LOCAL DEFAULT 11 call___do_global_dtors_au
|
||||
37: 10000638 0 FUNC LOCAL DEFAULT 11 frame_dummy
|
||||
38: 10000680 0 FUNC LOCAL DEFAULT 11 call_frame_dummy
|
||||
39: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
40: 10010ad4 0 OBJECT LOCAL DEFAULT 16 __CTOR_END__
|
||||
41: 10000ac8 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
|
||||
42: 10010ae0 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
|
||||
43: 1000086c 0 FUNC LOCAL DEFAULT 11 __do_global_ctors_aux
|
||||
44: 100008bc 0 FUNC LOCAL DEFAULT 11 call___do_global_ctors_au
|
||||
45: 00000000 0 FILE LOCAL DEFAULT ABS test_ppc.cpp
|
||||
46: 100006f8 128 FUNC LOCAL DEFAULT 11 _Z41__static_initializati
|
||||
47: 10010ca0 1 OBJECT LOCAL DEFAULT 24 _ZStL8__ioinit
|
||||
48: 10000778 60 FUNC LOCAL DEFAULT 11 _GLOBAL__I_main
|
||||
49: 00000000 0 FILE LOCAL DEFAULT ABS elf-init.c
|
||||
50: 10010bd8 0 OBJECT LOCAL HIDDEN 21 _GLOBAL_OFFSET_TABLE_
|
||||
51: 10010acc 0 NOTYPE LOCAL HIDDEN 16 __init_array_end
|
||||
52: 10010acc 0 NOTYPE LOCAL HIDDEN 16 __init_array_start
|
||||
53: 10010aec 0 OBJECT LOCAL HIDDEN 20 _DYNAMIC
|
||||
54: 10010c08 0 NOTYPE WEAK DEFAULT 23 data_start
|
||||
55: 100008e0 144 FUNC GLOBAL DEFAULT UND __cxa_atexit@@GLIBC_2.1.3
|
||||
56: 100007b4 4 FUNC GLOBAL DEFAULT 11 __libc_csu_fini
|
||||
57: 10000550 36 FUNC GLOBAL DEFAULT 11 _start
|
||||
58: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
59: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
60: 100009d0 0 FUNC GLOBAL DEFAULT 12 _fini
|
||||
61: 10000900 1452 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev@@
|
||||
62: 10018c0c 0 NOTYPE GLOBAL DEFAULT 24 _SDA_BASE_
|
||||
63: 10000910 232 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
64: 10000920 204 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev@@
|
||||
65: 10000930 164 FUNC GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE
|
||||
66: 10000a18 4 OBJECT GLOBAL DEFAULT 13 _IO_stdin_used
|
||||
67: 10010c08 0 NOTYPE GLOBAL DEFAULT 23 __data_start
|
||||
68: 10010c0c 140 OBJECT GLOBAL DEFAULT 24 _ZSt4cout@@GLIBCXX_3.4
|
||||
69: 10010c08 0 OBJECT GLOBAL HIDDEN 23 __dso_handle
|
||||
70: 10010adc 0 OBJECT GLOBAL HIDDEN 17 __DTOR_END__
|
||||
71: 100007b8 180 FUNC GLOBAL DEFAULT 11 __libc_csu_init
|
||||
72: 10010c0c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
73: 10010ca4 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
74: 10000940 36 FUNC GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E@@GLIBCXX
|
||||
75: 10000950 336 FUNC GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait
|
||||
76: 10010c0c 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
77: 10000960 1420 FUNC GLOBAL DEFAULT UND __gxx_personality_v0@@CXX
|
||||
78: 1000069c 92 FUNC GLOBAL DEFAULT 11 main
|
||||
79: 10000500 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Histogram for bucket list length (total of 3 buckets):
|
||||
Length Number % of total Coverage
|
||||
0 0 ( 0.0%)
|
||||
1 0 ( 0.0%) 0.0%
|
||||
2 1 ( 33.3%) 16.7%
|
||||
3 0 ( 0.0%) 16.7%
|
||||
4 1 ( 33.3%) 50.0%
|
||||
5 0 ( 0.0%) 50.0%
|
||||
6 1 ( 33.3%) 100.0%
|
||||
|
||||
Version symbols section '.gnu.version' contains 13 entries:
|
||||
Addr: 0000000010000400 Offset: 0x000400 Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 2 (GLIBC_2.1.3) 0 (*local*) 0 (*local*)
|
||||
004: 3 (GLIBCXX_3.4) 4 (GLIBC_2.0) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4)
|
||||
008: 1 (*global*) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4)
|
||||
00c: 5 (CXXABI_1.3)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 2 entries:
|
||||
Addr: 0x000000001000041c Offset: 0x00041c Link: 5 (.dynstr)
|
||||
000000: Version: 1 File: libstdc++.so.6 Cnt: 2
|
||||
0x0010: Name: CXXABI_1.3 Flags: none Version: 5
|
||||
0x0020: Name: GLIBCXX_3.4 Flags: none Version: 3
|
||||
0x0030: Version: 1 File: libc.so.6 Cnt: 2
|
||||
0x0040: Name: GLIBC_2.0 Flags: none Version: 4
|
||||
0x0050: Name: GLIBC_2.1.3 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x00000144 with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
||||
Tag_GNU_Power_ABI_Vector: Generic
|
||||
Tag_GNU_Power_ABI_Struct_Return: Memory
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, big endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: EXEC (Executable file)
|
||||
Machine: PowerPC
|
||||
Version: 0x1
|
||||
Entry point address: 0x10000550
|
||||
Start of program headers: 52 (bytes into file)
|
||||
Start of section headers: 3484 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 32 (bytes)
|
||||
Number of program headers: 8
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 31
|
||||
Section header string table index: 28
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .interp PROGBITS 10000134 000134 00000d 00 A 0 0 1
|
||||
[ 2] .note.ABI-tag NOTE 10000144 000144 000020 00 A 0 0 4
|
||||
[ 3] .hash HASH 10000164 000164 000048 04 A 4 0 4
|
||||
[ 4] .dynsym DYNSYM 100001ac 0001ac 0000d0 10 A 5 1 4
|
||||
[ 5] .dynstr STRTAB 1000027c 00027c 000183 00 A 0 0 1
|
||||
[ 6] .gnu.version VERSYM 10000400 000400 00001a 02 A 4 0 2
|
||||
[ 7] .gnu.version_r VERNEED 1000041c 00041c 000060 00 A 5 2 4
|
||||
[ 8] .rela.dyn RELA 1000047c 00047c 000018 0c A 4 0 4
|
||||
[ 9] .rela.plt RELA 10000494 000494 00006c 0c A 4 22 4
|
||||
[10] .init PROGBITS 10000500 000500 00004c 00 AX 0 0 4
|
||||
[11] .text PROGBITS 10000550 000550 000480 00 AX 0 0 16
|
||||
[12] .fini PROGBITS 100009d0 0009d0 000038 00 AX 0 0 4
|
||||
[13] .rodata PROGBITS 10000a08 000a08 00001a 00 A 0 0 4
|
||||
[14] .eh_frame_hdr PROGBITS 10000a24 000a24 000024 00 A 0 0 4
|
||||
[15] .eh_frame PROGBITS 10000a48 000a48 000084 00 A 0 0 4
|
||||
[16] .ctors PROGBITS 10010acc 000acc 00000c 00 WA 0 0 4
|
||||
[17] .dtors PROGBITS 10010ad8 000ad8 000008 00 WA 0 0 4
|
||||
[18] .jcr PROGBITS 10010ae0 000ae0 000004 00 WA 0 0 4
|
||||
[19] .got2 PROGBITS 10010ae4 000ae4 000008 00 WA 0 0 1
|
||||
[20] .dynamic DYNAMIC 10010aec 000aec 0000e8 08 WA 5 0 4
|
||||
[21] .got PROGBITS 10010bd4 000bd4 000010 04 WA 0 0 4
|
||||
[22] .plt PROGBITS 10010be4 000be4 000024 00 WA 0 0 4
|
||||
[23] .data PROGBITS 10010c08 000c08 000004 00 WA 0 0 4
|
||||
[24] .bss NOBITS 10010c0c 000c0c 000098 00 WA 0 0 4
|
||||
[25] .comment PROGBITS 00000000 000c0c 000027 00 0 0 1
|
||||
[26] .debug_frame PROGBITS 00000000 000c34 000050 00 0 0 4
|
||||
[27] .gnu.attributes LOOS+ffffff5 00000000 000c84 000014 00 0 0 1
|
||||
[28] .shstrtab STRTAB 00000000 000c98 000101 00 0 0 1
|
||||
[29] .symtab SYMTAB 00000000 001274 000500 10 30 54 4
|
||||
[30] .strtab STRTAB 00000000 001774 0003cc 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
|
||||
INTERP 0x000134 0x10000134 0x10000134 0x0000d 0x0000d R 0x1
|
||||
[Requesting program interpreter: /lib/ld.so.1]
|
||||
LOAD 0x000000 0x10000000 0x10000000 0x00acc 0x00acc R E 0x10000
|
||||
LOAD 0x000acc 0x10010acc 0x10010acc 0x00140 0x001d8 RW 0x10000
|
||||
DYNAMIC 0x000aec 0x10010aec 0x10010aec 0x000e8 0x000e8 RW 0x4
|
||||
NOTE 0x000144 0x10000144 0x10000144 0x00020 0x00020 R 0x4
|
||||
GNU_EH_FRAME 0x000a24 0x10000a24 0x10000a24 0x00024 0x00024 R 0x4
|
||||
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||
|
||||
Section to Segment mapping:
|
||||
Segment Sections...
|
||||
00
|
||||
01 .interp
|
||||
02 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .text .fini .rodata .eh_frame_hdr .eh_frame
|
||||
03 .ctors .dtors .jcr .got2 .dynamic .got .plt .data .bss
|
||||
04 .dynamic
|
||||
05 .note.ABI-tag
|
||||
06 .eh_frame_hdr
|
||||
07
|
||||
|
||||
Dynamic section at offset 0xaec contains 24 entries:
|
||||
Tag Type Name/Value
|
||||
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libm.so.6]
|
||||
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
|
||||
0x00000001 (NEEDED) Shared library: [libc.so.6]
|
||||
0x0000000c (INIT) 0x10000500
|
||||
0x0000000d (FINI) 0x100009d0
|
||||
0x00000004 (HASH) 0x10000164
|
||||
0x00000005 (STRTAB) 0x1000027c
|
||||
0x00000006 (SYMTAB) 0x100001ac
|
||||
0x0000000a (STRSZ) 387 (bytes)
|
||||
0x0000000b (SYMENT) 16 (bytes)
|
||||
0x00000015 (DEBUG) 0x0
|
||||
0x00000003 (PLTGOT) 0x10010be4
|
||||
0x00000002 (PLTRELSZ) 108 (bytes)
|
||||
0x00000014 (PLTREL) RELA
|
||||
0x00000017 (JMPREL) 0x10000494
|
||||
0x70000000 (PPC_GOT) 0x10010bd8
|
||||
0x00000007 (RELA) 0x1000047c
|
||||
0x00000008 (RELASZ) 132 (bytes)
|
||||
0x00000009 (RELAENT) 12 (bytes)
|
||||
0x6ffffffe (VERNEED) 0x1000041c
|
||||
0x6fffffff (VERNEEDNUM) 2
|
||||
0x6ffffff0 (VERSYM) 0x10000400
|
||||
0x00000000 (NULL) 0x0
|
||||
|
||||
Relocation section '.rela.dyn' at offset 0x47c contains 2 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
10010bd4 00000214 R_PPC_GLOB_DAT 00000000 __gmon_start__ + 0
|
||||
10010c0c 00000913 R_PPC_COPY 10010c0c _ZSt4cout + 0
|
||||
|
||||
Relocation section '.rela.plt' at offset 0x494 contains 9 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
10010be4 00000115 R_PPC_JMP_SLOT 100008e0 __cxa_atexit + 0
|
||||
10010be8 00000215 R_PPC_JMP_SLOT 00000000 __gmon_start__ + 0
|
||||
10010bec 00000415 R_PPC_JMP_SLOT 10000900 _ZNSt8ios_base4InitC1E + 0
|
||||
10010bf0 00000515 R_PPC_JMP_SLOT 10000910 __libc_start_main + 0
|
||||
10010bf4 00000615 R_PPC_JMP_SLOT 10000920 _ZNSt8ios_base4InitD1E + 0
|
||||
10010bf8 00000715 R_PPC_JMP_SLOT 10000930 _ZStlsISt11char_traits + 0
|
||||
10010bfc 00000a15 R_PPC_JMP_SLOT 10000940 _ZNSolsEPFRSoS_E + 0
|
||||
10010c00 00000b15 R_PPC_JMP_SLOT 10000950 _ZSt4endlIcSt11char_tr + 0
|
||||
10010c04 00000c15 R_PPC_JMP_SLOT 10000960 __gxx_personality_v0 + 0
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.dynsym' contains 13 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 100008e0 144 FUNC GLOBAL DEFAULT UND __cxa_atexit@GLIBC_2.1.3 (2)
|
||||
2: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
3: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
4: 10000900 1452 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev@GLIBCXX_3.4 (3)
|
||||
5: 10000910 232 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (4)
|
||||
6: 10000920 204 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev@GLIBCXX_3.4 (3)
|
||||
7: 10000930 164 FUNC GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE@GLIBCXX_3.4 (3)
|
||||
8: 10000a18 4 OBJECT GLOBAL DEFAULT 13 _IO_stdin_used
|
||||
9: 10010c0c 140 OBJECT GLOBAL DEFAULT 24 _ZSt4cout@GLIBCXX_3.4 (3)
|
||||
10: 10000940 36 FUNC GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E@GLIBCXX_3.4 (3)
|
||||
11: 10000950 336 FUNC GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait@GLIBCXX_3.4 (3)
|
||||
12: 10000960 1420 FUNC GLOBAL DEFAULT UND __gxx_personality_v0@CXXABI_1.3 (5)
|
||||
|
||||
Symbol table '.symtab' contains 80 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 10000134 0 SECTION LOCAL DEFAULT 1
|
||||
2: 10000144 0 SECTION LOCAL DEFAULT 2
|
||||
3: 10000164 0 SECTION LOCAL DEFAULT 3
|
||||
4: 100001ac 0 SECTION LOCAL DEFAULT 4
|
||||
5: 1000027c 0 SECTION LOCAL DEFAULT 5
|
||||
6: 10000400 0 SECTION LOCAL DEFAULT 6
|
||||
7: 1000041c 0 SECTION LOCAL DEFAULT 7
|
||||
8: 1000047c 0 SECTION LOCAL DEFAULT 8
|
||||
9: 10000494 0 SECTION LOCAL DEFAULT 9
|
||||
10: 10000500 0 SECTION LOCAL DEFAULT 10
|
||||
11: 10000550 0 SECTION LOCAL DEFAULT 11
|
||||
12: 100009d0 0 SECTION LOCAL DEFAULT 12
|
||||
13: 10000a08 0 SECTION LOCAL DEFAULT 13
|
||||
14: 10000a24 0 SECTION LOCAL DEFAULT 14
|
||||
15: 10000a48 0 SECTION LOCAL DEFAULT 15
|
||||
16: 10010acc 0 SECTION LOCAL DEFAULT 16
|
||||
17: 10010ad8 0 SECTION LOCAL DEFAULT 17
|
||||
18: 10010ae0 0 SECTION LOCAL DEFAULT 18
|
||||
19: 10010ae4 0 SECTION LOCAL DEFAULT 19
|
||||
20: 10010aec 0 SECTION LOCAL DEFAULT 20
|
||||
21: 10010bd4 0 SECTION LOCAL DEFAULT 21
|
||||
22: 10010be4 0 SECTION LOCAL DEFAULT 22
|
||||
23: 10010c08 0 SECTION LOCAL DEFAULT 23
|
||||
24: 10010c0c 0 SECTION LOCAL DEFAULT 24
|
||||
25: 00000000 0 SECTION LOCAL DEFAULT 25
|
||||
26: 00000000 0 SECTION LOCAL DEFAULT 26
|
||||
27: 00000000 0 SECTION LOCAL DEFAULT 27
|
||||
28: 00000000 0 FILE LOCAL DEFAULT ABS init.c
|
||||
29: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
30: 10010acc 0 OBJECT LOCAL DEFAULT 16 __CTOR_LIST__
|
||||
31: 10010ad8 0 OBJECT LOCAL DEFAULT 17 __DTOR_LIST__
|
||||
32: 10010ae0 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
|
||||
33: 10000574 0 FUNC LOCAL DEFAULT 11 __do_global_dtors_aux
|
||||
34: 10010c98 1 OBJECT LOCAL DEFAULT 24 completed.6348
|
||||
35: 10010c9c 4 OBJECT LOCAL DEFAULT 24 dtor_idx.6350
|
||||
36: 1000061c 0 FUNC LOCAL DEFAULT 11 call___do_global_dtors_au
|
||||
37: 10000638 0 FUNC LOCAL DEFAULT 11 frame_dummy
|
||||
38: 10000680 0 FUNC LOCAL DEFAULT 11 call_frame_dummy
|
||||
39: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
|
||||
40: 10010ad4 0 OBJECT LOCAL DEFAULT 16 __CTOR_END__
|
||||
41: 10000ac8 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
|
||||
42: 10010ae0 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
|
||||
43: 1000086c 0 FUNC LOCAL DEFAULT 11 __do_global_ctors_aux
|
||||
44: 100008bc 0 FUNC LOCAL DEFAULT 11 call___do_global_ctors_au
|
||||
45: 00000000 0 FILE LOCAL DEFAULT ABS test_ppc.cpp
|
||||
46: 100006f8 128 FUNC LOCAL DEFAULT 11 _Z41__static_initializati
|
||||
47: 10010ca0 1 OBJECT LOCAL DEFAULT 24 _ZStL8__ioinit
|
||||
48: 10000778 60 FUNC LOCAL DEFAULT 11 _GLOBAL__I_main
|
||||
49: 00000000 0 FILE LOCAL DEFAULT ABS elf-init.c
|
||||
50: 10010bd8 0 OBJECT LOCAL HIDDEN 21 _GLOBAL_OFFSET_TABLE_
|
||||
51: 10010acc 0 NOTYPE LOCAL HIDDEN 16 __init_array_end
|
||||
52: 10010acc 0 NOTYPE LOCAL HIDDEN 16 __init_array_start
|
||||
53: 10010aec 0 OBJECT LOCAL HIDDEN 20 _DYNAMIC
|
||||
54: 10010c08 0 NOTYPE WEAK DEFAULT 23 data_start
|
||||
55: 100008e0 144 FUNC GLOBAL DEFAULT UND __cxa_atexit@@GLIBC_2.1.3
|
||||
56: 100007b4 4 FUNC GLOBAL DEFAULT 11 __libc_csu_fini
|
||||
57: 10000550 36 FUNC GLOBAL DEFAULT 11 _start
|
||||
58: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
|
||||
59: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
|
||||
60: 100009d0 0 FUNC GLOBAL DEFAULT 12 _fini
|
||||
61: 10000900 1452 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev@@
|
||||
62: 10018c0c 0 NOTYPE GLOBAL DEFAULT 24 _SDA_BASE_
|
||||
63: 10000910 232 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
|
||||
64: 10000920 204 FUNC GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev@@
|
||||
65: 10000930 164 FUNC GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE
|
||||
66: 10000a18 4 OBJECT GLOBAL DEFAULT 13 _IO_stdin_used
|
||||
67: 10010c08 0 NOTYPE GLOBAL DEFAULT 23 __data_start
|
||||
68: 10010c0c 140 OBJECT GLOBAL DEFAULT 24 _ZSt4cout@@GLIBCXX_3.4
|
||||
69: 10010c08 0 OBJECT GLOBAL HIDDEN 23 __dso_handle
|
||||
70: 10010adc 0 OBJECT GLOBAL HIDDEN 17 __DTOR_END__
|
||||
71: 100007b8 180 FUNC GLOBAL DEFAULT 11 __libc_csu_init
|
||||
72: 10010c0c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
|
||||
73: 10010ca4 0 NOTYPE GLOBAL DEFAULT ABS _end
|
||||
74: 10000940 36 FUNC GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E@@GLIBCXX
|
||||
75: 10000950 336 FUNC GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait
|
||||
76: 10010c0c 0 NOTYPE GLOBAL DEFAULT ABS _edata
|
||||
77: 10000960 1420 FUNC GLOBAL DEFAULT UND __gxx_personality_v0@@CXX
|
||||
78: 1000069c 92 FUNC GLOBAL DEFAULT 11 main
|
||||
79: 10000500 0 FUNC GLOBAL DEFAULT 10 _init
|
||||
|
||||
Histogram for bucket list length (total of 3 buckets):
|
||||
Length Number % of total Coverage
|
||||
0 0 ( 0.0%)
|
||||
1 0 ( 0.0%) 0.0%
|
||||
2 1 ( 33.3%) 16.7%
|
||||
3 0 ( 0.0%) 16.7%
|
||||
4 1 ( 33.3%) 50.0%
|
||||
5 0 ( 0.0%) 50.0%
|
||||
6 1 ( 33.3%) 100.0%
|
||||
|
||||
Version symbols section '.gnu.version' contains 13 entries:
|
||||
Addr: 0000000010000400 Offset: 0x000400 Link: 4 (.dynsym)
|
||||
000: 0 (*local*) 2 (GLIBC_2.1.3) 0 (*local*) 0 (*local*)
|
||||
004: 3 (GLIBCXX_3.4) 4 (GLIBC_2.0) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4)
|
||||
008: 1 (*global*) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4) 3 (GLIBCXX_3.4)
|
||||
00c: 5 (CXXABI_1.3)
|
||||
|
||||
Version needs section '.gnu.version_r' contains 2 entries:
|
||||
Addr: 0x000000001000041c Offset: 0x00041c Link: 5 (.dynstr)
|
||||
000000: Version: 1 File: libstdc++.so.6 Cnt: 2
|
||||
0x0010: Name: CXXABI_1.3 Flags: none Version: 5
|
||||
0x0020: Name: GLIBCXX_3.4 Flags: none Version: 3
|
||||
0x0030: Version: 1 File: libc.so.6 Cnt: 2
|
||||
0x0040: Name: GLIBC_2.0 Flags: none Version: 4
|
||||
0x0050: Name: GLIBC_2.1.3 Flags: none Version: 2
|
||||
|
||||
Notes at offset 0x00000144 with length 0x00000020:
|
||||
Owner Data size Description
|
||||
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
||||
Tag_GNU_Power_ABI_Vector: Generic
|
||||
Tag_GNU_Power_ABI_Struct_Return: Memory
|
||||
|
@ -1,114 +1,114 @@
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, big endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: PowerPC
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 616 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 16
|
||||
Section header string table index: 13
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .text PROGBITS 00000000 000034 000118 00 AX 0 0 4
|
||||
[ 2] .rela.text RELA 00000000 0007b8 0000d8 0c 14 1 4
|
||||
[ 3] .data PROGBITS 00000000 00014c 000000 00 WA 0 0 1
|
||||
[ 4] .bss NOBITS 00000000 00014c 000001 00 WA 0 0 1
|
||||
[ 5] .rodata PROGBITS 00000000 00014c 000006 00 A 0 0 4
|
||||
[ 6] .ctors PROGBITS 00000000 000154 000004 00 WA 0 0 4
|
||||
[ 7] .rela.ctors RELA 00000000 000890 00000c 0c 14 6 4
|
||||
[ 8] .eh_frame PROGBITS 00000000 000158 000058 00 A 0 0 4
|
||||
[ 9] .rela.eh_frame RELA 00000000 00089c 000024 0c 14 8 4
|
||||
[10] .comment PROGBITS 00000000 0001b0 000027 00 0 0 1
|
||||
[11] .note.GNU-stack PROGBITS 00000000 0001d7 000000 00 0 0 1
|
||||
[12] .gnu.attributes LOOS+ffffff5 00000000 0001d7 000014 00 0 0 1
|
||||
[13] .shstrtab STRTAB 00000000 0001eb 00007d 00 0 0 1
|
||||
[14] .symtab SYMTAB 00000000 0004e8 000180 10 15 14 4
|
||||
[15] .strtab STRTAB 00000000 000668 00014f 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rela.text' at offset 0x7b8 contains 18 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000016 00000f06 R_PPC_ADDR16_HA 00000000 _ZSt4cout + 0
|
||||
0000001a 00000f04 R_PPC_ADDR16_LO 00000000 _ZSt4cout + 0
|
||||
0000001e 00000506 R_PPC_ADDR16_HA 00000000 .rodata + 0
|
||||
00000022 00000504 R_PPC_ADDR16_LO 00000000 .rodata + 0
|
||||
00000024 0000100a R_PPC_REL24 00000000 _ZStlsISt11char_traits + 0
|
||||
00000032 00001106 R_PPC_ADDR16_HA 00000000 _ZSt4endlIcSt11char_tr + 0
|
||||
00000036 00001104 R_PPC_ADDR16_LO 00000000 _ZSt4endlIcSt11char_tr + 0
|
||||
00000038 0000120a R_PPC_REL24 00000000 _ZNSolsEPFRSoS_E + 0
|
||||
0000009a 00000406 R_PPC_ADDR16_HA 00000000 .bss + 0
|
||||
0000009e 00000404 R_PPC_ADDR16_LO 00000000 .bss + 0
|
||||
000000a0 0000130a R_PPC_REL24 00000000 _ZNSt8ios_base4InitC1E + 0
|
||||
000000a6 00001406 R_PPC_ADDR16_HA 00000000 _ZNSt8ios_base4InitD1E + 0
|
||||
000000aa 00001404 R_PPC_ADDR16_LO 00000000 _ZNSt8ios_base4InitD1E + 0
|
||||
000000b2 00000406 R_PPC_ADDR16_HA 00000000 .bss + 0
|
||||
000000b6 00000404 R_PPC_ADDR16_LO 00000000 .bss + 0
|
||||
000000ba 00001506 R_PPC_ADDR16_HA 00000000 __dso_handle + 0
|
||||
000000be 00001504 R_PPC_ADDR16_LO 00000000 __dso_handle + 0
|
||||
000000c0 0000160a R_PPC_REL24 00000000 __cxa_atexit + 0
|
||||
|
||||
Relocation section '.rela.ctors' at offset 0x890 contains 1 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000000 00000201 R_PPC_ADDR32 00000000 .text + dc
|
||||
|
||||
Relocation section '.rela.eh_frame' at offset 0x89c contains 3 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000011 00001701 R_PPC_ADDR32 00000000 __gxx_personality_v0 + 0
|
||||
00000020 00000201 R_PPC_ADDR32 00000000 .text + 0
|
||||
00000040 00000201 R_PPC_ADDR32 00000000 .text + 5c
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 24 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 FILE LOCAL DEFAULT ABS test_ppc.cpp
|
||||
2: 00000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 00000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 00000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 0000005c 128 FUNC LOCAL DEFAULT 1 _Z41__static_initializati
|
||||
7: 00000000 1 OBJECT LOCAL DEFAULT 4 _ZStL8__ioinit
|
||||
8: 000000dc 60 FUNC LOCAL DEFAULT 1 _GLOBAL__I_main
|
||||
9: 00000000 0 SECTION LOCAL DEFAULT 6
|
||||
10: 00000000 0 SECTION LOCAL DEFAULT 8
|
||||
11: 00000000 0 SECTION LOCAL DEFAULT 11
|
||||
12: 00000000 0 SECTION LOCAL DEFAULT 10
|
||||
13: 00000000 0 SECTION LOCAL DEFAULT 12
|
||||
14: 00000000 92 FUNC GLOBAL DEFAULT 1 main
|
||||
15: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZSt4cout
|
||||
16: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE
|
||||
17: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait
|
||||
18: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E
|
||||
19: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev
|
||||
20: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev
|
||||
21: 00000000 0 NOTYPE GLOBAL DEFAULT UND __dso_handle
|
||||
22: 00000000 0 NOTYPE GLOBAL DEFAULT UND __cxa_atexit
|
||||
23: 00000000 0 NOTYPE GLOBAL DEFAULT UND __gxx_personality_v0
|
||||
|
||||
No version information found in this file.
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
||||
Tag_GNU_Power_ABI_Vector: Generic
|
||||
Tag_GNU_Power_ABI_Struct_Return: Memory
|
||||
ELF Header:
|
||||
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
|
||||
Class: ELF32
|
||||
Data: 2's complement, big endian
|
||||
Version: 1 (current)
|
||||
OS/ABI: UNIX - System V
|
||||
ABI Version: 0
|
||||
Type: REL (Relocatable file)
|
||||
Machine: PowerPC
|
||||
Version: 0x1
|
||||
Entry point address: 0x0
|
||||
Start of program headers: 0 (bytes into file)
|
||||
Start of section headers: 616 (bytes into file)
|
||||
Flags: 0x0
|
||||
Size of this header: 52 (bytes)
|
||||
Size of program headers: 0 (bytes)
|
||||
Number of program headers: 0
|
||||
Size of section headers: 40 (bytes)
|
||||
Number of section headers: 16
|
||||
Section header string table index: 13
|
||||
|
||||
Section Headers:
|
||||
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
|
||||
[ 0] NULL 00000000 000000 000000 00 0 0 0
|
||||
[ 1] .text PROGBITS 00000000 000034 000118 00 AX 0 0 4
|
||||
[ 2] .rela.text RELA 00000000 0007b8 0000d8 0c 14 1 4
|
||||
[ 3] .data PROGBITS 00000000 00014c 000000 00 WA 0 0 1
|
||||
[ 4] .bss NOBITS 00000000 00014c 000001 00 WA 0 0 1
|
||||
[ 5] .rodata PROGBITS 00000000 00014c 000006 00 A 0 0 4
|
||||
[ 6] .ctors PROGBITS 00000000 000154 000004 00 WA 0 0 4
|
||||
[ 7] .rela.ctors RELA 00000000 000890 00000c 0c 14 6 4
|
||||
[ 8] .eh_frame PROGBITS 00000000 000158 000058 00 A 0 0 4
|
||||
[ 9] .rela.eh_frame RELA 00000000 00089c 000024 0c 14 8 4
|
||||
[10] .comment PROGBITS 00000000 0001b0 000027 00 0 0 1
|
||||
[11] .note.GNU-stack PROGBITS 00000000 0001d7 000000 00 0 0 1
|
||||
[12] .gnu.attributes LOOS+ffffff5 00000000 0001d7 000014 00 0 0 1
|
||||
[13] .shstrtab STRTAB 00000000 0001eb 00007d 00 0 0 1
|
||||
[14] .symtab SYMTAB 00000000 0004e8 000180 10 15 14 4
|
||||
[15] .strtab STRTAB 00000000 000668 00014f 00 0 0 1
|
||||
Key to Flags:
|
||||
W (write), A (alloc), X (execute), M (merge), S (strings)
|
||||
I (info), L (link order), G (group), x (unknown)
|
||||
O (extra OS processing required) o (OS specific), p (processor specific)
|
||||
|
||||
There are no section groups in this file.
|
||||
|
||||
There are no program headers in this file.
|
||||
|
||||
Relocation section '.rela.text' at offset 0x7b8 contains 18 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000016 00000f06 R_PPC_ADDR16_HA 00000000 _ZSt4cout + 0
|
||||
0000001a 00000f04 R_PPC_ADDR16_LO 00000000 _ZSt4cout + 0
|
||||
0000001e 00000506 R_PPC_ADDR16_HA 00000000 .rodata + 0
|
||||
00000022 00000504 R_PPC_ADDR16_LO 00000000 .rodata + 0
|
||||
00000024 0000100a R_PPC_REL24 00000000 _ZStlsISt11char_traits + 0
|
||||
00000032 00001106 R_PPC_ADDR16_HA 00000000 _ZSt4endlIcSt11char_tr + 0
|
||||
00000036 00001104 R_PPC_ADDR16_LO 00000000 _ZSt4endlIcSt11char_tr + 0
|
||||
00000038 0000120a R_PPC_REL24 00000000 _ZNSolsEPFRSoS_E + 0
|
||||
0000009a 00000406 R_PPC_ADDR16_HA 00000000 .bss + 0
|
||||
0000009e 00000404 R_PPC_ADDR16_LO 00000000 .bss + 0
|
||||
000000a0 0000130a R_PPC_REL24 00000000 _ZNSt8ios_base4InitC1E + 0
|
||||
000000a6 00001406 R_PPC_ADDR16_HA 00000000 _ZNSt8ios_base4InitD1E + 0
|
||||
000000aa 00001404 R_PPC_ADDR16_LO 00000000 _ZNSt8ios_base4InitD1E + 0
|
||||
000000b2 00000406 R_PPC_ADDR16_HA 00000000 .bss + 0
|
||||
000000b6 00000404 R_PPC_ADDR16_LO 00000000 .bss + 0
|
||||
000000ba 00001506 R_PPC_ADDR16_HA 00000000 __dso_handle + 0
|
||||
000000be 00001504 R_PPC_ADDR16_LO 00000000 __dso_handle + 0
|
||||
000000c0 0000160a R_PPC_REL24 00000000 __cxa_atexit + 0
|
||||
|
||||
Relocation section '.rela.ctors' at offset 0x890 contains 1 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000000 00000201 R_PPC_ADDR32 00000000 .text + dc
|
||||
|
||||
Relocation section '.rela.eh_frame' at offset 0x89c contains 3 entries:
|
||||
Offset Info Type Sym.Value Sym. Name + Addend
|
||||
00000011 00001701 R_PPC_ADDR32 00000000 __gxx_personality_v0 + 0
|
||||
00000020 00000201 R_PPC_ADDR32 00000000 .text + 0
|
||||
00000040 00000201 R_PPC_ADDR32 00000000 .text + 5c
|
||||
|
||||
There are no unwind sections in this file.
|
||||
|
||||
Symbol table '.symtab' contains 24 entries:
|
||||
Num: Value Size Type Bind Vis Ndx Name
|
||||
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
|
||||
1: 00000000 0 FILE LOCAL DEFAULT ABS test_ppc.cpp
|
||||
2: 00000000 0 SECTION LOCAL DEFAULT 1
|
||||
3: 00000000 0 SECTION LOCAL DEFAULT 3
|
||||
4: 00000000 0 SECTION LOCAL DEFAULT 4
|
||||
5: 00000000 0 SECTION LOCAL DEFAULT 5
|
||||
6: 0000005c 128 FUNC LOCAL DEFAULT 1 _Z41__static_initializati
|
||||
7: 00000000 1 OBJECT LOCAL DEFAULT 4 _ZStL8__ioinit
|
||||
8: 000000dc 60 FUNC LOCAL DEFAULT 1 _GLOBAL__I_main
|
||||
9: 00000000 0 SECTION LOCAL DEFAULT 6
|
||||
10: 00000000 0 SECTION LOCAL DEFAULT 8
|
||||
11: 00000000 0 SECTION LOCAL DEFAULT 11
|
||||
12: 00000000 0 SECTION LOCAL DEFAULT 10
|
||||
13: 00000000 0 SECTION LOCAL DEFAULT 12
|
||||
14: 00000000 92 FUNC GLOBAL DEFAULT 1 main
|
||||
15: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZSt4cout
|
||||
16: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZStlsISt11char_traitsIcE
|
||||
17: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZSt4endlIcSt11char_trait
|
||||
18: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSolsEPFRSoS_E
|
||||
19: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSt8ios_base4InitC1Ev
|
||||
20: 00000000 0 NOTYPE GLOBAL DEFAULT UND _ZNSt8ios_base4InitD1Ev
|
||||
21: 00000000 0 NOTYPE GLOBAL DEFAULT UND __dso_handle
|
||||
22: 00000000 0 NOTYPE GLOBAL DEFAULT UND __cxa_atexit
|
||||
23: 00000000 0 NOTYPE GLOBAL DEFAULT UND __gxx_personality_v0
|
||||
|
||||
No version information found in this file.
|
||||
Attribute Section: gnu
|
||||
File Attributes
|
||||
Tag_GNU_Power_ABI_FP: Hard float
|
||||
Tag_GNU_Power_ABI_Vector: Generic
|
||||
Tag_GNU_Power_ABI_Struct_Return: Memory
|
||||
|
@ -1,71 +1,71 @@
|
||||
|
||||
write_exe_i386_32_work: file format elf32-i386
|
||||
write_exe_i386_32_work
|
||||
architecture: i386, flags 0x00000102:
|
||||
EXEC_P, D_PAGED
|
||||
start address 0x08048080
|
||||
|
||||
Program Header:
|
||||
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
|
||||
filesz 0x0000009d memsz 0x0000009d flags r-x
|
||||
LOAD off 0x000000a0 vaddr 0x080490a0 paddr 0x080490a0 align 2**12
|
||||
filesz 0x0000000e memsz 0x0000000e flags rw-
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .text 0000001d 08048080 08048080 00000080 2**4
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
1 .data 0000000e 080490a0 080490a0 000000a0 2**2
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
2 .note 00000020 00000000 00000000 000000ae 2**0
|
||||
CONTENTS, READONLY
|
||||
SYMBOL TABLE:
|
||||
no symbols
|
||||
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
08048080 <.text>:
|
||||
8048080: b8 04 00 00 00 mov $0x4,%eax
|
||||
8048085: bb 01 00 00 00 mov $0x1,%ebx
|
||||
804808a: b9 a0 90 04 08 mov $0x80490a0,%ecx
|
||||
804808f: ba 0e 00 00 00 mov $0xe,%edx
|
||||
8048094: cd 80 int $0x80
|
||||
8048096: b8 01 00 00 00 mov $0x1,%eax
|
||||
804809b: cd 80 int $0x80
|
||||
|
||||
Disassembly of section .data:
|
||||
|
||||
080490a0 <.data>:
|
||||
80490a0: 48 dec %eax
|
||||
80490a1: 65 gs
|
||||
80490a2: 6c insb (%dx),%es:(%edi)
|
||||
80490a3: 6c insb (%dx),%es:(%edi)
|
||||
80490a4: 6f outsl %ds:(%esi),(%dx)
|
||||
80490a5: 2c 20 sub $0x20,%al
|
||||
80490a7: 57 push %edi
|
||||
80490a8: 6f outsl %ds:(%esi),(%dx)
|
||||
80490a9: 72 6c jb 0x8049117
|
||||
80490ab: 64 21 0a and %ecx,%fs:(%edx)
|
||||
|
||||
Disassembly of section .note:
|
||||
|
||||
00000000 <.note>:
|
||||
0: 11 00 adc %eax,(%eax)
|
||||
2: 00 00 add %al,(%eax)
|
||||
4: 00 00 add %al,(%eax)
|
||||
6: 00 00 add %al,(%eax)
|
||||
8: 77 00 ja 0xa
|
||||
a: 00 00 add %al,(%eax)
|
||||
c: 43 inc %ebx
|
||||
d: 72 65 jb 0x74
|
||||
f: 61 popa
|
||||
10: 74 65 je 0x77
|
||||
12: 64 20 62 79 and %ah,%fs:0x79(%edx)
|
||||
16: 20 45 4c and %al,0x4c(%ebp)
|
||||
19: 46 inc %esi
|
||||
1a: 49 dec %ecx
|
||||
1b: 4f dec %edi
|
||||
1c: 00 00 add %al,(%eax)
|
||||
...
|
||||
|
||||
write_exe_i386_32_work: file format elf32-i386
|
||||
write_exe_i386_32_work
|
||||
architecture: i386, flags 0x00000102:
|
||||
EXEC_P, D_PAGED
|
||||
start address 0x08048080
|
||||
|
||||
Program Header:
|
||||
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
|
||||
filesz 0x0000009d memsz 0x0000009d flags r-x
|
||||
LOAD off 0x000000a0 vaddr 0x080490a0 paddr 0x080490a0 align 2**12
|
||||
filesz 0x0000000e memsz 0x0000000e flags rw-
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn
|
||||
0 .text 0000001d 08048080 08048080 00000080 2**4
|
||||
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
||||
1 .data 0000000e 080490a0 080490a0 000000a0 2**2
|
||||
CONTENTS, ALLOC, LOAD, DATA
|
||||
2 .note 00000020 00000000 00000000 000000ae 2**0
|
||||
CONTENTS, READONLY
|
||||
SYMBOL TABLE:
|
||||
no symbols
|
||||
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
08048080 <.text>:
|
||||
8048080: b8 04 00 00 00 mov $0x4,%eax
|
||||
8048085: bb 01 00 00 00 mov $0x1,%ebx
|
||||
804808a: b9 a0 90 04 08 mov $0x80490a0,%ecx
|
||||
804808f: ba 0e 00 00 00 mov $0xe,%edx
|
||||
8048094: cd 80 int $0x80
|
||||
8048096: b8 01 00 00 00 mov $0x1,%eax
|
||||
804809b: cd 80 int $0x80
|
||||
|
||||
Disassembly of section .data:
|
||||
|
||||
080490a0 <.data>:
|
||||
80490a0: 48 dec %eax
|
||||
80490a1: 65 gs
|
||||
80490a2: 6c insb (%dx),%es:(%edi)
|
||||
80490a3: 6c insb (%dx),%es:(%edi)
|
||||
80490a4: 6f outsl %ds:(%esi),(%dx)
|
||||
80490a5: 2c 20 sub $0x20,%al
|
||||
80490a7: 57 push %edi
|
||||
80490a8: 6f outsl %ds:(%esi),(%dx)
|
||||
80490a9: 72 6c jb 0x8049117
|
||||
80490ab: 64 21 0a and %ecx,%fs:(%edx)
|
||||
|
||||
Disassembly of section .note:
|
||||
|
||||
00000000 <.note>:
|
||||
0: 11 00 adc %eax,(%eax)
|
||||
2: 00 00 add %al,(%eax)
|
||||
4: 00 00 add %al,(%eax)
|
||||
6: 00 00 add %al,(%eax)
|
||||
8: 77 00 ja 0xa
|
||||
a: 00 00 add %al,(%eax)
|
||||
c: 43 inc %ebx
|
||||
d: 72 65 jb 0x74
|
||||
f: 61 popa
|
||||
10: 74 65 je 0x77
|
||||
12: 64 20 62 79 and %ah,%fs:0x79(%edx)
|
||||
16: 20 45 4c and %al,0x4c(%ebp)
|
||||
19: 46 inc %esi
|
||||
1a: 49 dec %ecx
|
||||
1b: 4f dec %edi
|
||||
1c: 00 00 add %al,(%eax)
|
||||
...
|
||||
|
1420
elfio/elf_types.hpp
1420
elfio/elf_types.hpp
File diff suppressed because it is too large
Load Diff
@ -1,58 +1,58 @@
|
||||
#ifndef ELFI_DYNAMIC_HPP
|
||||
#define ELFI_DYNAMIC_HPP
|
||||
|
||||
class ELFIDynamicReader : virtual public ELFIReaderImpl, virtual public IELFIDynamicReader
|
||||
{
|
||||
public:
|
||||
ELFIDynamicReader( const IELFI* pIELFI, const section* pSection );
|
||||
virtual ~ELFIDynamicReader();
|
||||
|
||||
// Dynamic reader functions
|
||||
virtual Elf_Xword getEntriesNum() const;
|
||||
virtual ELFIO_Err get_entry( Elf_Xword index,
|
||||
Elf_Sxword& tag,
|
||||
Elf_Xword& value ) const;
|
||||
};
|
||||
|
||||
|
||||
ELFIDynamicReader::ELFIDynamicReader( const IELFI* pIELFI, const section* pSection ) :
|
||||
ELFIReaderImpl( pIELFI, pSection )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ELFIDynamicReader::~ELFIDynamicReader()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Elf_Xword
|
||||
ELFIDynamicReader::getEntriesNum() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
if ( 0 != m_pSection->get_entry_size() ) {
|
||||
nRet = m_pSection->get_size() / m_pSection->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
ELFIO_Err
|
||||
ELFIDynamicReader::get_entry( Elf_Xword index,
|
||||
Elf_Sxword& tag,
|
||||
Elf_Xword& value ) const
|
||||
{
|
||||
if ( index >= getEntriesNum() ) { // Is index valid
|
||||
return ERR_ELFIO_INDEX_ERROR;
|
||||
}
|
||||
|
||||
const Elf64_Dyn* pEntry = reinterpret_cast<const Elf64_Dyn*>(
|
||||
m_pSection->get_data() + index * m_pSection->get_entry_size() );
|
||||
tag = convert2host( pEntry->d_tag, m_pIELFI->get_encoding() );
|
||||
value = convert2host( pEntry->d_un.d_val, m_pIELFI->get_encoding() );
|
||||
|
||||
return ERR_ELFIO_NO_ERROR;
|
||||
}
|
||||
|
||||
#endif // ELFI_DYNAMIC_HPP
|
||||
#ifndef ELFI_DYNAMIC_HPP
|
||||
#define ELFI_DYNAMIC_HPP
|
||||
|
||||
class ELFIDynamicReader : virtual public ELFIReaderImpl, virtual public IELFIDynamicReader
|
||||
{
|
||||
public:
|
||||
ELFIDynamicReader( const IELFI* pIELFI, const section* pSection );
|
||||
virtual ~ELFIDynamicReader();
|
||||
|
||||
// Dynamic reader functions
|
||||
virtual Elf_Xword getEntriesNum() const;
|
||||
virtual ELFIO_Err get_entry( Elf_Xword index,
|
||||
Elf_Sxword& tag,
|
||||
Elf_Xword& value ) const;
|
||||
};
|
||||
|
||||
|
||||
ELFIDynamicReader::ELFIDynamicReader( const IELFI* pIELFI, const section* pSection ) :
|
||||
ELFIReaderImpl( pIELFI, pSection )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
ELFIDynamicReader::~ELFIDynamicReader()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Elf_Xword
|
||||
ELFIDynamicReader::getEntriesNum() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
if ( 0 != m_pSection->get_entry_size() ) {
|
||||
nRet = m_pSection->get_size() / m_pSection->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
ELFIO_Err
|
||||
ELFIDynamicReader::get_entry( Elf_Xword index,
|
||||
Elf_Sxword& tag,
|
||||
Elf_Xword& value ) const
|
||||
{
|
||||
if ( index >= getEntriesNum() ) { // Is index valid
|
||||
return ERR_ELFIO_INDEX_ERROR;
|
||||
}
|
||||
|
||||
const Elf64_Dyn* pEntry = reinterpret_cast<const Elf64_Dyn*>(
|
||||
m_pSection->get_data() + index * m_pSection->get_entry_size() );
|
||||
tag = convert2host( pEntry->d_tag, m_pIELFI->get_encoding() );
|
||||
value = convert2host( pEntry->d_un.d_val, m_pIELFI->get_encoding() );
|
||||
|
||||
return ERR_ELFIO_NO_ERROR;
|
||||
}
|
||||
|
||||
#endif // ELFI_DYNAMIC_HPP
|
||||
|
1234
elfio/elfio.hpp
1234
elfio/elfio.hpp
File diff suppressed because it is too large
Load Diff
1370
elfio/elfio_dump.hpp
1370
elfio/elfio_dump.hpp
File diff suppressed because it is too large
Load Diff
@ -1,146 +1,146 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELF_HEADER_HPP
|
||||
#define ELF_HEADER_HPP
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class elf_header
|
||||
{
|
||||
public:
|
||||
virtual ~elf_header() {};
|
||||
virtual bool load( std::ifstream& stream ) = 0;
|
||||
virtual bool save( std::ofstream& stream ) const = 0;
|
||||
|
||||
// ELF header functions
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, class );
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, elf_version );
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, encoding );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Word, version );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, header_size );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, section_entry_size );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, segment_entry_size );
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( unsigned char, os_abi );
|
||||
ELFIO_GET_SET_ACCESS_DECL( unsigned char, abi_version );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, machine );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, entry );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, sections_num );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, sections_offset );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, segments_num );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, segments_offset );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, section_name_str_index );
|
||||
};
|
||||
|
||||
|
||||
template< class T > struct elf_header_impl_types;
|
||||
template<> struct elf_header_impl_types<Elf32_Ehdr> {
|
||||
typedef Elf32_Phdr Phdr_type;
|
||||
typedef Elf32_Shdr Shdr_type;
|
||||
static const unsigned char file_class = ELFCLASS32;
|
||||
};
|
||||
template<> struct elf_header_impl_types<Elf64_Ehdr> {
|
||||
typedef Elf64_Phdr Phdr_type;
|
||||
typedef Elf64_Shdr Shdr_type;
|
||||
static const unsigned char file_class = ELFCLASS64;
|
||||
};
|
||||
|
||||
template< class T > class elf_header_impl : public elf_header
|
||||
{
|
||||
public:
|
||||
elf_header_impl( endianess_convertor* convertor_,
|
||||
unsigned char encoding )
|
||||
{
|
||||
convertor = convertor_;
|
||||
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
|
||||
header.e_ident[EI_MAG0] = ELFMAG0;
|
||||
header.e_ident[EI_MAG1] = ELFMAG1;
|
||||
header.e_ident[EI_MAG2] = ELFMAG2;
|
||||
header.e_ident[EI_MAG3] = ELFMAG3;
|
||||
header.e_ident[EI_CLASS] = elf_header_impl_types<T>::file_class;
|
||||
header.e_ident[EI_DATA] = encoding;
|
||||
header.e_ident[EI_VERSION] = EV_CURRENT;
|
||||
header.e_version = EV_CURRENT;
|
||||
header.e_version = (*convertor)( header.e_version );
|
||||
header.e_ehsize = ( sizeof( header ) );
|
||||
header.e_ehsize = (*convertor)( header.e_ehsize );
|
||||
header.e_shstrndx = (*convertor)( (Elf_Half)1 );
|
||||
header.e_phentsize = sizeof( typename elf_header_impl_types<T>::Phdr_type );
|
||||
header.e_shentsize = sizeof( typename elf_header_impl_types<T>::Shdr_type );
|
||||
header.e_phentsize = (*convertor)( header.e_phentsize );
|
||||
header.e_shentsize = (*convertor)( header.e_shentsize );
|
||||
}
|
||||
|
||||
bool
|
||||
load( std::ifstream& stream )
|
||||
{
|
||||
stream.seekg( 0 );
|
||||
stream.read( reinterpret_cast<char*>( &header ), sizeof( header ) );
|
||||
|
||||
return (stream.gcount() == sizeof( header ) );
|
||||
}
|
||||
|
||||
bool
|
||||
save( std::ofstream& stream ) const
|
||||
{
|
||||
stream.seekp( 0 );
|
||||
stream.write( reinterpret_cast<const char*>( &header ), sizeof( header ) );
|
||||
|
||||
return stream.good();
|
||||
}
|
||||
|
||||
// ELF header functions
|
||||
ELFIO_GET_ACCESS( unsigned char, class, header.e_ident[EI_CLASS] );
|
||||
ELFIO_GET_ACCESS( unsigned char, elf_version, header.e_ident[EI_VERSION] );
|
||||
ELFIO_GET_ACCESS( unsigned char, encoding, header.e_ident[EI_DATA] );
|
||||
ELFIO_GET_ACCESS( Elf_Word, version, header.e_version );
|
||||
ELFIO_GET_ACCESS( Elf_Half, header_size, header.e_ehsize );
|
||||
ELFIO_GET_ACCESS( Elf_Half, section_entry_size, header.e_shentsize );
|
||||
ELFIO_GET_ACCESS( Elf_Half, segment_entry_size, header.e_phentsize );
|
||||
|
||||
ELFIO_GET_SET_ACCESS( unsigned char, os_abi, header.e_ident[EI_OSABI] );
|
||||
ELFIO_GET_SET_ACCESS( unsigned char, abi_version, header.e_ident[EI_ABIVERSION] );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, type, header.e_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, machine, header.e_machine );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, flags, header.e_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, section_name_str_index, header.e_shstrndx );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, entry, header.e_entry );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, sections_num, header.e_shnum );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Off, sections_offset, header.e_shoff );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, segments_num, header.e_phnum );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Off, segments_offset, header.e_phoff );
|
||||
|
||||
private:
|
||||
T header;
|
||||
endianess_convertor* convertor;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELF_HEADER_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELF_HEADER_HPP
|
||||
#define ELF_HEADER_HPP
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class elf_header
|
||||
{
|
||||
public:
|
||||
virtual ~elf_header() {};
|
||||
virtual bool load( std::ifstream& stream ) = 0;
|
||||
virtual bool save( std::ofstream& stream ) const = 0;
|
||||
|
||||
// ELF header functions
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, class );
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, elf_version );
|
||||
ELFIO_GET_ACCESS_DECL( unsigned char, encoding );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Word, version );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, header_size );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, section_entry_size );
|
||||
ELFIO_GET_ACCESS_DECL( Elf_Half, segment_entry_size );
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( unsigned char, os_abi );
|
||||
ELFIO_GET_SET_ACCESS_DECL( unsigned char, abi_version );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, machine );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, entry );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, sections_num );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, sections_offset );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, segments_num );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Off, segments_offset );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Half, section_name_str_index );
|
||||
};
|
||||
|
||||
|
||||
template< class T > struct elf_header_impl_types;
|
||||
template<> struct elf_header_impl_types<Elf32_Ehdr> {
|
||||
typedef Elf32_Phdr Phdr_type;
|
||||
typedef Elf32_Shdr Shdr_type;
|
||||
static const unsigned char file_class = ELFCLASS32;
|
||||
};
|
||||
template<> struct elf_header_impl_types<Elf64_Ehdr> {
|
||||
typedef Elf64_Phdr Phdr_type;
|
||||
typedef Elf64_Shdr Shdr_type;
|
||||
static const unsigned char file_class = ELFCLASS64;
|
||||
};
|
||||
|
||||
template< class T > class elf_header_impl : public elf_header
|
||||
{
|
||||
public:
|
||||
elf_header_impl( endianess_convertor* convertor_,
|
||||
unsigned char encoding )
|
||||
{
|
||||
convertor = convertor_;
|
||||
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
|
||||
header.e_ident[EI_MAG0] = ELFMAG0;
|
||||
header.e_ident[EI_MAG1] = ELFMAG1;
|
||||
header.e_ident[EI_MAG2] = ELFMAG2;
|
||||
header.e_ident[EI_MAG3] = ELFMAG3;
|
||||
header.e_ident[EI_CLASS] = elf_header_impl_types<T>::file_class;
|
||||
header.e_ident[EI_DATA] = encoding;
|
||||
header.e_ident[EI_VERSION] = EV_CURRENT;
|
||||
header.e_version = EV_CURRENT;
|
||||
header.e_version = (*convertor)( header.e_version );
|
||||
header.e_ehsize = ( sizeof( header ) );
|
||||
header.e_ehsize = (*convertor)( header.e_ehsize );
|
||||
header.e_shstrndx = (*convertor)( (Elf_Half)1 );
|
||||
header.e_phentsize = sizeof( typename elf_header_impl_types<T>::Phdr_type );
|
||||
header.e_shentsize = sizeof( typename elf_header_impl_types<T>::Shdr_type );
|
||||
header.e_phentsize = (*convertor)( header.e_phentsize );
|
||||
header.e_shentsize = (*convertor)( header.e_shentsize );
|
||||
}
|
||||
|
||||
bool
|
||||
load( std::ifstream& stream )
|
||||
{
|
||||
stream.seekg( 0 );
|
||||
stream.read( reinterpret_cast<char*>( &header ), sizeof( header ) );
|
||||
|
||||
return (stream.gcount() == sizeof( header ) );
|
||||
}
|
||||
|
||||
bool
|
||||
save( std::ofstream& stream ) const
|
||||
{
|
||||
stream.seekp( 0 );
|
||||
stream.write( reinterpret_cast<const char*>( &header ), sizeof( header ) );
|
||||
|
||||
return stream.good();
|
||||
}
|
||||
|
||||
// ELF header functions
|
||||
ELFIO_GET_ACCESS( unsigned char, class, header.e_ident[EI_CLASS] );
|
||||
ELFIO_GET_ACCESS( unsigned char, elf_version, header.e_ident[EI_VERSION] );
|
||||
ELFIO_GET_ACCESS( unsigned char, encoding, header.e_ident[EI_DATA] );
|
||||
ELFIO_GET_ACCESS( Elf_Word, version, header.e_version );
|
||||
ELFIO_GET_ACCESS( Elf_Half, header_size, header.e_ehsize );
|
||||
ELFIO_GET_ACCESS( Elf_Half, section_entry_size, header.e_shentsize );
|
||||
ELFIO_GET_ACCESS( Elf_Half, segment_entry_size, header.e_phentsize );
|
||||
|
||||
ELFIO_GET_SET_ACCESS( unsigned char, os_abi, header.e_ident[EI_OSABI] );
|
||||
ELFIO_GET_SET_ACCESS( unsigned char, abi_version, header.e_ident[EI_ABIVERSION] );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, type, header.e_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, machine, header.e_machine );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, flags, header.e_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, section_name_str_index, header.e_shstrndx );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, entry, header.e_entry );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, sections_num, header.e_shnum );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Off, sections_offset, header.e_shoff );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Half, segments_num, header.e_phnum );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Off, segments_offset, header.e_phoff );
|
||||
|
||||
private:
|
||||
T header;
|
||||
endianess_convertor* convertor;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELF_HEADER_HPP
|
||||
|
@ -1,157 +1,157 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_NOTE_HPP
|
||||
#define ELFIO_NOTE_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class note_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
note_section_accessor( const elfio& elf_file_, section* section_ ) :
|
||||
elf_file( elf_file_ ), note_section( section_ )
|
||||
{
|
||||
process_section();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
get_notes_num() const
|
||||
{
|
||||
return (Elf_Word)note_start_positions.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_note( Elf_Word index,
|
||||
Elf_Word& type,
|
||||
std::string& name,
|
||||
void*& desc,
|
||||
Elf_Word& descSize ) const
|
||||
{
|
||||
if ( index >= note_section->get_size() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* pData = note_section->get_data() + note_start_positions[index];
|
||||
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
type = convertor( *(Elf_Word*)( pData + 2*sizeof( Elf_Word ) ) );
|
||||
Elf_Word namesz = convertor( *(Elf_Word*)( pData ) );
|
||||
name.assign( pData + 3*sizeof( Elf_Word ), namesz );
|
||||
descSize = convertor( *(Elf_Word*)( pData + sizeof( namesz ) ) );
|
||||
if ( 0 == descSize ) {
|
||||
desc = 0;
|
||||
}
|
||||
else {
|
||||
int align = sizeof( Elf_Xword );
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
align = sizeof( Elf_Word );
|
||||
}
|
||||
desc = const_cast<char*> ( pData + 3*sizeof( Elf_Word ) +
|
||||
( ( namesz + align - 1 ) / align ) * align );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void add_note( Elf_Word type,
|
||||
const std::string& name,
|
||||
const void* desc,
|
||||
Elf_Word descSize )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
Elf_Word nameLen = (Elf_Word)name.size() + 1;
|
||||
Elf_Word nameLenConv = convertor( nameLen );
|
||||
std::string buffer( reinterpret_cast<char*>( &nameLenConv ), sizeof( nameLenConv ) );
|
||||
Elf_Word descSizeConv = convertor( descSize );
|
||||
buffer.append( reinterpret_cast<char*>( &descSizeConv ), sizeof( descSizeConv ) );
|
||||
type = convertor( type );
|
||||
buffer.append( reinterpret_cast<char*>( &type ), sizeof( type ) );
|
||||
buffer.append( name );
|
||||
buffer.append( 1, '\x00' );
|
||||
const char pad[] = { '\0', '\0', '\0', '\0' };
|
||||
if ( nameLen % sizeof( Elf_Word ) != 0 ) {
|
||||
buffer.append( pad, sizeof( Elf_Word ) -
|
||||
nameLen % sizeof( Elf_Word ) );
|
||||
}
|
||||
if ( desc != 0 && descSize != 0 ) {
|
||||
buffer.append( reinterpret_cast<const char*>( desc ), descSize );
|
||||
if ( descSize % sizeof( Elf_Word ) != 0 ) {
|
||||
buffer.append( pad, sizeof( Elf_Word ) -
|
||||
descSize % sizeof( Elf_Word ) );
|
||||
}
|
||||
}
|
||||
|
||||
note_start_positions.push_back( note_section->get_size() );
|
||||
note_section->append_data( buffer );
|
||||
}
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void process_section()
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
const char* data = note_section->get_data();
|
||||
Elf_Xword size = note_section->get_size();
|
||||
Elf_Xword current = 0;
|
||||
|
||||
note_start_positions.clear();
|
||||
|
||||
// Is it empty?
|
||||
if ( 0 == data || 0 == size ) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ( current + 3*sizeof( Elf_Word ) <= size ) {
|
||||
note_start_positions.push_back( current );
|
||||
Elf_Word namesz = convertor(
|
||||
*(Elf_Word*)( data + current ) );
|
||||
Elf_Word descsz = convertor(
|
||||
*(Elf_Word*)( data + current + sizeof( namesz ) ) );
|
||||
|
||||
int align = sizeof( Elf_Xword );
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
align = sizeof( Elf_Word );
|
||||
}
|
||||
|
||||
current += 3*sizeof( Elf_Word ) +
|
||||
( ( namesz + align - 1 ) / align ) * align +
|
||||
( ( descsz + align - 1 ) / align ) * align;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
const elfio& elf_file;
|
||||
section* note_section;
|
||||
std::vector<Elf_Xword> note_start_positions;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_NOTE_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_NOTE_HPP
|
||||
#define ELFIO_NOTE_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class note_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
note_section_accessor( const elfio& elf_file_, section* section_ ) :
|
||||
elf_file( elf_file_ ), note_section( section_ )
|
||||
{
|
||||
process_section();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
get_notes_num() const
|
||||
{
|
||||
return (Elf_Word)note_start_positions.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_note( Elf_Word index,
|
||||
Elf_Word& type,
|
||||
std::string& name,
|
||||
void*& desc,
|
||||
Elf_Word& descSize ) const
|
||||
{
|
||||
if ( index >= note_section->get_size() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* pData = note_section->get_data() + note_start_positions[index];
|
||||
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
type = convertor( *(Elf_Word*)( pData + 2*sizeof( Elf_Word ) ) );
|
||||
Elf_Word namesz = convertor( *(Elf_Word*)( pData ) );
|
||||
name.assign( pData + 3*sizeof( Elf_Word ), namesz );
|
||||
descSize = convertor( *(Elf_Word*)( pData + sizeof( namesz ) ) );
|
||||
if ( 0 == descSize ) {
|
||||
desc = 0;
|
||||
}
|
||||
else {
|
||||
int align = sizeof( Elf_Xword );
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
align = sizeof( Elf_Word );
|
||||
}
|
||||
desc = const_cast<char*> ( pData + 3*sizeof( Elf_Word ) +
|
||||
( ( namesz + align - 1 ) / align ) * align );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void add_note( Elf_Word type,
|
||||
const std::string& name,
|
||||
const void* desc,
|
||||
Elf_Word descSize )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
Elf_Word nameLen = (Elf_Word)name.size() + 1;
|
||||
Elf_Word nameLenConv = convertor( nameLen );
|
||||
std::string buffer( reinterpret_cast<char*>( &nameLenConv ), sizeof( nameLenConv ) );
|
||||
Elf_Word descSizeConv = convertor( descSize );
|
||||
buffer.append( reinterpret_cast<char*>( &descSizeConv ), sizeof( descSizeConv ) );
|
||||
type = convertor( type );
|
||||
buffer.append( reinterpret_cast<char*>( &type ), sizeof( type ) );
|
||||
buffer.append( name );
|
||||
buffer.append( 1, '\x00' );
|
||||
const char pad[] = { '\0', '\0', '\0', '\0' };
|
||||
if ( nameLen % sizeof( Elf_Word ) != 0 ) {
|
||||
buffer.append( pad, sizeof( Elf_Word ) -
|
||||
nameLen % sizeof( Elf_Word ) );
|
||||
}
|
||||
if ( desc != 0 && descSize != 0 ) {
|
||||
buffer.append( reinterpret_cast<const char*>( desc ), descSize );
|
||||
if ( descSize % sizeof( Elf_Word ) != 0 ) {
|
||||
buffer.append( pad, sizeof( Elf_Word ) -
|
||||
descSize % sizeof( Elf_Word ) );
|
||||
}
|
||||
}
|
||||
|
||||
note_start_positions.push_back( note_section->get_size() );
|
||||
note_section->append_data( buffer );
|
||||
}
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void process_section()
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
const char* data = note_section->get_data();
|
||||
Elf_Xword size = note_section->get_size();
|
||||
Elf_Xword current = 0;
|
||||
|
||||
note_start_positions.clear();
|
||||
|
||||
// Is it empty?
|
||||
if ( 0 == data || 0 == size ) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ( current + 3*sizeof( Elf_Word ) <= size ) {
|
||||
note_start_positions.push_back( current );
|
||||
Elf_Word namesz = convertor(
|
||||
*(Elf_Word*)( data + current ) );
|
||||
Elf_Word descsz = convertor(
|
||||
*(Elf_Word*)( data + current + sizeof( namesz ) ) );
|
||||
|
||||
int align = sizeof( Elf_Xword );
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
align = sizeof( Elf_Word );
|
||||
}
|
||||
|
||||
current += 3*sizeof( Elf_Word ) +
|
||||
( ( namesz + align - 1 ) / align ) * align +
|
||||
( ( descsz + align - 1 ) / align ) * align;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
const elfio& elf_file;
|
||||
section* note_section;
|
||||
std::vector<Elf_Xword> note_start_positions;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_NOTE_HPP
|
||||
|
@ -1,374 +1,374 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_RELOCATION_HPP
|
||||
#define ELFI_RELOCATION_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
template<typename T> struct get_sym_and_type;
|
||||
template<> struct get_sym_and_type< Elf32_Rel >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_SYM( (Elf_Word)info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_TYPE( (Elf_Word)info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf32_Rela >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_SYM( (Elf_Word)info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_TYPE( (Elf_Word)info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf64_Rel >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_SYM( info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_TYPE( info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf64_Rela >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_SYM( info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_TYPE( info );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class relocation_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
relocation_section_accessor( elfio& elf_file_, section* section_ ) :
|
||||
elf_file( elf_file_ ),
|
||||
relocation_section( section_ )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Xword
|
||||
get_entries_num() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
|
||||
if ( 0 != relocation_section->get_entry_size() ) {
|
||||
nRet = relocation_section->get_size() / relocation_section->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_entry( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
if ( index >= get_entries_num() ) { // Is index valid
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
if ( SHT_REL == relocation_section->get_type() ) {
|
||||
generic_get_entry_rel< Elf32_Rel >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
else if ( SHT_RELA == relocation_section->get_type() ) {
|
||||
generic_get_entry_rela< Elf32_Rela >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( SHT_REL == relocation_section->get_type() ) {
|
||||
generic_get_entry_rel< Elf64_Rel >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
else if ( SHT_RELA == relocation_section->get_type() ) {
|
||||
generic_get_entry_rela< Elf64_Rela >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_entry( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf64_Addr& symbolValue,
|
||||
std::string& symbolName,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend,
|
||||
Elf_Sxword& calcValue ) const
|
||||
{
|
||||
// Do regular job
|
||||
Elf_Word symbol;
|
||||
bool ret = get_entry( index, offset, symbol, type, addend );
|
||||
|
||||
// Find the symbol
|
||||
Elf_Xword size;
|
||||
unsigned char bind;
|
||||
unsigned char symbolType;
|
||||
Elf_Half section;
|
||||
unsigned char other;
|
||||
|
||||
symbol_section_accessor symbols( elf_file, elf_file.sections[get_symbol_table_index()] );
|
||||
ret = symbols.get_symbol( symbol, symbolName, symbolValue,
|
||||
size, bind, symbolType, section, other );
|
||||
|
||||
if ( ret ) { // Was it successful?
|
||||
switch ( type ) {
|
||||
case R_386_NONE: // none
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_32: // S + A
|
||||
calcValue = symbolValue + addend;
|
||||
break;
|
||||
case R_386_PC32: // S + A - P
|
||||
calcValue = symbolValue + addend - offset;
|
||||
break;
|
||||
case R_386_GOT32: // G + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_PLT32: // L + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_COPY: // none
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_GLOB_DAT: // S
|
||||
case R_386_JMP_SLOT: // S
|
||||
calcValue = symbolValue;
|
||||
break;
|
||||
case R_386_RELATIVE: // B + A
|
||||
calcValue = addend;
|
||||
break;
|
||||
case R_386_GOTOFF: // S + A - GOT
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_GOTPC: // GOT + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
default: // Not recognized symbol!
|
||||
calcValue = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Xword info )
|
||||
{
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
generic_add_entry< Elf32_Rel >( offset, info );
|
||||
}
|
||||
else {
|
||||
generic_add_entry< Elf64_Rel >( offset, info );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Word symbol, unsigned char type )
|
||||
{
|
||||
Elf_Xword info;
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
info = ELF32_R_INFO( symbol, type );
|
||||
}
|
||||
else {
|
||||
info = ELF64_R_INFO( symbol, type );
|
||||
}
|
||||
|
||||
add_entry( offset, info );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Xword info, Elf_Sxword addend )
|
||||
{
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
generic_add_entry< Elf32_Rela >( offset, info, addend );
|
||||
}
|
||||
else {
|
||||
generic_add_entry< Elf64_Rela >( offset, info, addend );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Word symbol, unsigned char type,
|
||||
Elf_Sxword addend )
|
||||
{
|
||||
Elf_Xword info;
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
info = ELF32_R_INFO( symbol, type );
|
||||
}
|
||||
else {
|
||||
info = ELF64_R_INFO( symbol, type );
|
||||
}
|
||||
|
||||
add_entry( offset, info, addend );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( string_section_accessor str_writer,
|
||||
const char* str,
|
||||
symbol_section_accessor sym_writer,
|
||||
Elf64_Addr value,
|
||||
Elf_Word size,
|
||||
unsigned char sym_info,
|
||||
unsigned char other,
|
||||
Elf_Half shndx,
|
||||
Elf64_Addr offset,
|
||||
unsigned char type )
|
||||
{
|
||||
Elf_Word str_index = str_writer.add_string( str );
|
||||
Elf_Word sym_index = sym_writer.add_symbol( str_index, value, size,
|
||||
sym_info, other, shndx );
|
||||
add_entry( offset, sym_index, type );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_symbol_table_index() const
|
||||
{
|
||||
return (Elf_Half)relocation_section->get_link();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
getTargetSectionIndex() const
|
||||
{
|
||||
return (Elf_Half)relocation_section->get_info();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_get_entry_rel( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
const T* pEntry = reinterpret_cast<const T*>(
|
||||
relocation_section->get_data() +
|
||||
index * relocation_section->get_entry_size() );
|
||||
offset = convertor( pEntry->r_offset );
|
||||
Elf_Xword tmp = convertor( pEntry->r_info );
|
||||
symbol = get_sym_and_type<T>::get_r_sym( tmp );
|
||||
type = get_sym_and_type<T>::get_r_type( tmp );
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_get_entry_rela( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
const T* pEntry = reinterpret_cast<const T*>(
|
||||
relocation_section->get_data() +
|
||||
index * relocation_section->get_entry_size() );
|
||||
offset = convertor( pEntry->r_offset );
|
||||
Elf_Xword tmp = convertor( pEntry->r_info );
|
||||
symbol = get_sym_and_type<T>::get_r_sym( tmp );
|
||||
type = get_sym_and_type<T>::get_r_type( tmp );
|
||||
addend = convertor( pEntry->r_addend );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_add_entry( Elf64_Addr offset, Elf_Xword info )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.r_offset = convertor( offset );
|
||||
entry.r_info = convertor( info );
|
||||
|
||||
relocation_section->append_data( reinterpret_cast<char*>( &entry ), sizeof( entry ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_add_entry( Elf64_Addr offset, Elf_Xword info, Elf_Sxword addend )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.r_offset = offset;
|
||||
entry.r_info = info;
|
||||
entry.r_addend = addend;
|
||||
entry.r_offset = convertor( entry.r_offset );
|
||||
entry.r_info = convertor( entry.r_info );
|
||||
entry.r_addend = convertor( entry.r_addend );
|
||||
|
||||
relocation_section->append_data( reinterpret_cast<char*>( &entry ), sizeof( entry ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
elfio& elf_file;
|
||||
section* relocation_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_RELOCATION_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_RELOCATION_HPP
|
||||
#define ELFI_RELOCATION_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
template<typename T> struct get_sym_and_type;
|
||||
template<> struct get_sym_and_type< Elf32_Rel >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_SYM( (Elf_Word)info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_TYPE( (Elf_Word)info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf32_Rela >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_SYM( (Elf_Word)info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF32_R_TYPE( (Elf_Word)info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf64_Rel >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_SYM( info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_TYPE( info );
|
||||
}
|
||||
};
|
||||
template<> struct get_sym_and_type< Elf64_Rela >
|
||||
{
|
||||
static int get_r_sym( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_SYM( info );
|
||||
}
|
||||
static int get_r_type( Elf_Xword info )
|
||||
{
|
||||
return ELF64_R_TYPE( info );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class relocation_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
relocation_section_accessor( elfio& elf_file_, section* section_ ) :
|
||||
elf_file( elf_file_ ),
|
||||
relocation_section( section_ )
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Xword
|
||||
get_entries_num() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
|
||||
if ( 0 != relocation_section->get_entry_size() ) {
|
||||
nRet = relocation_section->get_size() / relocation_section->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_entry( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
if ( index >= get_entries_num() ) { // Is index valid
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
if ( SHT_REL == relocation_section->get_type() ) {
|
||||
generic_get_entry_rel< Elf32_Rel >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
else if ( SHT_RELA == relocation_section->get_type() ) {
|
||||
generic_get_entry_rela< Elf32_Rela >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( SHT_REL == relocation_section->get_type() ) {
|
||||
generic_get_entry_rel< Elf64_Rel >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
else if ( SHT_RELA == relocation_section->get_type() ) {
|
||||
generic_get_entry_rela< Elf64_Rela >( index, offset, symbol,
|
||||
type, addend );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_entry( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf64_Addr& symbolValue,
|
||||
std::string& symbolName,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend,
|
||||
Elf_Sxword& calcValue ) const
|
||||
{
|
||||
// Do regular job
|
||||
Elf_Word symbol;
|
||||
bool ret = get_entry( index, offset, symbol, type, addend );
|
||||
|
||||
// Find the symbol
|
||||
Elf_Xword size;
|
||||
unsigned char bind;
|
||||
unsigned char symbolType;
|
||||
Elf_Half section;
|
||||
unsigned char other;
|
||||
|
||||
symbol_section_accessor symbols( elf_file, elf_file.sections[get_symbol_table_index()] );
|
||||
ret = symbols.get_symbol( symbol, symbolName, symbolValue,
|
||||
size, bind, symbolType, section, other );
|
||||
|
||||
if ( ret ) { // Was it successful?
|
||||
switch ( type ) {
|
||||
case R_386_NONE: // none
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_32: // S + A
|
||||
calcValue = symbolValue + addend;
|
||||
break;
|
||||
case R_386_PC32: // S + A - P
|
||||
calcValue = symbolValue + addend - offset;
|
||||
break;
|
||||
case R_386_GOT32: // G + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_PLT32: // L + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_COPY: // none
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_GLOB_DAT: // S
|
||||
case R_386_JMP_SLOT: // S
|
||||
calcValue = symbolValue;
|
||||
break;
|
||||
case R_386_RELATIVE: // B + A
|
||||
calcValue = addend;
|
||||
break;
|
||||
case R_386_GOTOFF: // S + A - GOT
|
||||
calcValue = 0;
|
||||
break;
|
||||
case R_386_GOTPC: // GOT + A - P
|
||||
calcValue = 0;
|
||||
break;
|
||||
default: // Not recognized symbol!
|
||||
calcValue = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Xword info )
|
||||
{
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
generic_add_entry< Elf32_Rel >( offset, info );
|
||||
}
|
||||
else {
|
||||
generic_add_entry< Elf64_Rel >( offset, info );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Word symbol, unsigned char type )
|
||||
{
|
||||
Elf_Xword info;
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
info = ELF32_R_INFO( symbol, type );
|
||||
}
|
||||
else {
|
||||
info = ELF64_R_INFO( symbol, type );
|
||||
}
|
||||
|
||||
add_entry( offset, info );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Xword info, Elf_Sxword addend )
|
||||
{
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
generic_add_entry< Elf32_Rela >( offset, info, addend );
|
||||
}
|
||||
else {
|
||||
generic_add_entry< Elf64_Rela >( offset, info, addend );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( Elf64_Addr offset, Elf_Word symbol, unsigned char type,
|
||||
Elf_Sxword addend )
|
||||
{
|
||||
Elf_Xword info;
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
info = ELF32_R_INFO( symbol, type );
|
||||
}
|
||||
else {
|
||||
info = ELF64_R_INFO( symbol, type );
|
||||
}
|
||||
|
||||
add_entry( offset, info, addend );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
add_entry( string_section_accessor str_writer,
|
||||
const char* str,
|
||||
symbol_section_accessor sym_writer,
|
||||
Elf64_Addr value,
|
||||
Elf_Word size,
|
||||
unsigned char sym_info,
|
||||
unsigned char other,
|
||||
Elf_Half shndx,
|
||||
Elf64_Addr offset,
|
||||
unsigned char type )
|
||||
{
|
||||
Elf_Word str_index = str_writer.add_string( str );
|
||||
Elf_Word sym_index = sym_writer.add_symbol( str_index, value, size,
|
||||
sym_info, other, shndx );
|
||||
add_entry( offset, sym_index, type );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_symbol_table_index() const
|
||||
{
|
||||
return (Elf_Half)relocation_section->get_link();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
getTargetSectionIndex() const
|
||||
{
|
||||
return (Elf_Half)relocation_section->get_info();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_get_entry_rel( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
const T* pEntry = reinterpret_cast<const T*>(
|
||||
relocation_section->get_data() +
|
||||
index * relocation_section->get_entry_size() );
|
||||
offset = convertor( pEntry->r_offset );
|
||||
Elf_Xword tmp = convertor( pEntry->r_info );
|
||||
symbol = get_sym_and_type<T>::get_r_sym( tmp );
|
||||
type = get_sym_and_type<T>::get_r_type( tmp );
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_get_entry_rela( Elf_Xword index,
|
||||
Elf64_Addr& offset,
|
||||
Elf_Word& symbol,
|
||||
Elf_Word& type,
|
||||
Elf_Sxword& addend ) const
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
const T* pEntry = reinterpret_cast<const T*>(
|
||||
relocation_section->get_data() +
|
||||
index * relocation_section->get_entry_size() );
|
||||
offset = convertor( pEntry->r_offset );
|
||||
Elf_Xword tmp = convertor( pEntry->r_info );
|
||||
symbol = get_sym_and_type<T>::get_r_sym( tmp );
|
||||
type = get_sym_and_type<T>::get_r_type( tmp );
|
||||
addend = convertor( pEntry->r_addend );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_add_entry( Elf64_Addr offset, Elf_Xword info )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.r_offset = convertor( offset );
|
||||
entry.r_info = convertor( info );
|
||||
|
||||
relocation_section->append_data( reinterpret_cast<char*>( &entry ), sizeof( entry ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
void
|
||||
generic_add_entry( Elf64_Addr offset, Elf_Xword info, Elf_Sxword addend )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.r_offset = offset;
|
||||
entry.r_info = info;
|
||||
entry.r_addend = addend;
|
||||
entry.r_offset = convertor( entry.r_offset );
|
||||
entry.r_info = convertor( entry.r_info );
|
||||
entry.r_addend = convertor( entry.r_addend );
|
||||
|
||||
relocation_section->append_data( reinterpret_cast<char*>( &entry ), sizeof( entry ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
elfio& elf_file;
|
||||
section* relocation_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_RELOCATION_HPP
|
||||
|
@ -1,274 +1,274 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SECTION_HPP
|
||||
#define ELFI_SECTION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class section
|
||||
{
|
||||
friend class elfio;
|
||||
public:
|
||||
virtual ~section() {};
|
||||
|
||||
virtual Elf_Half get_index() const = 0;
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( std::string, name );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, info );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, link );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, addr_align );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, entry_size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, name_string_offset );
|
||||
|
||||
virtual const char* get_data() const = 0;
|
||||
virtual void set_data( const char* pData, Elf_Word size ) = 0;
|
||||
virtual void set_data( const std::string& data ) = 0;
|
||||
virtual void append_data( const char* pData, Elf_Word size ) = 0;
|
||||
virtual void append_data( const std::string& data ) = 0;
|
||||
|
||||
protected:
|
||||
virtual void set_index( Elf_Half ) = 0;
|
||||
virtual void load( std::ifstream& f,
|
||||
std::streampos header_offset ) = 0;
|
||||
virtual void save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset ) = 0;
|
||||
virtual bool is_address_initialized() const = 0;
|
||||
};
|
||||
|
||||
|
||||
template< class T >
|
||||
class section_impl : public section
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
section_impl( const endianess_convertor* convertor_ ) : convertor( convertor_ )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
is_address_set = false;
|
||||
data = 0;
|
||||
data_size = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
~section_impl()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Section info functions
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, type, header.sh_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, flags, header.sh_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, size, header.sh_size );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, link, header.sh_link );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, info, header.sh_info );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, addr_align, header.sh_addralign );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, entry_size, header.sh_entsize );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, name_string_offset, header.sh_name );
|
||||
ELFIO_GET_ACCESS ( Elf64_Addr, address, header.sh_addr );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
std::string
|
||||
get_name() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_name( std::string name_ )
|
||||
{
|
||||
name = name_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_address( Elf64_Addr value )
|
||||
{
|
||||
header.sh_addr = value;
|
||||
header.sh_addr = (*convertor)( header.sh_addr );
|
||||
is_address_set = true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
is_address_initialized() const
|
||||
{
|
||||
return is_address_set;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_data() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_data( const char* raw_data, Elf_Word size )
|
||||
{
|
||||
if ( get_type() != SHT_NOBITS ) {
|
||||
delete [] data;
|
||||
data = new char[size];
|
||||
if ( 0 != data && 0 != raw_data ) {
|
||||
data_size = size;
|
||||
std::copy( raw_data, raw_data + size, data );
|
||||
}
|
||||
}
|
||||
|
||||
set_size( size );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_data( const std::string& str_data )
|
||||
{
|
||||
return set_data( str_data.c_str(), (Elf_Word)str_data.size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
append_data( const char* raw_data, Elf_Word size )
|
||||
{
|
||||
if ( get_type() != SHT_NOBITS ) {
|
||||
if ( get_size() + size < data_size ) {
|
||||
std::copy( raw_data, raw_data + size, data + get_size() );
|
||||
}
|
||||
else {
|
||||
data_size = 2*( data_size + size);
|
||||
char* new_data = new char[data_size];
|
||||
if ( 0 != new_data ) {
|
||||
std::copy( data, data + get_size(), new_data );
|
||||
std::copy( raw_data, raw_data + size, new_data + get_size() );
|
||||
delete [] data;
|
||||
data = new_data;
|
||||
}
|
||||
}
|
||||
set_size( get_size() + size );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
append_data( const std::string& str_data )
|
||||
{
|
||||
return append_data( str_data.c_str(), (Elf_Word)str_data.size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
protected:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_index( Elf_Half value )
|
||||
{
|
||||
index = value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
load( std::ifstream& stream,
|
||||
std::streampos header_offset )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
stream.seekg( header_offset );
|
||||
stream.read( reinterpret_cast<char*>( &header ), sizeof( header ) );
|
||||
|
||||
Elf_Xword size = get_size();
|
||||
if ( 0 == data && SHT_NULL != get_type() && SHT_NOBITS != get_type() &&
|
||||
0 != size ) {
|
||||
data = new char[size];
|
||||
stream.seekg( (*convertor)( header.sh_offset ) );
|
||||
stream.read( data, size );
|
||||
data_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset )
|
||||
{
|
||||
if ( 0 != get_index() ) {
|
||||
header.sh_offset = data_offset;
|
||||
header.sh_offset = (*convertor)( header.sh_offset );
|
||||
}
|
||||
|
||||
save_header( f, header_offset );
|
||||
if ( get_type() != SHT_NOBITS && get_type() != SHT_NULL &&
|
||||
get_size() != 0 && data != 0 ) {
|
||||
save_data( f, data_offset );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save_header( std::ofstream& f,
|
||||
std::streampos header_offset ) const
|
||||
{
|
||||
f.seekp( header_offset );
|
||||
f.write( reinterpret_cast<const char*>( &header ), sizeof( header ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save_data( std::ofstream& f,
|
||||
std::streampos data_offset ) const
|
||||
{
|
||||
f.seekp( data_offset );
|
||||
f.write( get_data(), get_size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
mutable T header;
|
||||
Elf_Half index;
|
||||
std::string name;
|
||||
char* data;
|
||||
Elf_Word data_size;
|
||||
const endianess_convertor* convertor;
|
||||
bool is_address_set;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SECTION_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SECTION_HPP
|
||||
#define ELFI_SECTION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class section
|
||||
{
|
||||
friend class elfio;
|
||||
public:
|
||||
virtual ~section() {};
|
||||
|
||||
virtual Elf_Half get_index() const = 0;
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( std::string, name );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, info );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, link );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, addr_align );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, entry_size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, name_string_offset );
|
||||
|
||||
virtual const char* get_data() const = 0;
|
||||
virtual void set_data( const char* pData, Elf_Word size ) = 0;
|
||||
virtual void set_data( const std::string& data ) = 0;
|
||||
virtual void append_data( const char* pData, Elf_Word size ) = 0;
|
||||
virtual void append_data( const std::string& data ) = 0;
|
||||
|
||||
protected:
|
||||
virtual void set_index( Elf_Half ) = 0;
|
||||
virtual void load( std::ifstream& f,
|
||||
std::streampos header_offset ) = 0;
|
||||
virtual void save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset ) = 0;
|
||||
virtual bool is_address_initialized() const = 0;
|
||||
};
|
||||
|
||||
|
||||
template< class T >
|
||||
class section_impl : public section
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
section_impl( const endianess_convertor* convertor_ ) : convertor( convertor_ )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
is_address_set = false;
|
||||
data = 0;
|
||||
data_size = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
~section_impl()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Section info functions
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, type, header.sh_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, flags, header.sh_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, size, header.sh_size );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, link, header.sh_link );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, info, header.sh_info );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, addr_align, header.sh_addralign );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, entry_size, header.sh_entsize );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, name_string_offset, header.sh_name );
|
||||
ELFIO_GET_ACCESS ( Elf64_Addr, address, header.sh_addr );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
std::string
|
||||
get_name() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_name( std::string name_ )
|
||||
{
|
||||
name = name_;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_address( Elf64_Addr value )
|
||||
{
|
||||
header.sh_addr = value;
|
||||
header.sh_addr = (*convertor)( header.sh_addr );
|
||||
is_address_set = true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
is_address_initialized() const
|
||||
{
|
||||
return is_address_set;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_data() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_data( const char* raw_data, Elf_Word size )
|
||||
{
|
||||
if ( get_type() != SHT_NOBITS ) {
|
||||
delete [] data;
|
||||
data = new char[size];
|
||||
if ( 0 != data && 0 != raw_data ) {
|
||||
data_size = size;
|
||||
std::copy( raw_data, raw_data + size, data );
|
||||
}
|
||||
}
|
||||
|
||||
set_size( size );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_data( const std::string& str_data )
|
||||
{
|
||||
return set_data( str_data.c_str(), (Elf_Word)str_data.size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
append_data( const char* raw_data, Elf_Word size )
|
||||
{
|
||||
if ( get_type() != SHT_NOBITS ) {
|
||||
if ( get_size() + size < data_size ) {
|
||||
std::copy( raw_data, raw_data + size, data + get_size() );
|
||||
}
|
||||
else {
|
||||
data_size = 2*( data_size + size);
|
||||
char* new_data = new char[data_size];
|
||||
if ( 0 != new_data ) {
|
||||
std::copy( data, data + get_size(), new_data );
|
||||
std::copy( raw_data, raw_data + size, new_data + get_size() );
|
||||
delete [] data;
|
||||
data = new_data;
|
||||
}
|
||||
}
|
||||
set_size( get_size() + size );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
append_data( const std::string& str_data )
|
||||
{
|
||||
return append_data( str_data.c_str(), (Elf_Word)str_data.size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
protected:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_index( Elf_Half value )
|
||||
{
|
||||
index = value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
load( std::ifstream& stream,
|
||||
std::streampos header_offset )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &header ), sizeof( header ), '\0' );
|
||||
stream.seekg( header_offset );
|
||||
stream.read( reinterpret_cast<char*>( &header ), sizeof( header ) );
|
||||
|
||||
Elf_Xword size = get_size();
|
||||
if ( 0 == data && SHT_NULL != get_type() && SHT_NOBITS != get_type() &&
|
||||
0 != size ) {
|
||||
data = new char[size];
|
||||
stream.seekg( (*convertor)( header.sh_offset ) );
|
||||
stream.read( data, size );
|
||||
data_size = size;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset )
|
||||
{
|
||||
if ( 0 != get_index() ) {
|
||||
header.sh_offset = data_offset;
|
||||
header.sh_offset = (*convertor)( header.sh_offset );
|
||||
}
|
||||
|
||||
save_header( f, header_offset );
|
||||
if ( get_type() != SHT_NOBITS && get_type() != SHT_NULL &&
|
||||
get_size() != 0 && data != 0 ) {
|
||||
save_data( f, data_offset );
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save_header( std::ofstream& f,
|
||||
std::streampos header_offset ) const
|
||||
{
|
||||
f.seekp( header_offset );
|
||||
f.write( reinterpret_cast<const char*>( &header ), sizeof( header ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
save_data( std::ofstream& f,
|
||||
std::streampos data_offset ) const
|
||||
{
|
||||
f.seekp( data_offset );
|
||||
f.write( get_data(), get_size() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
mutable T header;
|
||||
Elf_Half index;
|
||||
std::string name;
|
||||
char* data;
|
||||
Elf_Word data_size;
|
||||
const endianess_convertor* convertor;
|
||||
bool is_address_set;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SECTION_HPP
|
||||
|
@ -1,182 +1,182 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SEGMENT_HPP
|
||||
#define ELFI_SEGMENT_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class segment
|
||||
{
|
||||
friend class elfio;
|
||||
public:
|
||||
virtual ~segment() {};
|
||||
|
||||
virtual Elf_Half get_index() const = 0;
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, align );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, virtual_address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, physical_address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, file_size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, memory_size );
|
||||
|
||||
virtual const char* get_data() const = 0;
|
||||
|
||||
virtual Elf_Half add_section_index( Elf_Half index, Elf_Xword addr_align ) = 0;
|
||||
virtual Elf_Half get_sections_num() const = 0;
|
||||
virtual Elf_Half get_section_index_at( Elf_Half num ) const = 0;
|
||||
|
||||
protected:
|
||||
virtual void set_index( Elf_Half ) = 0;
|
||||
virtual void load( std::ifstream& stream, std::streampos header_offset ) const = 0;
|
||||
virtual void save( std::ofstream& f, std::streampos header_offset,
|
||||
std::streampos data_offset ) = 0;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
class segment_impl : public segment
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
segment_impl( endianess_convertor* convertor_ ) :
|
||||
convertor( convertor_ )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &ph ), sizeof( ph ), '\0' );
|
||||
data = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
virtual ~segment_impl()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Section info functions
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, type, ph.p_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, flags, ph.p_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, align, ph.p_align );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, virtual_address, ph.p_vaddr );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, physical_address, ph.p_paddr );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, file_size, ph.p_filesz );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, memory_size, ph.p_memsz );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_data() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
add_section_index( Elf_Half index, Elf_Xword addr_align )
|
||||
{
|
||||
sections.push_back( index );
|
||||
if ( addr_align > get_align() ) {
|
||||
set_align( addr_align );
|
||||
}
|
||||
|
||||
return (Elf_Half)sections.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_sections_num() const
|
||||
{
|
||||
return (Elf_Half)sections.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_section_index_at( Elf_Half num ) const
|
||||
{
|
||||
if ( num < sections.size() ) {
|
||||
return sections[num];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
protected:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_index( Elf_Half value )
|
||||
{
|
||||
index = value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
load( std::ifstream& stream,
|
||||
std::streampos header_offset ) const
|
||||
{
|
||||
stream.seekg( header_offset );
|
||||
stream.read( reinterpret_cast<char*>( &ph ), sizeof( ph ) );
|
||||
|
||||
if ( PT_NULL != get_type() && 0 != get_file_size() ) {
|
||||
stream.seekg( (*convertor)( ph.p_offset ) );
|
||||
Elf_Xword size = get_file_size();
|
||||
data = new char[size];
|
||||
if ( 0 != data ) {
|
||||
stream.read( data, size );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset )
|
||||
{
|
||||
ph.p_offset = data_offset;
|
||||
f.seekp( header_offset );
|
||||
f.write( reinterpret_cast<const char*>( &ph ), sizeof( ph ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
mutable T ph;
|
||||
Elf_Half index;
|
||||
mutable char* data;
|
||||
std::vector<Elf_Half> sections;
|
||||
endianess_convertor* convertor;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SEGMENT_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SEGMENT_HPP
|
||||
#define ELFI_SEGMENT_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
class segment
|
||||
{
|
||||
friend class elfio;
|
||||
public:
|
||||
virtual ~segment() {};
|
||||
|
||||
virtual Elf_Half get_index() const = 0;
|
||||
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, type );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Word, flags );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, align );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, virtual_address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf64_Addr, physical_address );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, file_size );
|
||||
ELFIO_GET_SET_ACCESS_DECL( Elf_Xword, memory_size );
|
||||
|
||||
virtual const char* get_data() const = 0;
|
||||
|
||||
virtual Elf_Half add_section_index( Elf_Half index, Elf_Xword addr_align ) = 0;
|
||||
virtual Elf_Half get_sections_num() const = 0;
|
||||
virtual Elf_Half get_section_index_at( Elf_Half num ) const = 0;
|
||||
|
||||
protected:
|
||||
virtual void set_index( Elf_Half ) = 0;
|
||||
virtual void load( std::ifstream& stream, std::streampos header_offset ) const = 0;
|
||||
virtual void save( std::ofstream& f, std::streampos header_offset,
|
||||
std::streampos data_offset ) = 0;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
class segment_impl : public segment
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
segment_impl( endianess_convertor* convertor_ ) :
|
||||
convertor( convertor_ )
|
||||
{
|
||||
std::fill_n( reinterpret_cast<char*>( &ph ), sizeof( ph ), '\0' );
|
||||
data = 0;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
virtual ~segment_impl()
|
||||
{
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Section info functions
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, type, ph.p_type );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Word, flags, ph.p_flags );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, align, ph.p_align );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, virtual_address, ph.p_vaddr );
|
||||
ELFIO_GET_SET_ACCESS( Elf64_Addr, physical_address, ph.p_paddr );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, file_size, ph.p_filesz );
|
||||
ELFIO_GET_SET_ACCESS( Elf_Xword, memory_size, ph.p_memsz );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_data() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
add_section_index( Elf_Half index, Elf_Xword addr_align )
|
||||
{
|
||||
sections.push_back( index );
|
||||
if ( addr_align > get_align() ) {
|
||||
set_align( addr_align );
|
||||
}
|
||||
|
||||
return (Elf_Half)sections.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_sections_num() const
|
||||
{
|
||||
return (Elf_Half)sections.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_section_index_at( Elf_Half num ) const
|
||||
{
|
||||
if ( num < sections.size() ) {
|
||||
return sections[num];
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
protected:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
set_index( Elf_Half value )
|
||||
{
|
||||
index = value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
load( std::ifstream& stream,
|
||||
std::streampos header_offset ) const
|
||||
{
|
||||
stream.seekg( header_offset );
|
||||
stream.read( reinterpret_cast<char*>( &ph ), sizeof( ph ) );
|
||||
|
||||
if ( PT_NULL != get_type() && 0 != get_file_size() ) {
|
||||
stream.seekg( (*convertor)( ph.p_offset ) );
|
||||
Elf_Xword size = get_file_size();
|
||||
data = new char[size];
|
||||
if ( 0 != data ) {
|
||||
stream.read( data, size );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void save( std::ofstream& f,
|
||||
std::streampos header_offset,
|
||||
std::streampos data_offset )
|
||||
{
|
||||
ph.p_offset = data_offset;
|
||||
f.seekp( header_offset );
|
||||
f.write( reinterpret_cast<const char*>( &ph ), sizeof( ph ) );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
mutable T ph;
|
||||
Elf_Half index;
|
||||
mutable char* data;
|
||||
std::vector<Elf_Half> sections;
|
||||
endianess_convertor* convertor;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SEGMENT_HPP
|
||||
|
@ -1,101 +1,101 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_STRINGS_HPP
|
||||
#define ELFIO_STRINGS_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class string_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
string_section_accessor( section* section_ ) :
|
||||
string_section( section_ )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_string( Elf_Word index ) const
|
||||
{
|
||||
if ( index < string_section->get_size() ) {
|
||||
const char* data = string_section->get_data();
|
||||
if ( 0 != data ) {
|
||||
return data + index;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_string( const char* str )
|
||||
{
|
||||
// Strings are addeded to the end of the current section data
|
||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
||||
|
||||
if ( current_position == 0 ) {
|
||||
char empty_string[1] = {'\0'};
|
||||
string_section->append_data( empty_string, 1 );
|
||||
current_position++;
|
||||
}
|
||||
string_section->append_data( str, (Elf_Word)std::strlen( str ) + 1 );
|
||||
|
||||
return current_position;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_string( const std::string& str )
|
||||
{
|
||||
// Strings are addeded to the end of the current section data
|
||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
||||
|
||||
char empty_string[1] = {'\0'};
|
||||
if ( current_position == 0 ) {
|
||||
string_section->append_data( empty_string, 1 );
|
||||
current_position++;
|
||||
}
|
||||
string_section->append_data( str );
|
||||
string_section->append_data( empty_string, 1 );
|
||||
|
||||
return current_position;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
section* string_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_STRINGS_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_STRINGS_HPP
|
||||
#define ELFIO_STRINGS_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class string_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
string_section_accessor( section* section_ ) :
|
||||
string_section( section_ )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char*
|
||||
get_string( Elf_Word index ) const
|
||||
{
|
||||
if ( index < string_section->get_size() ) {
|
||||
const char* data = string_section->get_data();
|
||||
if ( 0 != data ) {
|
||||
return data + index;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_string( const char* str )
|
||||
{
|
||||
// Strings are addeded to the end of the current section data
|
||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
||||
|
||||
if ( current_position == 0 ) {
|
||||
char empty_string[1] = {'\0'};
|
||||
string_section->append_data( empty_string, 1 );
|
||||
current_position++;
|
||||
}
|
||||
string_section->append_data( str, (Elf_Word)std::strlen( str ) + 1 );
|
||||
|
||||
return current_position;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_string( const std::string& str )
|
||||
{
|
||||
// Strings are addeded to the end of the current section data
|
||||
Elf_Word current_position = (Elf_Word)string_section->get_size();
|
||||
|
||||
char empty_string[1] = {'\0'};
|
||||
if ( current_position == 0 ) {
|
||||
string_section->append_data( empty_string, 1 );
|
||||
current_position++;
|
||||
}
|
||||
string_section->append_data( str );
|
||||
string_section->append_data( empty_string, 1 );
|
||||
|
||||
return current_position;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
section* string_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_STRINGS_HPP
|
||||
|
@ -1,276 +1,276 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SYMBOLS_HPP
|
||||
#define ELFI_SYMBOLS_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class symbol_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
symbol_section_accessor( const elfio& elf_file_, section* symbol_section_ ) :
|
||||
elf_file( elf_file_ ),
|
||||
symbol_section( symbol_section_ )
|
||||
{
|
||||
find_hash_section();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Xword
|
||||
get_symbols_num() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
if ( 0 != symbol_section->get_entry_size() ) {
|
||||
nRet = symbol_section->get_size() / symbol_section->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_symbol( Elf_Xword index,
|
||||
std::string& name,
|
||||
Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind,
|
||||
unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
ret = generic_get_symbol<Elf32_Sym>( index, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
}
|
||||
else {
|
||||
ret = generic_get_symbol<Elf64_Sym>( index, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_symbol( std::string& name,
|
||||
Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind,
|
||||
unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( 0 != get_hash_table_index() ) {
|
||||
Elf_Word nbucket = *(Elf_Word*)hash_section->get_data();
|
||||
Elf_Word val = elf_hash( (const unsigned char*)name.c_str() );
|
||||
|
||||
Elf_Word y = *(Elf_Word*)( hash_section->get_data() +
|
||||
( 2 + val % nbucket ) * sizeof( Elf_Word ) );
|
||||
std::string str;
|
||||
get_symbol( y, str, value, size, bind, type, section_index, other );
|
||||
while ( str != name && STN_UNDEF != y ) {
|
||||
y = *(Elf_Word*)( hash_section->get_data() +
|
||||
( 2 + nbucket + y ) * sizeof( Elf_Word ) );
|
||||
get_symbol( y, str, value, size, bind, type, section_index, other );
|
||||
}
|
||||
if ( str == name ) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
Elf_Word nRet;
|
||||
|
||||
if ( symbol_section->get_size() == 0 ) {
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
nRet = generic_add_symbol<Elf32_Sym>( 0, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
else {
|
||||
nRet = generic_add_symbol<Elf64_Sym>( 0, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
nRet = generic_add_symbol<Elf32_Sym>( name, value, size, info, other,
|
||||
shndx );
|
||||
}
|
||||
else {
|
||||
nRet = generic_add_symbol<Elf64_Sym>( name, value, size, info, other,
|
||||
shndx );
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char bind, unsigned char type, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
return add_symbol( name, value, size, ELF_ST_INFO( bind, type ), other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( string_section_accessor& pStrWriter, const char* str,
|
||||
Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
Elf_Word index = pStrWriter.add_string( str );
|
||||
return add_symbol( index, value, size, info, other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( string_section_accessor& pStrWriter, const char* str,
|
||||
Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char bind, unsigned char type, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
return add_symbol( pStrWriter, str, value, size, ELF_ST_INFO( bind, type ), other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
find_hash_section()
|
||||
{
|
||||
hash_section = 0;
|
||||
hash_section_index = 0;
|
||||
Elf_Half nSecNo = elf_file.sections.size();
|
||||
for ( Elf_Half i = 0; i < nSecNo && 0 == hash_section_index; ++i ) {
|
||||
const section* sec = elf_file.sections[i];
|
||||
if ( sec->get_link() == symbol_section->get_index() ) {
|
||||
hash_section = sec;
|
||||
hash_section_index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_string_table_index() const
|
||||
{
|
||||
return (Elf_Half)symbol_section->get_link();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_hash_table_index() const
|
||||
{
|
||||
return hash_section_index;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
bool
|
||||
generic_get_symbol( Elf_Xword index,
|
||||
std::string& name, Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind, unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( index < get_symbols_num() ) {
|
||||
const T* pSym = reinterpret_cast<const T*>(
|
||||
symbol_section->get_data() +
|
||||
index * symbol_section->get_entry_size() );
|
||||
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
section* string_section = elf_file.sections[get_string_table_index()];
|
||||
string_section_accessor str_reader( string_section );
|
||||
const char* pStr = str_reader.get_string( convertor( pSym->st_name ) );
|
||||
if ( 0 != pStr ) {
|
||||
name = pStr;
|
||||
}
|
||||
value = convertor( pSym->st_value );
|
||||
size = convertor( pSym->st_size );
|
||||
bind = ELF_ST_BIND( pSym->st_info );
|
||||
type = ELF_ST_TYPE( pSym->st_info );
|
||||
section_index = convertor( pSym->st_shndx );
|
||||
other = pSym->st_other;
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
Elf_Word
|
||||
generic_add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.st_name = convertor( name );
|
||||
entry.st_value = value;
|
||||
entry.st_value = convertor( entry.st_value );
|
||||
entry.st_size = size;
|
||||
entry.st_size = convertor( entry.st_size );
|
||||
entry.st_info = convertor( info );
|
||||
entry.st_other = convertor( other );
|
||||
entry.st_shndx = convertor( shndx );
|
||||
|
||||
symbol_section->append_data( reinterpret_cast<char*>( &entry ),
|
||||
sizeof( entry ) );
|
||||
|
||||
Elf_Word nRet = symbol_section->get_size() / sizeof( entry ) - 1;
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
const elfio& elf_file;
|
||||
section* symbol_section;
|
||||
Elf_Half hash_section_index;
|
||||
const section* hash_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SYMBOLS_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFI_SYMBOLS_HPP
|
||||
#define ELFI_SYMBOLS_HPP
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class symbol_section_accessor
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
symbol_section_accessor( const elfio& elf_file_, section* symbol_section_ ) :
|
||||
elf_file( elf_file_ ),
|
||||
symbol_section( symbol_section_ )
|
||||
{
|
||||
find_hash_section();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Xword
|
||||
get_symbols_num() const
|
||||
{
|
||||
Elf_Xword nRet = 0;
|
||||
if ( 0 != symbol_section->get_entry_size() ) {
|
||||
nRet = symbol_section->get_size() / symbol_section->get_entry_size();
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_symbol( Elf_Xword index,
|
||||
std::string& name,
|
||||
Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind,
|
||||
unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
ret = generic_get_symbol<Elf32_Sym>( index, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
}
|
||||
else {
|
||||
ret = generic_get_symbol<Elf64_Sym>( index, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool
|
||||
get_symbol( std::string& name,
|
||||
Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind,
|
||||
unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( 0 != get_hash_table_index() ) {
|
||||
Elf_Word nbucket = *(Elf_Word*)hash_section->get_data();
|
||||
Elf_Word val = elf_hash( (const unsigned char*)name.c_str() );
|
||||
|
||||
Elf_Word y = *(Elf_Word*)( hash_section->get_data() +
|
||||
( 2 + val % nbucket ) * sizeof( Elf_Word ) );
|
||||
std::string str;
|
||||
get_symbol( y, str, value, size, bind, type, section_index, other );
|
||||
while ( str != name && STN_UNDEF != y ) {
|
||||
y = *(Elf_Word*)( hash_section->get_data() +
|
||||
( 2 + nbucket + y ) * sizeof( Elf_Word ) );
|
||||
get_symbol( y, str, value, size, bind, type, section_index, other );
|
||||
}
|
||||
if ( str == name ) {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
Elf_Word nRet;
|
||||
|
||||
if ( symbol_section->get_size() == 0 ) {
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
nRet = generic_add_symbol<Elf32_Sym>( 0, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
else {
|
||||
nRet = generic_add_symbol<Elf64_Sym>( 0, 0, 0, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( elf_file.get_class() == ELFCLASS32 ) {
|
||||
nRet = generic_add_symbol<Elf32_Sym>( name, value, size, info, other,
|
||||
shndx );
|
||||
}
|
||||
else {
|
||||
nRet = generic_add_symbol<Elf64_Sym>( name, value, size, info, other,
|
||||
shndx );
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char bind, unsigned char type, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
return add_symbol( name, value, size, ELF_ST_INFO( bind, type ), other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( string_section_accessor& pStrWriter, const char* str,
|
||||
Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
Elf_Word index = pStrWriter.add_string( str );
|
||||
return add_symbol( index, value, size, info, other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Word
|
||||
add_symbol( string_section_accessor& pStrWriter, const char* str,
|
||||
Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char bind, unsigned char type, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
return add_symbol( pStrWriter, str, value, size, ELF_ST_INFO( bind, type ), other, shndx );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
find_hash_section()
|
||||
{
|
||||
hash_section = 0;
|
||||
hash_section_index = 0;
|
||||
Elf_Half nSecNo = elf_file.sections.size();
|
||||
for ( Elf_Half i = 0; i < nSecNo && 0 == hash_section_index; ++i ) {
|
||||
const section* sec = elf_file.sections[i];
|
||||
if ( sec->get_link() == symbol_section->get_index() ) {
|
||||
hash_section = sec;
|
||||
hash_section_index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_string_table_index() const
|
||||
{
|
||||
return (Elf_Half)symbol_section->get_link();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Elf_Half
|
||||
get_hash_table_index() const
|
||||
{
|
||||
return hash_section_index;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
bool
|
||||
generic_get_symbol( Elf_Xword index,
|
||||
std::string& name, Elf64_Addr& value,
|
||||
Elf_Xword& size,
|
||||
unsigned char& bind, unsigned char& type,
|
||||
Elf_Half& section_index,
|
||||
unsigned char& other ) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if ( index < get_symbols_num() ) {
|
||||
const T* pSym = reinterpret_cast<const T*>(
|
||||
symbol_section->get_data() +
|
||||
index * symbol_section->get_entry_size() );
|
||||
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
section* string_section = elf_file.sections[get_string_table_index()];
|
||||
string_section_accessor str_reader( string_section );
|
||||
const char* pStr = str_reader.get_string( convertor( pSym->st_name ) );
|
||||
if ( 0 != pStr ) {
|
||||
name = pStr;
|
||||
}
|
||||
value = convertor( pSym->st_value );
|
||||
size = convertor( pSym->st_size );
|
||||
bind = ELF_ST_BIND( pSym->st_info );
|
||||
type = ELF_ST_TYPE( pSym->st_info );
|
||||
section_index = convertor( pSym->st_shndx );
|
||||
other = pSym->st_other;
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template< class T >
|
||||
Elf_Word
|
||||
generic_add_symbol( Elf_Word name, Elf64_Addr value, Elf_Xword size,
|
||||
unsigned char info, unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
const endianess_convertor& convertor = elf_file.get_convertor();
|
||||
|
||||
T entry;
|
||||
entry.st_name = convertor( name );
|
||||
entry.st_value = value;
|
||||
entry.st_value = convertor( entry.st_value );
|
||||
entry.st_size = size;
|
||||
entry.st_size = convertor( entry.st_size );
|
||||
entry.st_info = convertor( info );
|
||||
entry.st_other = convertor( other );
|
||||
entry.st_shndx = convertor( shndx );
|
||||
|
||||
symbol_section->append_data( reinterpret_cast<char*>( &entry ),
|
||||
sizeof( entry ) );
|
||||
|
||||
Elf_Word nRet = symbol_section->get_size() / sizeof( entry ) - 1;
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
const elfio& elf_file;
|
||||
section* symbol_section;
|
||||
Elf_Half hash_section_index;
|
||||
const section* hash_section;
|
||||
};
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFI_SYMBOLS_HPP
|
||||
|
@ -1,209 +1,209 @@
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_UTILS_HPP
|
||||
#define ELFIO_UTILS_HPP
|
||||
|
||||
#define ELFIO_GET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
TYPE get_##NAME() const \
|
||||
{ \
|
||||
return (*convertor)( FIELD ); \
|
||||
}
|
||||
#define ELFIO_SET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
void set_##NAME( TYPE value ) \
|
||||
{ \
|
||||
FIELD = value; \
|
||||
FIELD = (*convertor)( FIELD ); \
|
||||
}
|
||||
#define ELFIO_GET_SET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
TYPE get_##NAME() const \
|
||||
{ \
|
||||
return (*convertor)( FIELD ); \
|
||||
} \
|
||||
void set_##NAME( TYPE value ) \
|
||||
{ \
|
||||
FIELD = value; \
|
||||
FIELD = (*convertor)( FIELD ); \
|
||||
}
|
||||
|
||||
#define ELFIO_GET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual TYPE get_##NAME() const = 0;
|
||||
|
||||
#define ELFIO_SET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual void set_##NAME( TYPE value ) = 0;
|
||||
|
||||
#define ELFIO_GET_SET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual TYPE get_##NAME() const = 0; \
|
||||
virtual void set_##NAME( TYPE value ) = 0;
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class endianess_convertor {
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
endianess_convertor()
|
||||
{
|
||||
need_conversion = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
setup( unsigned char elf_file_encoding )
|
||||
{
|
||||
need_conversion = ( elf_file_encoding != get_host_encoding() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint64_t
|
||||
operator()( uint64_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x00000000000000FFull ) << 56 ) |
|
||||
( ( value & 0x000000000000FF00ull ) << 40 ) |
|
||||
( ( value & 0x0000000000FF0000ull ) << 24 ) |
|
||||
( ( value & 0x00000000FF000000ull ) << 8 ) |
|
||||
( ( value & 0x000000FF00000000ull ) >> 8 ) |
|
||||
( ( value & 0x0000FF0000000000ull ) >> 24 ) |
|
||||
( ( value & 0x00FF000000000000ull ) >> 40 ) |
|
||||
( ( value & 0xFF00000000000000ull ) >> 56 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int64_t
|
||||
operator()( int64_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int64_t)(*this)( (uint64_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint32_t
|
||||
operator()( uint32_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x000000FF ) << 24 ) |
|
||||
( ( value & 0x0000FF00 ) << 8 ) |
|
||||
( ( value & 0x00FF0000 ) >> 8 ) |
|
||||
( ( value & 0xFF000000 ) >> 24 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int32_t
|
||||
operator()( int32_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int32_t)(*this)( (uint32_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t
|
||||
operator()( uint16_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x00FF ) << 8 ) |
|
||||
( ( value & 0xFF00 ) >> 8 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int16_t
|
||||
operator()( int16_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int16_t)(*this)( (uint16_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int8_t
|
||||
operator()( int8_t value ) const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
operator()( uint8_t value ) const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned char
|
||||
get_host_encoding() const
|
||||
{
|
||||
static const int tmp = 1;
|
||||
if ( 1 == *(char*)&tmp ) {
|
||||
return ELFDATA2LSB;
|
||||
}
|
||||
else {
|
||||
return ELFDATA2MSB;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
bool need_conversion;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline
|
||||
uint32_t
|
||||
elf_hash( const unsigned char *name )
|
||||
{
|
||||
uint32_t h = 0, g;
|
||||
while ( *name ) {
|
||||
h = (h << 4) + *name++;
|
||||
g = h & 0xf0000000;
|
||||
if ( g != 0 )
|
||||
h ^= g >> 24;
|
||||
h &= ~g;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_UTILS_HPP
|
||||
/*
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef ELFIO_UTILS_HPP
|
||||
#define ELFIO_UTILS_HPP
|
||||
|
||||
#define ELFIO_GET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
TYPE get_##NAME() const \
|
||||
{ \
|
||||
return (*convertor)( FIELD ); \
|
||||
}
|
||||
#define ELFIO_SET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
void set_##NAME( TYPE value ) \
|
||||
{ \
|
||||
FIELD = value; \
|
||||
FIELD = (*convertor)( FIELD ); \
|
||||
}
|
||||
#define ELFIO_GET_SET_ACCESS( TYPE, NAME, FIELD ) \
|
||||
TYPE get_##NAME() const \
|
||||
{ \
|
||||
return (*convertor)( FIELD ); \
|
||||
} \
|
||||
void set_##NAME( TYPE value ) \
|
||||
{ \
|
||||
FIELD = value; \
|
||||
FIELD = (*convertor)( FIELD ); \
|
||||
}
|
||||
|
||||
#define ELFIO_GET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual TYPE get_##NAME() const = 0;
|
||||
|
||||
#define ELFIO_SET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual void set_##NAME( TYPE value ) = 0;
|
||||
|
||||
#define ELFIO_GET_SET_ACCESS_DECL( TYPE, NAME ) \
|
||||
virtual TYPE get_##NAME() const = 0; \
|
||||
virtual void set_##NAME( TYPE value ) = 0;
|
||||
|
||||
namespace ELFIO {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class endianess_convertor {
|
||||
public:
|
||||
//------------------------------------------------------------------------------
|
||||
endianess_convertor()
|
||||
{
|
||||
need_conversion = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
setup( unsigned char elf_file_encoding )
|
||||
{
|
||||
need_conversion = ( elf_file_encoding != get_host_encoding() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint64_t
|
||||
operator()( uint64_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x00000000000000FFull ) << 56 ) |
|
||||
( ( value & 0x000000000000FF00ull ) << 40 ) |
|
||||
( ( value & 0x0000000000FF0000ull ) << 24 ) |
|
||||
( ( value & 0x00000000FF000000ull ) << 8 ) |
|
||||
( ( value & 0x000000FF00000000ull ) >> 8 ) |
|
||||
( ( value & 0x0000FF0000000000ull ) >> 24 ) |
|
||||
( ( value & 0x00FF000000000000ull ) >> 40 ) |
|
||||
( ( value & 0xFF00000000000000ull ) >> 56 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int64_t
|
||||
operator()( int64_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int64_t)(*this)( (uint64_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint32_t
|
||||
operator()( uint32_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x000000FF ) << 24 ) |
|
||||
( ( value & 0x0000FF00 ) << 8 ) |
|
||||
( ( value & 0x00FF0000 ) >> 8 ) |
|
||||
( ( value & 0xFF000000 ) >> 24 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int32_t
|
||||
operator()( int32_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int32_t)(*this)( (uint32_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t
|
||||
operator()( uint16_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
value =
|
||||
( ( value & 0x00FF ) << 8 ) |
|
||||
( ( value & 0xFF00 ) >> 8 );
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int16_t
|
||||
operator()( int16_t value ) const
|
||||
{
|
||||
if ( !need_conversion ) {
|
||||
return value;
|
||||
}
|
||||
return (int16_t)(*this)( (uint16_t)value );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int8_t
|
||||
operator()( int8_t value ) const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
operator()( uint8_t value ) const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned char
|
||||
get_host_encoding() const
|
||||
{
|
||||
static const int tmp = 1;
|
||||
if ( 1 == *(char*)&tmp ) {
|
||||
return ELFDATA2LSB;
|
||||
}
|
||||
else {
|
||||
return ELFDATA2MSB;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
private:
|
||||
bool need_conversion;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
inline
|
||||
uint32_t
|
||||
elf_hash( const unsigned char *name )
|
||||
{
|
||||
uint32_t h = 0, g;
|
||||
while ( *name ) {
|
||||
h = (h << 4) + *name++;
|
||||
g = h & 0xf0000000;
|
||||
if ( g != 0 )
|
||||
h ^= g >> 24;
|
||||
h &= ~g;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
} // namespace ELFIO
|
||||
|
||||
#endif // ELFIO_UTILS_HPP
|
||||
|
@ -1,75 +1,75 @@
|
||||
#ifndef ELFO_DYNAMIC_HPP
|
||||
#define ELFO_DYNAMIC_HPP
|
||||
|
||||
// Dynamic section producer
|
||||
class ELFODynamicWriter : public IELFODynamicWriter
|
||||
{
|
||||
public:
|
||||
ELFODynamicWriter( IELFO* pIELFO, IELFOSection* pSection );
|
||||
~ELFODynamicWriter();
|
||||
|
||||
virtual int addRef();
|
||||
virtual int release();
|
||||
|
||||
virtual ELFIO_Err addEntry( Elf_Sword tag, Elf_Word value );
|
||||
|
||||
private:
|
||||
int m_nRefCnt;
|
||||
IELFO* m_pIELFO;
|
||||
IELFOSection* m_pSection;
|
||||
};
|
||||
|
||||
|
||||
ELFODynamicWriter::ELFODynamicWriter( IELFO* pIELFO, IELFOSection* pSection ) :
|
||||
m_nRefCnt( 1 ),
|
||||
m_pIELFO( pIELFO ),
|
||||
m_pSection( pSection )
|
||||
{
|
||||
m_pIELFO->addRef();
|
||||
m_pSection->addRef();
|
||||
}
|
||||
|
||||
|
||||
ELFODynamicWriter::~ELFODynamicWriter()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ELFODynamicWriter::addRef()
|
||||
{
|
||||
m_pIELFO->addRef();
|
||||
m_pSection->addRef();
|
||||
return ++m_nRefCnt;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ELFODynamicWriter::release()
|
||||
{
|
||||
int nRet = --m_nRefCnt;
|
||||
IELFO* pIELFO = m_pIELFO;
|
||||
IELFOSection* pSec = m_pSection;
|
||||
|
||||
if ( 0 == m_nRefCnt ) {
|
||||
delete this;
|
||||
}
|
||||
pSec->release();
|
||||
pIELFO->release();
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
ELFIO_Err
|
||||
ELFODynamicWriter::addEntry( Elf_Sword tag, Elf_Word value )
|
||||
{
|
||||
Elf64_Dyn entry;
|
||||
entry.d_tag = convert2host( tag, m_pIELFO->get_encoding() );
|
||||
entry.d_un.d_val = convert2host( value, m_pIELFO->get_encoding() );
|
||||
|
||||
return m_pSection->appendData( reinterpret_cast<const char*>( &entry ),
|
||||
sizeof( entry ) );
|
||||
}
|
||||
|
||||
#endif // ELFO_DYNAMIC_HPP
|
||||
#ifndef ELFO_DYNAMIC_HPP
|
||||
#define ELFO_DYNAMIC_HPP
|
||||
|
||||
// Dynamic section producer
|
||||
class ELFODynamicWriter : public IELFODynamicWriter
|
||||
{
|
||||
public:
|
||||
ELFODynamicWriter( IELFO* pIELFO, IELFOSection* pSection );
|
||||
~ELFODynamicWriter();
|
||||
|
||||
virtual int addRef();
|
||||
virtual int release();
|
||||
|
||||
virtual ELFIO_Err addEntry( Elf_Sword tag, Elf_Word value );
|
||||
|
||||
private:
|
||||
int m_nRefCnt;
|
||||
IELFO* m_pIELFO;
|
||||
IELFOSection* m_pSection;
|
||||
};
|
||||
|
||||
|
||||
ELFODynamicWriter::ELFODynamicWriter( IELFO* pIELFO, IELFOSection* pSection ) :
|
||||
m_nRefCnt( 1 ),
|
||||
m_pIELFO( pIELFO ),
|
||||
m_pSection( pSection )
|
||||
{
|
||||
m_pIELFO->addRef();
|
||||
m_pSection->addRef();
|
||||
}
|
||||
|
||||
|
||||
ELFODynamicWriter::~ELFODynamicWriter()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ELFODynamicWriter::addRef()
|
||||
{
|
||||
m_pIELFO->addRef();
|
||||
m_pSection->addRef();
|
||||
return ++m_nRefCnt;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ELFODynamicWriter::release()
|
||||
{
|
||||
int nRet = --m_nRefCnt;
|
||||
IELFO* pIELFO = m_pIELFO;
|
||||
IELFOSection* pSec = m_pSection;
|
||||
|
||||
if ( 0 == m_nRefCnt ) {
|
||||
delete this;
|
||||
}
|
||||
pSec->release();
|
||||
pIELFO->release();
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
ELFIO_Err
|
||||
ELFODynamicWriter::addEntry( Elf_Sword tag, Elf_Word value )
|
||||
{
|
||||
Elf64_Dyn entry;
|
||||
entry.d_tag = convert2host( tag, m_pIELFO->get_encoding() );
|
||||
entry.d_un.d_val = convert2host( value, m_pIELFO->get_encoding() );
|
||||
|
||||
return m_pSection->appendData( reinterpret_cast<const char*>( &entry ),
|
||||
sizeof( entry ) );
|
||||
}
|
||||
|
||||
#endif // ELFO_DYNAMIC_HPP
|
||||
|
@ -1 +1 @@
|
||||
SUBDIRS = elfdump tutorial writer write_obj
|
||||
SUBDIRS = elfdump tutorial writer write_obj
|
||||
|
@ -34,7 +34,7 @@ POST_UNINSTALL = :
|
||||
subdir = examples
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -179,9 +179,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/Makefile
|
||||
$(AUTOMAKE) --foreign examples/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
@ -1,56 +1,56 @@
|
||||
#include <cstdio>
|
||||
#include <ELFIO.h>
|
||||
|
||||
int main( int, char* argv[] )
|
||||
{
|
||||
// Create a ELFI reader
|
||||
IELFI* pReader;
|
||||
ELFIO::GetInstance()->CreateELFI( &pReader );
|
||||
|
||||
// Initialize it
|
||||
char* filename = argv[1];
|
||||
pReader->Load( filename );
|
||||
|
||||
// Get .text relocation entry
|
||||
// List all sections of the file
|
||||
int i;
|
||||
int nSecNo = pReader->GetSectionsNum();
|
||||
for ( i = 0; i < nSecNo; ++i ) { // For all sections
|
||||
const IELFISection* pSec = pReader->GetSection( i );
|
||||
if ( SHT_REL != pSec->GetType() && SHT_RELA != pSec->GetType() ) {
|
||||
pSec->Release();
|
||||
continue;
|
||||
}
|
||||
const IELFIRelocationTable* pRel = 0;
|
||||
pReader->CreateSectionReader( IELFI::ELFI_RELOCATION, pSec, (void**)&pRel );
|
||||
|
||||
// Print all entries
|
||||
Elf64_Addr offset;
|
||||
Elf64_Addr symbolValue;
|
||||
std::string symbolName;
|
||||
unsigned char type;
|
||||
Elf_Sxword addend;
|
||||
Elf_Sxword calcValue;
|
||||
Elf_Xword nNum = pRel->GetEntriesNum();
|
||||
if ( 0 < nNum ) {
|
||||
std::printf( "\nSection name: %s\n", pSec->GetName().c_str() );
|
||||
std::printf( " Num Type Offset Addend Calc SymValue SymName\n" );
|
||||
for ( Elf_Xword i = 0; i < nNum; ++i ) {
|
||||
pRel->GetEntry( i, offset, symbolValue, symbolName,
|
||||
type, addend, calcValue );
|
||||
std::printf( "[%4llx] %02x %08llx %08llx %08llx %08llx %s\n",
|
||||
i, type, offset,
|
||||
addend, calcValue,
|
||||
symbolValue, symbolName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
pSec->Release();
|
||||
pRel->Release();
|
||||
}
|
||||
|
||||
// Free resources
|
||||
pReader->Release();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <cstdio>
|
||||
#include <ELFIO.h>
|
||||
|
||||
int main( int, char* argv[] )
|
||||
{
|
||||
// Create a ELFI reader
|
||||
IELFI* pReader;
|
||||
ELFIO::GetInstance()->CreateELFI( &pReader );
|
||||
|
||||
// Initialize it
|
||||
char* filename = argv[1];
|
||||
pReader->Load( filename );
|
||||
|
||||
// Get .text relocation entry
|
||||
// List all sections of the file
|
||||
int i;
|
||||
int nSecNo = pReader->GetSectionsNum();
|
||||
for ( i = 0; i < nSecNo; ++i ) { // For all sections
|
||||
const IELFISection* pSec = pReader->GetSection( i );
|
||||
if ( SHT_REL != pSec->GetType() && SHT_RELA != pSec->GetType() ) {
|
||||
pSec->Release();
|
||||
continue;
|
||||
}
|
||||
const IELFIRelocationTable* pRel = 0;
|
||||
pReader->CreateSectionReader( IELFI::ELFI_RELOCATION, pSec, (void**)&pRel );
|
||||
|
||||
// Print all entries
|
||||
Elf64_Addr offset;
|
||||
Elf64_Addr symbolValue;
|
||||
std::string symbolName;
|
||||
unsigned char type;
|
||||
Elf_Sxword addend;
|
||||
Elf_Sxword calcValue;
|
||||
Elf_Xword nNum = pRel->GetEntriesNum();
|
||||
if ( 0 < nNum ) {
|
||||
std::printf( "\nSection name: %s\n", pSec->GetName().c_str() );
|
||||
std::printf( " Num Type Offset Addend Calc SymValue SymName\n" );
|
||||
for ( Elf_Xword i = 0; i < nNum; ++i ) {
|
||||
pRel->GetEntry( i, offset, symbolValue, symbolName,
|
||||
type, addend, calcValue );
|
||||
std::printf( "[%4llx] %02x %08llx %08llx %08llx %08llx %s\n",
|
||||
i, type, offset,
|
||||
addend, calcValue,
|
||||
symbolValue, symbolName.c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
pSec->Release();
|
||||
pRel->Release();
|
||||
}
|
||||
|
||||
// Free resources
|
||||
pReader->Release();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
bin_PROGRAMS = elfdump
|
||||
|
||||
elfdump_SOURCES = elfdump.cpp
|
||||
|
||||
EXTRA_DIST = ELFDump.vcxproj
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
bin_PROGRAMS = elfdump
|
||||
elfdump_SOURCES = elfdump.cpp
|
||||
EXTRA_DIST = ELFDump.vcxproj
|
||||
|
@ -36,7 +36,7 @@ bin_PROGRAMS = elfdump$(EXEEXT)
|
||||
subdir = examples/elfdump
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -144,7 +144,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
elfdump_SOURCES = elfdump.cpp
|
||||
EXTRA_DIST = ELFDump.vcxproj
|
||||
all: all-am
|
||||
@ -160,9 +160,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/elfdump/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/elfdump/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/elfdump/Makefile
|
||||
$(AUTOMAKE) --foreign examples/elfdump/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
@ -1,56 +1,56 @@
|
||||
/*
|
||||
ELFDump.cpp - Dump ELF file using ELFIO library.
|
||||
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
#define ELFIO_NO_INTTYPES
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <elfio/elfio_dump.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 ) {
|
||||
printf( "Usage: ELFDump <file_name>\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
elfio reader;
|
||||
|
||||
if ( !reader.load( argv[1] ) ) {
|
||||
printf( "File %s is not found or it is not an ELF file\n", argv[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
dump::header ( std::cout, reader );
|
||||
dump::section_headers( std::cout, reader );
|
||||
dump::segment_headers( std::cout, reader );
|
||||
dump::symbol_tables ( std::cout, reader );
|
||||
dump::notes ( std::cout, reader );
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
ELFDump.cpp - Dump ELF file using ELFIO library.
|
||||
|
||||
Copyright (C) 2001-2011 by Serge Lamikhov-Center
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _SCL_SECURE_NO_WARNINGS
|
||||
#define ELFIO_NO_INTTYPES
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <elfio/elfio_dump.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 ) {
|
||||
printf( "Usage: ELFDump <file_name>\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
elfio reader;
|
||||
|
||||
if ( !reader.load( argv[1] ) ) {
|
||||
printf( "File %s is not found or it is not an ELF file\n", argv[1] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
dump::header ( std::cout, reader );
|
||||
dump::section_headers( std::cout, reader );
|
||||
dump::segment_headers( std::cout, reader );
|
||||
dump::symbol_tables ( std::cout, reader );
|
||||
dump::notes ( std::cout, reader );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
bin_PROGRAMS = tutorial
|
||||
|
||||
tutorial_SOURCES = tutorial.cpp
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
bin_PROGRAMS = tutorial
|
||||
tutorial_SOURCES = tutorial.cpp
|
||||
|
@ -36,7 +36,7 @@ bin_PROGRAMS = tutorial$(EXEEXT)
|
||||
subdir = examples/tutorial
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -144,7 +144,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
tutorial_SOURCES = tutorial.cpp
|
||||
all: all-am
|
||||
|
||||
@ -159,9 +159,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/tutorial/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/tutorial/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/tutorial/Makefile
|
||||
$(AUTOMAKE) --foreign examples/tutorial/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
@ -1,90 +1,90 @@
|
||||
#include <iostream>
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 ) {
|
||||
std::cout << "Usage: tutorial <elf_file>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create an elfio reader
|
||||
elfio reader;
|
||||
|
||||
// Load ELF data
|
||||
if ( !reader.load( argv[1] ) ) {
|
||||
std::cout << "Can't find or process ELF file " << argv[1] << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Print ELF file properties
|
||||
std::cout << "ELF file class : ";
|
||||
if ( reader.get_class() == ELFCLASS32 )
|
||||
std::cout << "ELF32" << std::endl;
|
||||
else
|
||||
std::cout << "ELF64" << std::endl;
|
||||
|
||||
std::cout << "ELF file encoding : ";
|
||||
if ( reader.get_encoding() == ELFDATA2LSB )
|
||||
std::cout << "Little endian" << std::endl;
|
||||
else
|
||||
std::cout << "Big endian" << std::endl;
|
||||
|
||||
// Print ELF file sections info
|
||||
Elf_Half sec_num = reader.sections.size();
|
||||
std::cout << "Number of sections: " << sec_num << std::endl;
|
||||
for ( int i = 0; i < sec_num; ++i ) {
|
||||
section* psec = reader.sections[i];
|
||||
std::cout << " [" << i << "] "
|
||||
<< psec->get_name()
|
||||
<< "\t"
|
||||
<< psec->get_size()
|
||||
<< std::endl;
|
||||
// Access to section's data
|
||||
// const char* p = reader.sections[i]->get_data()
|
||||
}
|
||||
|
||||
// Print ELF file segments info
|
||||
Elf_Half seg_num = reader.segments.size();
|
||||
std::cout << "Number of segments: " << seg_num << std::endl;
|
||||
for ( int i = 0; i < seg_num; ++i ) {
|
||||
const segment* pseg = reader.segments[i];
|
||||
std::cout << " [" << i << "] 0x" << std::hex
|
||||
<< pseg->get_flags()
|
||||
<< "\t0x"
|
||||
<< pseg->get_virtual_address()
|
||||
<< "\t0x"
|
||||
<< pseg->get_file_size()
|
||||
<< "\t0x"
|
||||
<< pseg->get_memory_size()
|
||||
<< std::endl;
|
||||
// Access to segments's data
|
||||
// const char* p = reader.segments[i]->get_data()
|
||||
}
|
||||
|
||||
for ( int i = 0; i < sec_num; ++i ) {
|
||||
section* psec = reader.sections[i];
|
||||
// Check section type
|
||||
if ( psec->get_type() == SHT_SYMTAB ) {
|
||||
const symbol_section_accessor symbols( reader, psec );
|
||||
for ( unsigned int j = 0; j < symbols.get_symbols_num(); ++j ) {
|
||||
std::string name;
|
||||
Elf64_Addr value;
|
||||
Elf_Xword size;
|
||||
unsigned char bind;
|
||||
unsigned char type;
|
||||
Elf_Half section_index;
|
||||
unsigned char other;
|
||||
|
||||
// Read symbol properties
|
||||
symbols.get_symbol( j, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
std::cout << j << " " << name << " " << value << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <iostream>
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
if ( argc != 2 ) {
|
||||
std::cout << "Usage: tutorial <elf_file>" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create an elfio reader
|
||||
elfio reader;
|
||||
|
||||
// Load ELF data
|
||||
if ( !reader.load( argv[1] ) ) {
|
||||
std::cout << "Can't find or process ELF file " << argv[1] << std::endl;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Print ELF file properties
|
||||
std::cout << "ELF file class : ";
|
||||
if ( reader.get_class() == ELFCLASS32 )
|
||||
std::cout << "ELF32" << std::endl;
|
||||
else
|
||||
std::cout << "ELF64" << std::endl;
|
||||
|
||||
std::cout << "ELF file encoding : ";
|
||||
if ( reader.get_encoding() == ELFDATA2LSB )
|
||||
std::cout << "Little endian" << std::endl;
|
||||
else
|
||||
std::cout << "Big endian" << std::endl;
|
||||
|
||||
// Print ELF file sections info
|
||||
Elf_Half sec_num = reader.sections.size();
|
||||
std::cout << "Number of sections: " << sec_num << std::endl;
|
||||
for ( int i = 0; i < sec_num; ++i ) {
|
||||
section* psec = reader.sections[i];
|
||||
std::cout << " [" << i << "] "
|
||||
<< psec->get_name()
|
||||
<< "\t"
|
||||
<< psec->get_size()
|
||||
<< std::endl;
|
||||
// Access to section's data
|
||||
// const char* p = reader.sections[i]->get_data()
|
||||
}
|
||||
|
||||
// Print ELF file segments info
|
||||
Elf_Half seg_num = reader.segments.size();
|
||||
std::cout << "Number of segments: " << seg_num << std::endl;
|
||||
for ( int i = 0; i < seg_num; ++i ) {
|
||||
const segment* pseg = reader.segments[i];
|
||||
std::cout << " [" << i << "] 0x" << std::hex
|
||||
<< pseg->get_flags()
|
||||
<< "\t0x"
|
||||
<< pseg->get_virtual_address()
|
||||
<< "\t0x"
|
||||
<< pseg->get_file_size()
|
||||
<< "\t0x"
|
||||
<< pseg->get_memory_size()
|
||||
<< std::endl;
|
||||
// Access to segments's data
|
||||
// const char* p = reader.segments[i]->get_data()
|
||||
}
|
||||
|
||||
for ( int i = 0; i < sec_num; ++i ) {
|
||||
section* psec = reader.sections[i];
|
||||
// Check section type
|
||||
if ( psec->get_type() == SHT_SYMTAB ) {
|
||||
const symbol_section_accessor symbols( reader, psec );
|
||||
for ( unsigned int j = 0; j < symbols.get_symbols_num(); ++j ) {
|
||||
std::string name;
|
||||
Elf64_Addr value;
|
||||
Elf_Xword size;
|
||||
unsigned char bind;
|
||||
unsigned char type;
|
||||
Elf_Half section_index;
|
||||
unsigned char other;
|
||||
|
||||
// Read symbol properties
|
||||
symbols.get_symbol( j, name, value, size, bind,
|
||||
type, section_index, other );
|
||||
std::cout << j << " " << name << " " << value << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
bin_PROGRAMS = write_obj
|
||||
|
||||
write_obj_SOURCES = write_obj.cpp
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
bin_PROGRAMS = write_obj
|
||||
write_obj_SOURCES = write_obj.cpp
|
||||
|
@ -36,7 +36,7 @@ bin_PROGRAMS = write_obj$(EXEEXT)
|
||||
subdir = examples/write_obj
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -144,7 +144,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
write_obj_SOURCES = write_obj.cpp
|
||||
all: all-am
|
||||
|
||||
@ -159,9 +159,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/write_obj/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/write_obj/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/write_obj/Makefile
|
||||
$(AUTOMAKE) --foreign examples/write_obj/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
@ -1,5 +1,3 @@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
bin_PROGRAMS = writer
|
||||
|
||||
writer_SOURCES = writer.cpp
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
bin_PROGRAMS = writer
|
||||
writer_SOURCES = writer.cpp
|
||||
|
@ -36,7 +36,7 @@ bin_PROGRAMS = writer$(EXEEXT)
|
||||
subdir = examples/writer
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
@ -144,7 +144,7 @@ target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)
|
||||
writer_SOURCES = writer.cpp
|
||||
all: all-am
|
||||
|
||||
@ -159,9 +159,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/writer/Makefile'; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/writer/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/writer/Makefile
|
||||
$(AUTOMAKE) --foreign examples/writer/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
|
@ -1,82 +1,82 @@
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( void )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
// You can't proceed without this function call!
|
||||
writer.create( ELFCLASS32, ELFDATA2LSB );
|
||||
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_type( ET_EXEC );
|
||||
writer.set_machine( EM_386 );
|
||||
|
||||
// Create code section
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x20', '\x80', '\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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
// Create a loadable segment
|
||||
segment* text_seg = writer.segments.add();
|
||||
text_seg->set_type( PT_LOAD );
|
||||
text_seg->set_virtual_address( 0x08048000 );
|
||||
text_seg->set_physical_address( 0x08048000 );
|
||||
text_seg->set_flags( PF_X | PF_R );
|
||||
text_seg->set_align( 0x1000 );
|
||||
|
||||
// Add code section into program segment
|
||||
text_seg->add_section_index( text_sec->get_index(), text_sec->get_addr_align() );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 0x4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
// Create a read/write segment
|
||||
segment* data_seg = writer.segments.add();
|
||||
data_seg->set_type( PT_LOAD );
|
||||
data_seg->set_virtual_address( 0x08048020 );
|
||||
data_seg->set_physical_address( 0x08048020 );
|
||||
data_seg->set_flags( PF_W | PF_R );
|
||||
data_seg->set_align( 0x10 );
|
||||
|
||||
// Add code section into program segment
|
||||
data_seg->add_section_index( data_sec->get_index(), data_sec->get_addr_align() );
|
||||
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x01, "Created by ELFIO", 0, 0 );
|
||||
char descr[6] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36};
|
||||
note_writer.add_note( 0x01, "Never easier!", descr, sizeof( descr ) );
|
||||
|
||||
// Setup entry point
|
||||
writer.set_entry( 0x08048000 );
|
||||
|
||||
// Create ELF file
|
||||
writer.save( "hello_i386_32" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <elfio/elfio.hpp>
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
int main( void )
|
||||
{
|
||||
elfio writer;
|
||||
|
||||
// You can't proceed without this function call!
|
||||
writer.create( ELFCLASS32, ELFDATA2LSB );
|
||||
|
||||
writer.set_os_abi( ELFOSABI_LINUX );
|
||||
writer.set_type( ET_EXEC );
|
||||
writer.set_machine( EM_386 );
|
||||
|
||||
// Create code section
|
||||
section* text_sec = writer.sections.add( ".text" );
|
||||
text_sec->set_type( SHT_PROGBITS );
|
||||
text_sec->set_flags( SHF_ALLOC | SHF_EXECINSTR );
|
||||
text_sec->set_addr_align( 0x10 );
|
||||
|
||||
// Add data into it
|
||||
char text[] = { '\xB8', '\x04', '\x00', '\x00', '\x00', // mov eax, 4
|
||||
'\xBB', '\x01', '\x00', '\x00', '\x00', // mov ebx, 1
|
||||
'\xB9', '\x20', '\x80', '\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
|
||||
};
|
||||
text_sec->set_data( text, sizeof( text ) );
|
||||
|
||||
// Create a loadable segment
|
||||
segment* text_seg = writer.segments.add();
|
||||
text_seg->set_type( PT_LOAD );
|
||||
text_seg->set_virtual_address( 0x08048000 );
|
||||
text_seg->set_physical_address( 0x08048000 );
|
||||
text_seg->set_flags( PF_X | PF_R );
|
||||
text_seg->set_align( 0x1000 );
|
||||
|
||||
// Add code section into program segment
|
||||
text_seg->add_section_index( text_sec->get_index(), text_sec->get_addr_align() );
|
||||
|
||||
// Create data section*
|
||||
section* data_sec = writer.sections.add( ".data" );
|
||||
data_sec->set_type( SHT_PROGBITS );
|
||||
data_sec->set_flags( SHF_ALLOC | SHF_WRITE );
|
||||
data_sec->set_addr_align( 0x4 );
|
||||
|
||||
char data[] = { '\x48', '\x65', '\x6C', '\x6C', '\x6F', // msg: db 'Hello, World!', 10
|
||||
'\x2C', '\x20', '\x57', '\x6F', '\x72',
|
||||
'\x6C', '\x64', '\x21', '\x0A'
|
||||
};
|
||||
data_sec->set_data( data, sizeof( data ) );
|
||||
|
||||
// Create a read/write segment
|
||||
segment* data_seg = writer.segments.add();
|
||||
data_seg->set_type( PT_LOAD );
|
||||
data_seg->set_virtual_address( 0x08048020 );
|
||||
data_seg->set_physical_address( 0x08048020 );
|
||||
data_seg->set_flags( PF_W | PF_R );
|
||||
data_seg->set_align( 0x10 );
|
||||
|
||||
// Add code section into program segment
|
||||
data_seg->add_section_index( data_sec->get_index(), data_sec->get_addr_align() );
|
||||
|
||||
section* note_sec = writer.sections.add( ".note" );
|
||||
note_sec->set_type( SHT_NOTE );
|
||||
note_sec->set_addr_align( 1 );
|
||||
note_section_accessor note_writer( writer, note_sec );
|
||||
note_writer.add_note( 0x01, "Created by ELFIO", 0, 0 );
|
||||
char descr[6] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36};
|
||||
note_writer.add_note( 0x01, "Never easier!", descr, sizeof( descr ) );
|
||||
|
||||
// Setup entry point
|
||||
writer.set_entry( 0x08048000 );
|
||||
|
||||
// Create ELF file
|
||||
writer.save( "hello_i386_32" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
ELFIOVER='ELFIO-1.0.3'
|
||||
BUILDVER='1'
|
||||
FULLVER=${ELFIOVER}-${BUILDVER}
|
||||
|
||||
mkdir $1
|
||||
cp ${ELFIOVER}.tar.gz $1
|
||||
cd $1
|
||||
tar -xzf ${ELFIOVER}.tar.gz
|
||||
cp ../cygwin/${FULLVER}.sh .
|
||||
mkdir ${ELFIOVER}/CYGWIN-PATCHES
|
||||
cp ../cygwin/CYGWIN-PATCHES/* ${ELFIOVER}/CYGWIN-PATCHES
|
||||
./${FULLVER}.sh mkdirs
|
||||
./${FULLVER}.sh spkg
|
||||
|
||||
cd ..
|
||||
mkdir $2
|
||||
cp $1/${FULLVER}-src.tar.bz2 $2
|
||||
cd $2
|
||||
tar -xjf ${FULLVER}-src.tar.bz2
|
||||
./${FULLVER}.sh all
|
||||
ELFIOVER='ELFIO-1.0.3'
|
||||
BUILDVER='1'
|
||||
FULLVER=${ELFIOVER}-${BUILDVER}
|
||||
|
||||
mkdir $1
|
||||
cp ${ELFIOVER}.tar.gz $1
|
||||
cd $1
|
||||
tar -xzf ${ELFIOVER}.tar.gz
|
||||
cp ../cygwin/${FULLVER}.sh .
|
||||
mkdir ${ELFIOVER}/CYGWIN-PATCHES
|
||||
cp ../cygwin/CYGWIN-PATCHES/* ${ELFIOVER}/CYGWIN-PATCHES
|
||||
./${FULLVER}.sh mkdirs
|
||||
./${FULLVER}.sh spkg
|
||||
|
||||
cd ..
|
||||
mkdir $2
|
||||
cp $1/${FULLVER}-src.tar.bz2 $2
|
||||
cd $2
|
||||
tar -xjf ${FULLVER}-src.tar.bz2
|
||||
./${FULLVER}.sh all
|
||||
|
Loading…
x
Reference in New Issue
Block a user