Lines Matching +full:symbols +full:- +full:check

1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- mode: C++ -*-
4 // Copyright 2020-2022 Google LLC
148 Check(gelf_getehdr(elf, &header) != nullptr) << "could not get ELF header"; in GetMachine()
174 Check(gelf_getshdr(section, &header) != nullptr) in GetSectionsIf()
185 Check(elf_getshdrstrndx(elf, &shdr_strtab_index) == 0) in GetSectionsByName()
199 Check(sections.size() == 1) in MaybeGetSectionByName()
206 Check(section != nullptr) << "no section found with name '" << name << "'"; in GetSectionByName()
216 Check(sections.size() == 1) << "multiple sections found with type " << type; in MaybeGetSectionByType()
222 Check(section != nullptr) << "no section found with index " << index; in GetSectionByIndex()
234 Check(gelf_getshdr(section, &section_header) != nullptr) in GetSectionInfo()
237 Check(data != nullptr) << "section (index = " << index << ") data is invalid"; in GetSectionInfo()
242 Check(section_header.sh_entsize != 0) in GetNumberOfEntries()
250 Check(data != nullptr) << "elf_rawdata failed on section " << name; in GetRawData()
251 return {static_cast<char*>(data->d_buf), data->d_size}; in GetRawData()
257 Check(name != nullptr) << "string was not found (section: " << section in GetString()
264 Check(gelf_getehdr(elf, &elf_header) != nullptr) in GetSymbolTableSection()
271 // exported symbols in .symtab, all other ELF types have their in GetSymbolTableSection()
272 // exported symbols in .dynsym. in GetSymbolTableSection()
300 Check(IsCFISymbolName(cfi_name)) in UnwrapCFISymbolName()
302 return cfi_name.substr(0, cfi_name.size() - kCFISuffix.size()); in UnwrapCFISymbolName()
318 Check(number_of_symbols <= std::numeric_limits<int>::max()) in GetSymbols()
319 << "number of symbols exceeds INT_MAX"; in GetSymbols()
322 Check(gelf_getsym(symbol_table_data, static_cast<int>(i), &symbol) != in GetSymbols()
353 // symbols via the EXPORT_SYMBOL_* macros and it contains symbol names and in IsLinuxKernelBinary()
357 // not export symbols themselves via the ksymtab. Yet they can be identified in IsLinuxKernelBinary()
359 // name, also check for the presence of `.gnu.linkonce.this_module` to get in IsLinuxKernelBinary()
368 Check(gelf_getehdr(elf, &elf_header) != nullptr) in IsRelocatable()
376 Check(gelf_getehdr(elf, &elf_header) != nullptr) in IsLittleEndianBinary()
446 Check(symbol_table_section != nullptr) in GetElfSymbols()
453 // CFI symbols may be only in .symtab in GetCFISymbols()
458 // symbols in the first place, so the best we can do is returning an empty in GetCFISymbols()
467 Check(is_little_endian_binary_) in GetElfSymbolCRC()
468 << "CRC is not supported in big-endian binaries"; in GetElfSymbolCRC()
473 Check(symbol.value_type == SymbolTableEntry::ValueType::RELATIVE_TO_SECTION) in GetElfSymbolCRC()
478 Check(data->d_buf != nullptr) << "Section has no data buffer"; in GetElfSymbolCRC()
480 Check(address >= header.sh_addr) in GetElfSymbolCRC()
483 const size_t offset = address - header.sh_addr; in GetElfSymbolCRC()
485 Check(offset_end <= data->d_size && offset_end <= header.sh_size) in GetElfSymbolCRC()
489 reinterpret_cast<char*>(data->d_buf) + offset)}; in GetElfSymbolCRC()
494 Check(symbol.value_type == SymbolTableEntry::ValueType::RELATIVE_TO_SECTION) in GetElfSymbolNamespace()
499 Check(data->d_buf != nullptr) << "Section has no data buffer"; in GetElfSymbolNamespace()
502 Check(address >= header.sh_addr) in GetElfSymbolNamespace()
505 const size_t offset = address - header.sh_addr; in GetElfSymbolNamespace()
506 Check(offset < data->d_size && offset < header.sh_size) in GetElfSymbolNamespace()
509 const char* begin = reinterpret_cast<const char*>(data->d_buf) + offset; in GetElfSymbolNamespace()
511 const size_t length = strnlen(begin, data->d_size - offset); in GetElfSymbolNamespace()
512 Check(offset + length < data->d_size) in GetElfSymbolNamespace()
513 << "Namespace string should be null-terminated"; in GetElfSymbolNamespace()
522 Check(symbol.value_type == SymbolTableEntry::ValueType::RELATIVE_TO_SECTION) in GetAbsoluteAddress()
523 << "Only absolute and relative to sections symbols are supported"; in GetAbsoluteAddress()
528 Check(gelf_getshdr(section, &header) != nullptr) in GetAbsoluteAddress()
530 Check(symbol.value + symbol.size <= header.sh_size) in GetAbsoluteAddress()