summaryrefslogtreecommitdiff
path: root/view/elf
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-03-13 15:01:44 +0800
committerXusheng <xusheng@vector35.com>2024-03-19 16:22:11 +0800
commit43a11aa327aea4abc1b85e3784e2fb7085d4079e (patch)
tree7725621352fe965c16dd46328899a5e1610c0b35 /view/elf
parent5f9a7ea15cecb3dc879a221abf4a05f1e748eb37 (diff)
Avoid creating function symbols with integer type
Diffstat (limited to 'view/elf')
-rw-r--r--view/elf/elfview.cpp12
-rw-r--r--view/elf/elfview.h2
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<Type> typeObj=nullptr);
+ BNSymbolBinding binding, size_t size=0, Ref<Type> typeObj=nullptr);
void ApplyTypesToParentStringTable(const Elf64SectionHeader& section, const bool offset = true);
void ApplyTypesToStringTable(const Elf64SectionHeader& section, const int64_t imageBaseAdjustment, const bool offset = true);