@@ -991,9 +991,7 @@ static Sdb *store_versioninfo_gnu_verdef(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz)
991
991
}
992
992
size_t shsize = shdr -> sh_size ;
993
993
if (shdr -> sh_size > bin -> size ) {
994
- if (bin -> verbose ) {
995
- eprintf ("Truncating shsize from %d to %d\n" , (int )shdr -> sh_size , (int )bin -> size );
996
- }
994
+ R_LOG_DEBUG ("Truncating shsize from %d to %d" , (int )shdr -> sh_size , (int )bin -> size );
997
995
if (bin -> size > shdr -> sh_offset ) {
998
996
shsize = bin -> size - shdr -> sh_offset ;
999
997
} else {
@@ -1535,6 +1533,7 @@ static ut64 get_import_addr_loongarch(ELFOBJ *bin, RBinElfReloc *rel) {
1535
1533
ut64 pos = COMPUTE_PLTGOT_POSITION (rel , got_addr , 0x2 );
1536
1534
return plt_addr + LOONGARCH_PLT_OFFSET + pos * LOONGARCH_PLT_ENTRY_SIZE ;
1537
1535
}
1536
+
1538
1537
static ut64 get_import_addr_sparc (ELFOBJ * bin , RBinElfReloc * rel ) {
1539
1538
if (rel -> type != R_SPARC_JMP_SLOT ) {
1540
1539
R_LOG_DEBUG ("Unknown sparc reloc type %d" , rel -> type );
@@ -1686,7 +1685,7 @@ static ut64 get_import_addr(ELFOBJ *bin, int sym) {
1686
1685
case EM_LOONGARCH :
1687
1686
return get_import_addr_loongarch (bin , rel );
1688
1687
default :
1689
- eprintf ("Unsupported relocs type %" PFMT64u " for arch %d\n " ,
1688
+ R_LOG_WARN ("Unsupported relocs type %" PFMT64u " for arch %d" ,
1690
1689
(ut64 ) rel -> type , bin -> ehdr .e_machine );
1691
1690
return UT64_MAX ;
1692
1691
}
@@ -1914,7 +1913,7 @@ ut64 Elf_(r_bin_elf_get_main_offset)(ELFOBJ *bin) {
1914
1913
/* non-thumb entry points */
1915
1914
if (!memcmp (buf , "\x00\xb0\xa0\xe3\x00\xe0\xa0\xe3" , 8 )) {
1916
1915
if (buf [0x40 + 2 ] == 0xff && buf [0x40 + 3 ] == 0xeb ) {
1917
- // eprintf ("custom\n");
1916
+ // nothing to do
1918
1917
} else if (!memcmp (buf + 0x28 + 2 , "\xff\xeb" , 2 )) {
1919
1918
return Elf_ (r_bin_elf_v2p ) (bin , r_read_le32 (& buf [0x34 ]) & ~1 );
1920
1919
}
@@ -3998,6 +3997,7 @@ RBinSymbol *Elf_(_r_bin_elf_convert_symbol)(struct Elf_(r_bin_elf_obj_t) *bin, s
3998
3997
ptr -> bind = symbol -> bind ;
3999
3998
ptr -> type = symbol -> type ;
4000
3999
ptr -> is_imported = symbol -> is_imported ;
4000
+ // ptr->is_internal = symbol->is_internal;
4001
4001
ptr -> paddr = paddr ;
4002
4002
ptr -> vaddr = vaddr ;
4003
4003
ptr -> size = symbol -> size ;
@@ -4112,7 +4112,7 @@ typedef struct import_info_t {
4112
4112
int nsym ;
4113
4113
} ImportInfo ;
4114
4114
4115
- static RVector * _load_additional_imported_symbols (ELFOBJ * bin , ImportInfo * import_info ) {
4115
+ static RVector * _load_additional_imported_symbols (ELFOBJ * bin , ImportInfo * import_info ) {
4116
4116
// Elf_(fix_symbols) may find additional symbols, some of which could be
4117
4117
// imported symbols. Let's reserve additional space for them.
4118
4118
int nsym = import_info -> nsym ;
@@ -4312,14 +4312,12 @@ static RVector /* <RBinElfSymbol> */ *Elf_(_r_bin_elf_load_symbols_and_imports)(
4312
4312
bool is_sht_null = false;
4313
4313
bool is_vaddr = false;
4314
4314
bool is_imported = false;
4315
+ bool is_internal = false;
4315
4316
if (type == R_BIN_ELF_IMPORT_SYMBOLS ) {
4316
- if (memory .sym [k ].st_value ) {
4317
- toffset = memory .sym [k ].st_value ;
4318
- } else if ((toffset = get_import_addr (bin , k )) == -1 ) {
4319
- toffset = 0 ;
4320
- }
4317
+ toffset = get_import_addr (bin , k );
4321
4318
tsize = 16 ;
4322
- is_imported = memory .sym [k ].st_shndx == STN_UNDEF ;
4319
+ is_imported = true;
4320
+ is_internal = memory .sym [k ].st_shndx != STN_UNDEF ;
4323
4321
} else {
4324
4322
tsize = memory .sym [k ].st_size ;
4325
4323
toffset = (ut64 )memory .sym [k ].st_value ;
@@ -4362,6 +4360,7 @@ static RVector /* <RBinElfSymbol> */ *Elf_(_r_bin_elf_load_symbols_and_imports)(
4362
4360
es -> is_sht_null = is_sht_null ;
4363
4361
es -> is_vaddr = is_vaddr ;
4364
4362
es -> is_imported = is_imported ;
4363
+ es -> is_internal = is_internal ;
4365
4364
if (type == R_BIN_ELF_IMPORT_SYMBOLS && is_imported ) {
4366
4365
import_ret_ctr ++ ;
4367
4366
}
0 commit comments