mirror of
https://github.com/serge1/ELFIO.git
synced 2024-11-02 02:26:47 +00:00
Add C symbol functions
This commit is contained in:
parent
49c676ad06
commit
5b448b7e1c
@ -29,7 +29,7 @@ int main( int argc, char* argv[] )
|
||||
elfio_section_get_address( psection ),
|
||||
elfio_section_get_size( psection ) );
|
||||
}
|
||||
|
||||
/*
|
||||
int segno = elfio_get_segments_num( pelfio );
|
||||
printf( "\nSegments No : %d\n", segno );
|
||||
|
||||
@ -40,6 +40,9 @@ int main( int argc, char* argv[] )
|
||||
elfio_segment_get_memory_size( psegment ),
|
||||
elfio_segment_get_file_size( psegment ) );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
elfio_delete( pelfio );
|
||||
|
||||
|
@ -178,8 +178,7 @@ Elf_Half elfio_segment_get_sections_num( psegment_t psegment )
|
||||
return psegment->get_sections_num();
|
||||
}
|
||||
|
||||
Elf_Half elfio_segment_get_section_index_at( psegment_t psegment,
|
||||
Elf_Half num )
|
||||
Elf_Half elfio_segment_get_section_index_at( psegment_t psegment, Elf_Half num )
|
||||
{
|
||||
return psegment->get_section_index_at( num );
|
||||
}
|
||||
@ -188,3 +187,58 @@ bool elfio_segment_is_offset_initialized( psegment_t psegment )
|
||||
{
|
||||
return psegment->is_offset_initialized();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// symbol
|
||||
//-----------------------------------------------------------------------------
|
||||
psymbol_t elfio_symbol_section_accessor_new( pelfio_t pelfio,
|
||||
psection_t psection )
|
||||
{
|
||||
return new symbol_section_accessor( *pelfio, psection );
|
||||
}
|
||||
|
||||
void elfio_symbol_section_accessor_delete( psymbol_t psymbol )
|
||||
{
|
||||
delete psymbol;
|
||||
}
|
||||
|
||||
Elf_Xword elfio_symbol_get_symbols_num( psymbol_t psymbol )
|
||||
{
|
||||
return psymbol->get_symbols_num();
|
||||
}
|
||||
|
||||
bool get_symbol( psymbol_t psymbol,
|
||||
Elf_Xword index,
|
||||
char* name,
|
||||
int name_len,
|
||||
Elf64_Addr* value,
|
||||
Elf_Xword* size,
|
||||
unsigned char* bind,
|
||||
unsigned char* type,
|
||||
Elf_Half* section_index,
|
||||
unsigned char* other )
|
||||
{
|
||||
std::string name_param;
|
||||
bool ret = psymbol->get_symbol( index, name_param, *value, *size, *bind,
|
||||
*type, *section_index, *other );
|
||||
strncpy( name, name_param.c_str(), name_len - 1 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Elf_Word elfio_symbol_add_symbol( psymbol_t psymbol,
|
||||
Elf_Word name,
|
||||
Elf64_Addr value,
|
||||
Elf_Xword size,
|
||||
unsigned char info,
|
||||
unsigned char other,
|
||||
Elf_Half shndx )
|
||||
{
|
||||
return psymbol->add_symbol( name, value, size, info, other, shndx );
|
||||
}
|
||||
|
||||
Elf_Xword elfio_symbol_arrange_local_symbols(
|
||||
psymbol_t psymbol, void ( *func )( Elf_Xword first, Elf_Xword second ) )
|
||||
{
|
||||
return psymbol->arrange_local_symbols( func );
|
||||
}
|
||||
|
@ -76,9 +76,10 @@ THE SOFTWARE.
|
||||
void elfio_##CLASS##_set_##NAME( p##CLASS##_t p##CLASS, TYPE value )
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef ELFIO::elfio* pelfio_t;
|
||||
typedef ELFIO::section* psection_t;
|
||||
typedef ELFIO::segment* psegment_t;
|
||||
typedef ELFIO::elfio* pelfio_t;
|
||||
typedef ELFIO::section* psection_t;
|
||||
typedef ELFIO::segment* psegment_t;
|
||||
typedef ELFIO::symbol_section_accessor* psymbol_t;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -86,6 +87,7 @@ extern "C"
|
||||
typedef void* pelfio_t;
|
||||
typedef void* psection_t;
|
||||
typedef void* psegment_t;
|
||||
typedef void* psymbol_t;
|
||||
typedef int bool;
|
||||
#endif
|
||||
|
||||
@ -161,12 +163,40 @@ typedef int bool;
|
||||
ELFIO_C_GET_ACCESS( segment, Elf64_Off, offset );
|
||||
char* elfio_segment_get_data( psegment_t psegment );
|
||||
Elf_Half elfio_segment_add_section_index( psegment_t psegment,
|
||||
Elf_Half index,
|
||||
Elf_Xword addr_align );
|
||||
Elf_Half index,
|
||||
Elf_Xword addr_align );
|
||||
Elf_Half elfio_segment_get_sections_num( psegment_t psegment );
|
||||
Elf_Half elfio_segment_get_section_index_at( psegment_t psegment, Elf_Half num );
|
||||
Elf_Half elfio_segment_get_section_index_at( psegment_t psegment,
|
||||
Elf_Half num );
|
||||
bool elfio_segment_is_offset_initialized( psegment_t psegment );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// symbol
|
||||
//-----------------------------------------------------------------------------
|
||||
psymbol_t elfio_symbol_section_accessor_new( pelfio_t pelfio,
|
||||
psection_t psection );
|
||||
void elfio_symbol_section_accessor_delete( psymbol_t psymbol );
|
||||
Elf_Xword elfio_symbol_get_symbols_num( psymbol_t psymbol );
|
||||
bool elfio_symbol_get_symbol( psymbol_t psymbol,
|
||||
Elf_Xword index,
|
||||
char* name,
|
||||
int name_len,
|
||||
Elf64_Addr* value,
|
||||
Elf_Xword* size,
|
||||
unsigned char* bind,
|
||||
unsigned char* type,
|
||||
Elf_Half* section_index,
|
||||
unsigned char* other );
|
||||
Elf_Word elfio_symbol_add_symbol( psymbol_t psymbol,
|
||||
Elf_Word name,
|
||||
Elf64_Addr value,
|
||||
Elf_Xword size,
|
||||
unsigned char info,
|
||||
unsigned char other,
|
||||
Elf_Half shndx );
|
||||
Elf_Xword elfio_symbol_arrange_local_symbols(
|
||||
psymbol_t psymbol, void (*func)( Elf_Xword first, Elf_Xword second ) );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user