ELF64_DynSym_ReadSection(
LibGoblin_BinaryInfo *p_binfo )
{
- char str_symname[256];
char *pstr_symname;
Byte *pb_dynstr;
int i_bid;
LibGoblin_SectionInfo *psec_gnuver = NULL;
LibGoblin_SectionInfo *psec_dynsym;
LibGoblin_SectionInfo *psec_dynstr;
- //LibGoblin_SrcFile *p_srcfile;
LibGoblin_ObjectInfo *p_obj;
LibGoblin_ProgramInfo *p_pginfo;
LibGoblin_BinaryInfo *p_binlib;
continue;
}
- pstr_symname = (char *)(pb_dynstr + p_sym->st_name);
- strncpy( str_symname, pstr_symname, 256);
+ // If p_sym->st_shndx != 0(UNDEF),
+ // the symbol object is implemented in self-object.
+ if( SHN_UNDEF != p_sym->st_shndx ) { continue; }
// Search DynSym_Version ---
i_bid = p_binfo->i_id;
for( dw_cnt = 0; dw_cnt < dw_vermax; dw_cnt++, p_vernow++ ) {
if( *pw_gnuver == p_vernow->dw_other ) {
i_bid = p_vernow->i_binfo_id;
- //strcat( str_symname, "@");
- //strcat( str_symname, p_vernow->pstr_vername );
break;
}
}
}
- else {
- i_bid = BinInfo_SearchNextSlave( p_binfo->i_id, i_bid );
- }
-/*
- printf(" debug: [%2ld] %s %ld\n", dw_sym, (char *)(pb_dynstr + p_sym->st_name),
- *pw_gnuver);
-*/
- do {
- // Check Hash
+ if( i_bid == p_binfo->i_id )
+ { i_bid = BinInfo_SearchNextSlave( p_binfo->i_id, i_bid ); }
+
+ pstr_symname = (char *)(pb_dynstr + p_sym->st_name);
+
+ // Check .gnu.hash ---
+ while( -0x01 != i_bid ) {
p_binlib = BinaryInfo_GetBinInfo( i_bid );
- printf(" debug: [%2ld] %s (%s)\n", dw_sym, str_symname, p_binlib->str_filename );
- i_result = ELF64_GnuHash_SearchDynSym( p_binlib, str_symname );
- printf(" %d\n", i_result );
+ assert( NULL != p_binlib );
+
+ i_result = ELF64_GnuHash_SearchDynSym( p_binlib, pstr_symname );
+ if( 0 <= i_result ) {
+ break;
+ }
i_bid = BinInfo_SearchNextSlave( p_binfo->i_id, i_bid );
- } while( -0x01 != i_bid );
+ }
+ printf(" debug: [%2ld] %s (%s)\n", dw_sym, pstr_symname, p_binlib->str_filename );
+ printf(" %d\n", i_result );
- // 2019/02/24 -- TODO
- // Check DynSym Type
- // Get libname from p_version struct
- // Search Dynamic Function ObjInfo
+ // 2019/03/05 -- TODO
+ // Set Info. for ObjectInfo
/*
// st_value - Symbol value.