accelerator/patches/0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch
Benoist 04a6eeeedb
Update breakpad version (#35)
* Update breakpad version

* Remove win-2019 from CI
2025-09-18 16:03:02 -04:00

48 lines
1.8 KiB
Diff

From 8aaf6e84a6704eb538f68a3e6fb6c3a8c93f1d8d Mon Sep 17 00:00:00 2001
From: Asher Baker <asherkin@limetech.io>
Date: Sun, 13 Jan 2019 12:35:05 +0000
Subject: [PATCH 2/5] Write FUNC records instead of PUBLIC for ELF symbols with
sizes
---
src/common/linux/elf_symbols_to_module.cc | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc
index 70d50f89..f21460bf 100644
--- a/src/common/linux/elf_symbols_to_module.cc
+++ b/src/common/linux/elf_symbols_to_module.cc
@@ -164,19 +164,28 @@ bool ELFSymbolsToModule(const uint8_t* symtab_section,
while(!iterator->at_end) {
if (ELF32_ST_TYPE(iterator->info) == STT_FUNC &&
iterator->shndx != SHN_UNDEF) {
- auto ext = std::make_unique<Module::Extern>(iterator->value);
- ext->name = SymbolString(iterator->name_offset, strings);
+ auto name = SymbolString(iterator->name_offset, strings);
#if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle.
int status = 0;
char* demangled =
- abi::__cxa_demangle(ext->name.c_str(), nullptr, nullptr, &status);
+ abi::__cxa_demangle(name, nullptr, nullptr, &status);
if (demangled) {
if (status == 0)
- ext->name = demangled;
+ name = demangled;
free(demangled);
}
#endif
+#if 1
+ if (iterator->size) {
+ Module::Function *fun = new Module::Function(module->AddStringToPool(name), iterator->value);
+ fun->ranges.push_back(Module::Range(iterator->value, iterator->size));
+ module->AddFunction(fun);
+ }
+#else
+ Module::Extern *ext = new Module::Extern(iterator->value);
+ ext->name = name;
module->AddExtern(std::move(ext));
+#endif
}
++iterator;
}