aboutsummaryrefslogtreecommitdiff
path: root/elf_loader.h
diff options
context:
space:
mode:
authorAleksei Vetrov <vvvvvv@google.com>2023-01-05 15:41:32 +0000
committerMatthias Maennich <maennich@google.com>2023-01-06 16:33:12 +0000
commit70423a0647994126fbdda3d2653226c65300f955 (patch)
tree0faa9f27f38468734f5235d4c294fbb61442c3b6 /elf_loader.h
parentfa329871a6ee53d217f7396251dce54ac7b48ea4 (diff)
downloadstg-70423a0647994126fbdda3d2653226c65300f955.tar.gz
ELF loader: add support for CRC values by offset
New kernels changed the format of storing CRC values from absolute symbol values to offsets in the `__kcrctab` or `__kcrctab_gpl` section. Add a new method `GetElfSymbolCRC` to the ELF loader, which reads CRC values in CRC sections by offset. It is very fast and doesn't affect the performance of reading the ELF symbol table. PiperOrigin-RevId: 499873253 Change-Id: Idf419369d26f51167feea4fa7c624a2d28f1239f
Diffstat (limited to 'elf_loader.h')
-rw-r--r--elf_loader.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/elf_loader.h b/elf_loader.h
index d0abce5..225c22b 100644
--- a/elf_loader.h
+++ b/elf_loader.h
@@ -63,6 +63,7 @@ struct SymbolTableEntry {
SymbolType symbol_type;
Binding binding;
Visibility visibility;
+ size_t section_index;
ValueType value_type;
};
@@ -78,6 +79,7 @@ class ElfLoader final {
std::string_view GetBtfRawData() const;
std::vector<SymbolTableEntry> GetElfSymbols() const;
+ ElfSymbol::CRC GetElfSymbolCRC(const SymbolTableEntry& symbol) const;
bool IsLinuxKernelBinary() const;
private: