Dr.Deamon64 Git-Repository
(2014/03/01- Main-Repository: migrate from cvs)
Revision | 2348ae1e50883c9f4005919afb4646215cd44ee7 (tree) |
---|---|
Time | 2019-03-13 05:57:34 |
Author | Koine Yuusuke(koinec) <koinec@user...> |
Commiter | Koine Yuusuke(koinec) |
2019/03/13(Wed)
@@ -89,6 +89,7 @@ void | ||
89 | 89 | char str_type[64]; |
90 | 90 | char str_binding[32]; |
91 | 91 | char str_visibility[32]; |
92 | + LibGoblin_BinaryInfo *p_binfo_origin; | |
92 | 93 | |
93 | 94 | printf(" %s\t\t[OBJINFO] Addr.Link(%3d <-> %3d) File{ Offset=%8p, Size=%8ld, FID=%d }\n", |
94 | 95 | pstr_space, |
@@ -177,12 +178,20 @@ void | ||
177 | 178 | break; |
178 | 179 | } |
179 | 180 | |
180 | -// TODO: 2019/03/12 | |
181 | -// Append Dynamic Resolv Info. | |
182 | - | |
183 | 181 | printf(" %s\t\t[SYMBOL] Type: %s, Binding: %s, Visibility: %s\n", |
184 | 182 | pstr_space, str_type, str_binding, str_visibility ); |
185 | 183 | |
184 | + | |
185 | + if( OBJINFO_STATUS_DYNAMIC & p_obj->dw_status ) { | |
186 | + p_binfo_origin = BinaryInfo_GetBinInfo( p_obj->dynamic.i_binfo_origin ); | |
187 | + | |
188 | + printf(" %s\t\t[DYNAMIC] Lib.Name: %s (binfo id= %d), .dynsym index= %d\n", | |
189 | + pstr_space, | |
190 | + ((NULL != p_binfo_origin) ? p_binfo_origin->str_filename : "--NULL--"), | |
191 | + p_obj->dynamic.i_binfo_origin, p_obj->dynamic.i_dynsym_index ); | |
192 | + } | |
193 | + | |
194 | + | |
186 | 195 | return; |
187 | 196 | } |
188 | 197 |
@@ -175,7 +175,7 @@ int | ||
175 | 175 | return i_result; |
176 | 176 | } |
177 | 177 | |
178 | - Debug_ObjectInfo_Print_AllGroupLink( p_pginfo, 0xff ); | |
178 | + //Debug_ObjectInfo_Print_AllGroupLink( p_pginfo, 0xff ); | |
179 | 179 | |
180 | 180 | |
181 | 181 | /* Analyze Dwarf-Debug Info. */ |
@@ -46,8 +46,10 @@ int | ||
46 | 46 | LibGoblin_BinaryInfo *p_binfo ) |
47 | 47 | { |
48 | 48 | char *pstr_symname; |
49 | + Byte b_binding; | |
49 | 50 | Byte *pb_dynstr; |
50 | 51 | int i_bid; |
52 | + int i_result; | |
51 | 53 | int i_symindex; |
52 | 54 | DWord dw_cnt; |
53 | 55 | DWord dw_sym; |
@@ -141,18 +143,21 @@ int | ||
141 | 143 | pstr_symname = (char *)(pb_dynstr + p_sym->st_name); |
142 | 144 | |
143 | 145 | // Check .gnu.hash --- |
146 | + i_symindex = -0x01; | |
144 | 147 | while( -0x01 != i_bid ) { |
145 | 148 | p_binlib = BinaryInfo_GetBinInfo( i_bid ); |
146 | 149 | assert( NULL != p_binlib ); |
147 | 150 | |
148 | - i_symindex = ELF64_GnuHash_SearchDynSym( p_binlib, pstr_symname, p_vernow ); | |
149 | - if( 0 <= i_symindex ) { | |
151 | + i_result = ELF64_GnuHash_SearchDynSym( p_binlib, pstr_symname, p_vernow, &b_binding ); | |
152 | + if( 0 <= i_result ) { | |
153 | + i_symindex = i_result; | |
150 | 154 | break; |
151 | 155 | } |
152 | 156 | |
153 | 157 | i_bid = BinInfo_SearchNextSlave( p_binfo->i_id, i_bid ); |
154 | 158 | } |
155 | - printf(" debug: [%2u] %s (%s) = %d\n", dw_sym, pstr_symname, p_binlib->str_filename, i_symindex ); | |
159 | + printf(" debug: [%2u] %s (%s)[binding:%d] = %d\n", | |
160 | + dw_sym, pstr_symname, p_binlib->str_filename, b_binding, i_symindex ); | |
156 | 161 | |
157 | 162 | if( 0 > i_symindex ) { continue; } |
158 | 163 |
@@ -55,7 +55,8 @@ int | ||
55 | 55 | ELF64_GnuHash_SearchDynSym( |
56 | 56 | LibGoblin_BinaryInfo *p_binfo, |
57 | 57 | char *pstr_symname, |
58 | - GnuVer_VerNeed *p_verneed ) | |
58 | + GnuVer_VerNeed *p_verneed, | |
59 | + Byte *pb_binding ) | |
59 | 60 | { |
60 | 61 | int i_ret = -0x0f; |
61 | 62 | int i_result; |
@@ -152,10 +153,14 @@ int | ||
152 | 153 | |
153 | 154 | |
154 | 155 | if(((dw_namehash | 1) == (dw_hash | 1)) && !strcmp(pstr_dynname, pstr_symname)) { |
155 | - i_result = ELF64_GnuVer_CheckVerName_inVerDef( p_binfo, p_verneed, *pw_gvernow); | |
156 | - if( 0x00 <= i_result ) { | |
157 | - i_ret = dw_symix & 0x7fffffff; | |
158 | - break; | |
156 | + if(( STV_ELIMINATE != p_symnow->st_other ) | |
157 | + && ( STV_HIDDEN != p_symnow->st_other )) { | |
158 | + i_result = ELF64_GnuVer_CheckVerName_inVerDef( p_binfo, p_verneed, *pw_gvernow); | |
159 | + if( 0x00 <= i_result ) { | |
160 | + *pb_binding = ELF64_ST_BIND( p_symnow->st_info ); | |
161 | + i_ret = dw_symix & 0x7fffffff; | |
162 | + break; | |
163 | + } | |
159 | 164 | } |
160 | 165 | } |
161 | 166 |
@@ -51,7 +51,8 @@ Comment: | ||
51 | 51 | |
52 | 52 | LIBGOBLIN_ELF_HASH_EXTERN |
53 | 53 | int ELF64_GnuHash_SearchDynSym( |
54 | - LibGoblin_BinaryInfo *p_binfo, char *pstr_symname, GnuVer_VerNeed *p_verneed ); | |
54 | + LibGoblin_BinaryInfo *p_binfo, char *pstr_symname, | |
55 | + GnuVer_VerNeed *p_verneed, Byte *pb_binding ); | |
55 | 56 | |
56 | 57 | |
57 | 58 |