From 43a11aa327aea4abc1b85e3784e2fb7085d4079e Mon Sep 17 00:00:00 2001 From: Xusheng Date: Wed, 13 Mar 2024 15:01:44 +0800 Subject: Avoid creating function symbols with integer type --- view/elf/elfview.cpp | 12 ++++++------ view/elf/elfview.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index d1b2beef..0e82d511 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -1209,10 +1209,10 @@ bool ElfView::Init() // Only handle this symbol type if the platform is a linux. Otherwise, we don't know what it is. if (GetDefaultPlatform()->GetName().rfind("linux", 0) != 0) goto unknownType; - DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding, entry->size); + DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding); break; case ELF_STT_FUNC: - DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding, entry->size); + DefineElfSymbol(FunctionSymbol, entry->name, entry->value, false, entry->binding); break; case ELF_STT_TLS: /* - only create Binja symbols for .symtab (not .dynsym) symbols @@ -1539,13 +1539,13 @@ bool ElfView::Init() if (!GetSymbolByAddress(entry)) { if (section->GetName() == ".init_array") - DefineAutoSymbol(new Symbol(FunctionSymbol, "_INIT_" + std::to_string(i), entry, GlobalBinding)); + DefineElfSymbol(FunctionSymbol, "_INIT_" + std::to_string(i), entry, false, GlobalBinding); else if (section->GetName() == ".fini_array") - DefineAutoSymbol(new Symbol(FunctionSymbol, "_FINI_" + std::to_string(i), entry, GlobalBinding)); + DefineElfSymbol(FunctionSymbol, "_FINI_" + std::to_string(i), entry, false, GlobalBinding); else if (section->GetName() == ".ctors") - DefineAutoSymbol(new Symbol(FunctionSymbol, "_CTOR_" + std::to_string(i), entry, GlobalBinding)); + DefineElfSymbol(FunctionSymbol, "_CTOR_" + std::to_string(i), entry, false, GlobalBinding); else if (section->GetName() == ".dtors") - DefineAutoSymbol(new Symbol(FunctionSymbol, "_DTOR_" + std::to_string(i), entry, GlobalBinding)); + DefineElfSymbol(FunctionSymbol, "_DTOR_" + std::to_string(i), entry, false, GlobalBinding); } } } diff --git a/view/elf/elfview.h b/view/elf/elfview.h index 7df78d01..db60fdb7 100644 --- a/view/elf/elfview.h +++ b/view/elf/elfview.h @@ -515,7 +515,7 @@ namespace BinaryNinja SymbolQueue* m_symbolQueue = nullptr; void DefineElfSymbol(BNSymbolType type, const std::string& name, uint64_t addr, bool gotEntry, - BNSymbolBinding binding, size_t size, Ref typeObj=nullptr); + BNSymbolBinding binding, size_t size=0, Ref typeObj=nullptr); void ApplyTypesToParentStringTable(const Elf64SectionHeader& section, const bool offset = true); void ApplyTypesToStringTable(const Elf64SectionHeader& section, const int64_t imageBaseAdjustment, const bool offset = true); -- cgit v1.3.1