summaryrefslogtreecommitdiff
path: root/view/elf
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-03-13 13:14:22 +0800
committerXusheng <xusheng@vector35.com>2024-03-19 16:22:11 +0800
commit5f9a7ea15cecb3dc879a221abf4a05f1e748eb37 (patch)
tree18b7b0df3b949371f062b2e4b29e6364a37a0beb /view/elf
parent462276a4aa998e0b0ef804dd8d3b2eaa84a82f98 (diff)
name functions in .init_array/.fini_array/.ctors/.dtors sections
Diffstat (limited to 'view/elf')
-rw-r--r--view/elf/elfview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index 94b3c37b..d1b2beef 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -1534,6 +1534,19 @@ bool ElfView::Init()
else
AddFunctionForAnalysis(platform, entry);
m_logger->LogDebug("Adding function start: %#" PRIx64 "\n", entry);
+
+ // name functions in .init_array, .fini_array, .ctors and .dtors
+ if (!GetSymbolByAddress(entry))
+ {
+ if (section->GetName() == ".init_array")
+ DefineAutoSymbol(new Symbol(FunctionSymbol, "_INIT_" + std::to_string(i), entry, GlobalBinding));
+ else if (section->GetName() == ".fini_array")
+ DefineAutoSymbol(new Symbol(FunctionSymbol, "_FINI_" + std::to_string(i), entry, GlobalBinding));
+ else if (section->GetName() == ".ctors")
+ DefineAutoSymbol(new Symbol(FunctionSymbol, "_CTOR_" + std::to_string(i), entry, GlobalBinding));
+ else if (section->GetName() == ".dtors")
+ DefineAutoSymbol(new Symbol(FunctionSymbol, "_DTOR_" + std::to_string(i), entry, GlobalBinding));
+ }
}
}