bool verify_symbols() const { //printf("ELF verification from %p to %p (Syms=%#x, Strs=%#x)\n", // symtab.base, strtab.base + strtab.size, checksum_syms, checksum_strs); uint32_t csum = crc32_fast(symtab.base, symtab.entries * sizeof(ElfSym)); if (csum != checksum_syms) { printf("ELF symbol tables checksum failed! " "(%08x vs %08x)\n", csum, checksum_syms); return false; } csum = crc32_fast(strtab.base, strtab.size); if (csum != checksum_strs) { printf("ELF string tables checksum failed! " "(%08x vs %08x)\n", csum, checksum_strs); return false; } return true; }
static uint32_t generate_ro_crc() noexcept { extern char _TEXT_START_; extern char _RODATA_END_; return crc32_fast(&_TEXT_START_, &_RODATA_END_ - &_TEXT_START_); }
inline uint32_t liu_crc32(const void* buf, size_t len) { return crc32_fast(buf, len); }