p_addr = p_binfo->p_addrinfo + (p_symworktbl->dw_max_symwork - 1);
p_syminfo = p_symworktbl->p_symwork + (p_symworktbl->dw_max_symwork - 1);
for( dw_cnt = p_symworktbl->dw_max_symwork; dw_cnt > 0; dw_cnt--, p_syminfo--, p_addr-- ) {
- if( LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB == p_syminfo->dw_type ) {
+ if( LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB == GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
i_result = LibGoblin_AddrInfo_Set_Symtab( p_binfo, p_addr, p_syminfo );
}
- else if( LIBGOBLIN_SYMWORKINFO_TYPE_DWARF == p_syminfo->dw_type ) {
+ else if( LIBGOBLIN_SYMWORKINFO_TYPE_DWARF
+ == GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
}
- else if( LIBGOBLIN_SYMWORKINFO_TYPE_ADDRTBL == p_syminfo->dw_type ) {
+ else if( LIBGOBLIN_SYMWORKINFO_TYPE_ADDRTBL
+ == GET_SYMWORKINFO_TYPE(p_syminfo->dw_type) ) {
i_result = LibGoblin_AddrInfo_Move_AddrInfo( p_binfo, p_addr, p_syminfo );
}
}
for( dw_cnt = 0; ((dw_cnt < dw_symbols) && (0x00 == i_result)); dw_cnt++, p_sym64++ ) {
i_result = LibGoblin_SymWork_AddSymbolWorkInfo(
- p_symwork, (Ptr)p_sym64->st_value, (Byte *)p_sym64,
+ p_binfo, p_symwork, (Ptr)p_sym64->st_value, (Byte *)p_sym64,
LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB );
}
}
for( dw_cnt = 0; ((dw_cnt < dw_symbols) && (0x00 == i_result)); dw_cnt++, p_sym32++ ) {
i_result = LibGoblin_SymWork_AddSymbolWorkInfo(
- p_symwork, (Ptr)p_sym32->st_value, (Byte *)p_sym32,
+ p_binfo, p_symwork, (Ptr)p_sym32->st_value, (Byte *)p_sym32,
LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB );
}
}
#define DRD64_SRC_LIBGOBLIN_SYMWORK
#include"drd64_libgoblin.h"
-/*----------------------------------------------------------------------
- Create (Read SymbolSection)
- CreateWorkTable
- FindSymAddr
- FindSymName
- UpdateSymWork
- AddSymWork
- Free
-----------------------------------------------------------------------*/
-
/*----------------------------------------------------------------------
----------------------------------------------------------------------*/
LIBGOBLIN_SYMWORK_EXTERN
int
LibGoblin_SymWork_AddSymbolWorkInfo(
+ LibGoblin_BinaryInfo *p_binfo,
LibGoblin_SymbolWorkTable *p_symworktbl,
Ptr ptr_address,
Byte *pb_dataptr,
DWord dw_type )
{
+ DWord dw_value;
+ Elf32_Sym *p_sym32;
+ Elf64_Sym *p_sym64;
LibGoblin_SymbolWorkInfo *p_symwork;
LibGoblin_SymbolWorkInfo *p_symtmp;
p_symwork = p_symtmp;
p_symworktbl->dw_alloc_symwork += LIBGOBLIN_SYMWORKINFO_UNITS;
}
+
+ dw_value = dw_type;
+ if( LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB == dw_type ) {
+ if( isElf64( p_binfo ) ) {
+ p_sym64 = (Elf64_Sym *)pb_dataptr;
+ dw_value |= (Byte)p_sym64->st_info;
+ }
+ else if( isElf32( p_binfo ) ) {
+ p_sym32 = (Elf32_Sym *)pb_dataptr;
+ dw_value |= (Byte)p_sym32->st_info;
+ }
+ }
p_symwork += p_symworktbl->dw_max_symwork;
p_symwork->ptr_address = ptr_address;
- p_symwork->dw_type = dw_type;
+ p_symwork->dw_type = dw_value;
p_symwork->pb_symbol = pb_dataptr;
p_symworktbl->dw_max_symwork++;
#define LIBGOBLIN_SYMWORKINFO_TYPE_SYMTAB 0x0100
#define LIBGOBLIN_SYMWORKINFO_TYPE_DWARF 0x0200
-#define LIBGOBLIN_SYMWORKINFO_TYPE_ADDRTBL 0x0300
+#define LIBGOBLIN_SYMWORKINFO_TYPE_ADDRTBL 0x0400
+#define LIBGOBLIN_SYMWORKINFO_TYPE_MASK 0x0f00
+
+#define GET_SYMWORKINFO_TYPE(n) ((DWord)(LIBGOBLIN_SYMWORKINFO_TYPE_MASK & (n)))
typedef struct {
LibGoblin_SymbolWorkTable *p_symwrktbl, DWord dw_initsymbols );
LIBGOBLIN_SYMWORK_EXTERN
int LibGoblin_SymWork_AddSymbolWorkInfo(
- LibGoblin_SymbolWorkTable *p_symworktbl,
+ LibGoblin_BinaryInfo *p_binfo, LibGoblin_SymbolWorkTable *p_symworktbl,
Ptr ptr_address, Byte *pb_dataptr, DWord dw_type );
LIBGOBLIN_SYMWORK_EXTERN
LibGoblin_SymbolWorkInfo *LibGoblin_SymWork_CreateWorkTable(