mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:17:36 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -87,7 +87,7 @@ static void map_library(const String& name, int fd)
|
|||
auto loader = ELF::DynamicLoader::try_create(fd, name);
|
||||
if (!loader) {
|
||||
dbgln("Failed to create ELF::DynamicLoader for fd={}, name={}", fd, name);
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
loader->set_tls_offset(g_current_tls_offset);
|
||||
|
||||
|
@ -101,7 +101,7 @@ static void map_library(const String& name)
|
|||
// TODO: Do we want to also look for libs in other paths too?
|
||||
String path = String::formatted("/usr/lib/{}", name);
|
||||
int fd = open(path.characters(), O_RDONLY);
|
||||
ASSERT(fd >= 0);
|
||||
VERIFY(fd >= 0);
|
||||
map_library(name, fd);
|
||||
}
|
||||
|
||||
|
@ -162,19 +162,19 @@ static void initialize_libc(DynamicObject& libc)
|
|||
// Also, we can't just mark `__libc_init` with "__attribute__((constructor))"
|
||||
// because it uses getenv() internally, so `environ` has to be initialized before we call `__libc_init`.
|
||||
auto res = libc.lookup_symbol("environ");
|
||||
ASSERT(res.has_value());
|
||||
VERIFY(res.has_value());
|
||||
*((char***)res.value().address.as_ptr()) = g_envp;
|
||||
|
||||
res = libc.lookup_symbol("__environ_is_malloced");
|
||||
ASSERT(res.has_value());
|
||||
VERIFY(res.has_value());
|
||||
*((bool*)res.value().address.as_ptr()) = false;
|
||||
|
||||
res = libc.lookup_symbol("exit");
|
||||
ASSERT(res.has_value());
|
||||
VERIFY(res.has_value());
|
||||
g_libc_exit = (LibCExitFunction)res.value().address.as_ptr();
|
||||
|
||||
res = libc.lookup_symbol("__libc_init");
|
||||
ASSERT(res.has_value());
|
||||
VERIFY(res.has_value());
|
||||
typedef void libc_init_func();
|
||||
((libc_init_func*)res.value().address.as_ptr())();
|
||||
}
|
||||
|
@ -203,12 +203,12 @@ static void load_elf(const String& name)
|
|||
{
|
||||
for_each_dependency_of(name, [](auto& loader) {
|
||||
auto dynamic_object = loader.map();
|
||||
ASSERT(dynamic_object);
|
||||
VERIFY(dynamic_object);
|
||||
g_global_objects.append(*dynamic_object);
|
||||
});
|
||||
for_each_dependency_of(name, [](auto& loader) {
|
||||
bool success = loader.link(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size);
|
||||
ASSERT(success);
|
||||
VERIFY(success);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -223,11 +223,11 @@ static NonnullRefPtr<DynamicLoader> commit_elf(const String& name)
|
|||
}
|
||||
|
||||
auto object = loader->load_stage_3(RTLD_GLOBAL | RTLD_LAZY, g_total_tls_size);
|
||||
ASSERT(object);
|
||||
VERIFY(object);
|
||||
|
||||
if (name == "libsystem.so") {
|
||||
if (syscall(SC_msyscall, object->base_address().as_ptr())) {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra
|
|||
|
||||
int rc = syscall(SC_msyscall, nullptr);
|
||||
if (rc < 0) {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
rc = main_function(argc, argv, envp);
|
||||
|
@ -299,7 +299,7 @@ void ELF::DynamicLinker::linker_main(String&& main_program_name, int main_progra
|
|||
_exit(rc);
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ RefPtr<DynamicLoader> DynamicLoader::try_create(int fd, String filename)
|
|||
return {};
|
||||
}
|
||||
|
||||
ASSERT(stat.st_size >= 0);
|
||||
VERIFY(stat.st_size >= 0);
|
||||
auto size = static_cast<size_t>(stat.st_size);
|
||||
if (size < sizeof(Elf32_Ehdr))
|
||||
return {};
|
||||
|
@ -90,11 +90,11 @@ DynamicLoader::~DynamicLoader()
|
|||
{
|
||||
if (munmap(m_file_data, m_file_size) < 0) {
|
||||
perror("munmap");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
if (close(m_image_fd) < 0) {
|
||||
perror("close");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ const DynamicObject& DynamicLoader::dynamic_object() const
|
|||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
ASSERT(!dynamic_section_address.is_null());
|
||||
VERIFY(!dynamic_section_address.is_null());
|
||||
|
||||
m_cached_dynamic_object = ELF::DynamicObject::create(VirtualAddress(m_elf_image.base_address()), dynamic_section_address);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void* DynamicLoader::symbol_for_name(const StringView& name)
|
|||
|
||||
RefPtr<DynamicObject> DynamicLoader::map()
|
||||
{
|
||||
ASSERT(!m_dynamic_object);
|
||||
VERIFY(!m_dynamic_object);
|
||||
|
||||
if (!m_valid) {
|
||||
dbgln("DynamicLoader::map failed: image is invalid");
|
||||
|
@ -177,10 +177,10 @@ bool DynamicLoader::link(unsigned flags, size_t total_tls_size)
|
|||
|
||||
bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size)
|
||||
{
|
||||
ASSERT(flags & RTLD_GLOBAL);
|
||||
VERIFY(flags & RTLD_GLOBAL);
|
||||
|
||||
if (m_dynamic_object->has_text_relocations()) {
|
||||
ASSERT(m_text_segment_load_address.get() != 0);
|
||||
VERIFY(m_text_segment_load_address.get() != 0);
|
||||
|
||||
#ifndef AK_OS_MACOS
|
||||
// Remap this text region as private.
|
||||
|
@ -205,7 +205,7 @@ void DynamicLoader::do_main_relocations(size_t total_tls_size)
|
|||
switch (do_relocation(total_tls_size, relocation)) {
|
||||
case RelocationResult::Failed:
|
||||
dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
case RelocationResult::ResolveLater:
|
||||
m_unresolved_relocations.append(relocation);
|
||||
break;
|
||||
|
@ -254,7 +254,7 @@ void DynamicLoader::do_lazy_relocations(size_t total_tls_size)
|
|||
for (const auto& relocation : m_unresolved_relocations) {
|
||||
if (auto res = do_relocation(total_tls_size, relocation); res != RelocationResult::Success) {
|
||||
dbgln("Loader.so: {} unresolved symbol '{}'", m_filename, relocation.symbol().name());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,27 +272,27 @@ void DynamicLoader::load_program_headers()
|
|||
ProgramHeaderRegion region {};
|
||||
region.set_program_header(program_header.raw_header());
|
||||
if (region.is_tls_template()) {
|
||||
ASSERT(!tls_region.has_value());
|
||||
VERIFY(!tls_region.has_value());
|
||||
tls_region = region;
|
||||
} else if (region.is_load()) {
|
||||
if (region.is_executable()) {
|
||||
ASSERT(!text_region.has_value());
|
||||
VERIFY(!text_region.has_value());
|
||||
text_region = region;
|
||||
} else {
|
||||
ASSERT(!data_region.has_value());
|
||||
VERIFY(!data_region.has_value());
|
||||
data_region = region;
|
||||
}
|
||||
} else if (region.is_dynamic()) {
|
||||
dynamic_region_desired_vaddr = region.desired_load_address();
|
||||
} else if (region.is_relro()) {
|
||||
ASSERT(!relro_region.has_value());
|
||||
VERIFY(!relro_region.has_value());
|
||||
relro_region = region;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
ASSERT(text_region.has_value());
|
||||
ASSERT(data_region.has_value());
|
||||
VERIFY(text_region.has_value());
|
||||
VERIFY(data_region.has_value());
|
||||
|
||||
// Process regions in order: .text, .data, .tls
|
||||
void* requested_load_address = m_elf_image.is_dynamic() ? nullptr : text_region.value().desired_load_address().as_ptr();
|
||||
|
@ -303,7 +303,7 @@ void DynamicLoader::load_program_headers()
|
|||
else
|
||||
reservation_mmap_flags |= MAP_FIXED;
|
||||
|
||||
ASSERT(!text_region.value().is_writable());
|
||||
VERIFY(!text_region.value().is_writable());
|
||||
|
||||
// First, we make a dummy reservation mapping, in order to allocate enough VM
|
||||
// to hold both text+data contiguously in the address space.
|
||||
|
@ -321,13 +321,13 @@ void DynamicLoader::load_program_headers()
|
|||
auto* reservation = mmap(requested_load_address, total_mapping_size, PROT_NONE, reservation_mmap_flags, 0, 0);
|
||||
if (reservation == MAP_FAILED) {
|
||||
perror("mmap reservation");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// Then we unmap the reservation.
|
||||
if (munmap(reservation, total_mapping_size) < 0) {
|
||||
perror("munmap reservation");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
// Now we can map the text segment at the reserved address.
|
||||
|
@ -342,10 +342,10 @@ void DynamicLoader::load_program_headers()
|
|||
|
||||
if (text_segment_begin == MAP_FAILED) {
|
||||
perror("mmap text");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ASSERT(requested_load_address == nullptr || requested_load_address == text_segment_begin);
|
||||
VERIFY(requested_load_address == nullptr || requested_load_address == text_segment_begin);
|
||||
m_text_segment_size = text_segment_size;
|
||||
m_text_segment_load_address = VirtualAddress { (FlatPtr)text_segment_begin };
|
||||
|
||||
|
@ -375,7 +375,7 @@ void DynamicLoader::load_program_headers()
|
|||
|
||||
if (MAP_FAILED == data_segment) {
|
||||
perror("mmap data");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
VirtualAddress data_segment_start;
|
||||
|
@ -409,7 +409,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
|
|||
if (symbol.bind() == STB_WEAK)
|
||||
return RelocationResult::ResolveLater;
|
||||
dbgln("ERROR: symbol not found: {}.", symbol.name());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
auto symbol_address = res.value().address;
|
||||
*patch_ptr += symbol_address.get();
|
||||
|
@ -418,7 +418,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
|
|||
case R_386_PC32: {
|
||||
auto symbol = relocation.symbol();
|
||||
auto result = lookup_symbol(symbol);
|
||||
ASSERT(result.has_value());
|
||||
VERIFY(result.has_value());
|
||||
auto relative_offset = result.value().address - m_dynamic_object->base_address().offset(relocation.offset());
|
||||
*patch_ptr += relative_offset.get();
|
||||
break;
|
||||
|
@ -440,7 +440,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
|
|||
return RelocationResult::Failed;
|
||||
}
|
||||
auto symbol_location = res.value().address;
|
||||
ASSERT(symbol_location != m_dynamic_object->base_address());
|
||||
VERIFY(symbol_location != m_dynamic_object->base_address());
|
||||
*patch_ptr = symbol_location.get();
|
||||
break;
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
|
|||
break;
|
||||
u32 symbol_value = res.value().value;
|
||||
auto* dynamic_object_of_symbol = res.value().dynamic_object;
|
||||
ASSERT(dynamic_object_of_symbol);
|
||||
VERIFY(dynamic_object_of_symbol);
|
||||
size_t offset_of_tls_end = dynamic_object_of_symbol->tls_offset().value() + dynamic_object_of_symbol->tls_size().value();
|
||||
*patch_ptr = (offset_of_tls_end - total_tls_size - symbol_value - sizeof(Elf32_Addr));
|
||||
break;
|
||||
|
@ -484,7 +484,7 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(size_t total_tls_si
|
|||
default:
|
||||
// Raise the alarm! Someone needs to implement this relocation type
|
||||
dbgln("Found a new exciting relocation type {}", relocation.type());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return RelocationResult::Success;
|
||||
}
|
||||
|
@ -494,8 +494,8 @@ extern "C" void _plt_trampoline(void) __attribute__((visibility("hidden")));
|
|||
|
||||
void DynamicLoader::setup_plt_trampoline()
|
||||
{
|
||||
ASSERT(m_dynamic_object);
|
||||
ASSERT(m_dynamic_object->has_plt());
|
||||
VERIFY(m_dynamic_object);
|
||||
VERIFY(m_dynamic_object->has_plt());
|
||||
VirtualAddress got_address = m_dynamic_object->plt_got_base_address();
|
||||
|
||||
auto* got_ptr = (FlatPtr*)got_address.as_ptr();
|
||||
|
|
|
@ -129,7 +129,7 @@ void DynamicObject::parse()
|
|||
break;
|
||||
case DT_PLTREL:
|
||||
m_procedure_linkage_table_relocation_type = entry.val();
|
||||
ASSERT(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA));
|
||||
VERIFY(m_procedure_linkage_table_relocation_type & (DT_REL | DT_RELA));
|
||||
break;
|
||||
case DT_JMPREL:
|
||||
m_plt_relocation_offset_location = entry.ptr() - (FlatPtr)m_elf_base_address.as_ptr();
|
||||
|
@ -172,7 +172,7 @@ void DynamicObject::parse()
|
|||
break;
|
||||
default:
|
||||
dbgln("DynamicObject: DYNAMIC tag handling not implemented for DT_{}", name_for_dtag(entry.tag()));
|
||||
ASSERT_NOT_REACHED(); // FIXME: Maybe just break out here and return false?
|
||||
VERIFY_NOT_REACHED(); // FIXME: Maybe just break out here and return false?
|
||||
break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
|
@ -193,7 +193,7 @@ void DynamicObject::parse()
|
|||
|
||||
DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned index) const
|
||||
{
|
||||
ASSERT(index < entry_count());
|
||||
VERIFY(index < entry_count());
|
||||
unsigned offset_in_section = index * entry_size();
|
||||
auto relocation_address = (Elf32_Rel*)address().offset(offset_in_section).as_ptr();
|
||||
return Relocation(m_dynamic, *relocation_address, offset_in_section);
|
||||
|
@ -201,7 +201,7 @@ DynamicObject::Relocation DynamicObject::RelocationSection::relocation(unsigned
|
|||
|
||||
DynamicObject::Relocation DynamicObject::RelocationSection::relocation_at_offset(unsigned offset) const
|
||||
{
|
||||
ASSERT(offset <= (m_section_size_bytes - m_entry_size));
|
||||
VERIFY(offset <= (m_section_size_bytes - m_entry_size));
|
||||
auto relocation_address = (Elf32_Rel*)address().offset(offset).as_ptr();
|
||||
return Relocation(m_dynamic, *relocation_address, offset);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ const char* DynamicObject::raw_symbol_string_table_string(Elf32_Word index) cons
|
|||
|
||||
DynamicObject::InitializationFunction DynamicObject::init_section_function() const
|
||||
{
|
||||
ASSERT(has_init_section());
|
||||
VERIFY(has_init_section());
|
||||
return (InitializationFunction)init_section().address().as_ptr();
|
||||
}
|
||||
|
||||
|
@ -444,14 +444,14 @@ NonnullRefPtr<DynamicObject> DynamicObject::create(VirtualAddress base_address,
|
|||
VirtualAddress DynamicObject::patch_plt_entry(u32 relocation_offset)
|
||||
{
|
||||
auto relocation = plt_relocation_section().relocation_at_offset(relocation_offset);
|
||||
ASSERT(relocation.type() == R_386_JMP_SLOT);
|
||||
VERIFY(relocation.type() == R_386_JMP_SLOT);
|
||||
auto symbol = relocation.symbol();
|
||||
u8* relocation_address = relocation.address().as_ptr();
|
||||
|
||||
auto result = DynamicLoader::lookup_symbol(symbol);
|
||||
if (!result.has_value()) {
|
||||
dbgln("did not find symbol: {}", symbol.name());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
auto symbol_location = result.value().address;
|
||||
|
|
|
@ -74,7 +74,7 @@ static const char* object_file_type_to_string(Elf32_Half type)
|
|||
|
||||
StringView Image::section_index_to_string(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
if (index == SHN_UNDEF)
|
||||
return "Undefined";
|
||||
if (index >= SHN_LORESERVE)
|
||||
|
@ -84,7 +84,7 @@ StringView Image::section_index_to_string(unsigned index) const
|
|||
|
||||
unsigned Image::symbol_count() const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
if (!section_count())
|
||||
return 0;
|
||||
return section(m_symbol_table_section_index).entry_count();
|
||||
|
@ -146,13 +146,13 @@ void Image::dump() const
|
|||
|
||||
unsigned Image::section_count() const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
return header().e_shnum;
|
||||
}
|
||||
|
||||
unsigned Image::program_header_count() const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
return header().e_phnum;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ bool Image::parse()
|
|||
|
||||
StringView Image::table_string(unsigned table_index, unsigned offset) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
auto& sh = section_header(table_index);
|
||||
if (sh.sh_type != SHT_STRTAB)
|
||||
return nullptr;
|
||||
|
@ -208,67 +208,67 @@ StringView Image::table_string(unsigned table_index, unsigned offset) const
|
|||
|
||||
StringView Image::section_header_table_string(unsigned offset) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
return table_string(header().e_shstrndx, offset);
|
||||
}
|
||||
|
||||
StringView Image::table_string(unsigned offset) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
return table_string(m_string_table_section_index, offset);
|
||||
}
|
||||
|
||||
const char* Image::raw_data(unsigned offset) const
|
||||
{
|
||||
ASSERT(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds.
|
||||
VERIFY(offset < m_size); // Callers must check indices into raw_data()'s result are also in bounds.
|
||||
return reinterpret_cast<const char*>(m_buffer) + offset;
|
||||
}
|
||||
|
||||
const Elf32_Ehdr& Image::header() const
|
||||
{
|
||||
ASSERT(m_size >= sizeof(Elf32_Ehdr));
|
||||
VERIFY(m_size >= sizeof(Elf32_Ehdr));
|
||||
return *reinterpret_cast<const Elf32_Ehdr*>(raw_data(0));
|
||||
}
|
||||
|
||||
const Elf32_Phdr& Image::program_header_internal(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
ASSERT(index < header().e_phnum);
|
||||
VERIFY(m_valid);
|
||||
VERIFY(index < header().e_phnum);
|
||||
return *reinterpret_cast<const Elf32_Phdr*>(raw_data(header().e_phoff + (index * sizeof(Elf32_Phdr))));
|
||||
}
|
||||
|
||||
const Elf32_Shdr& Image::section_header(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
ASSERT(index < header().e_shnum);
|
||||
VERIFY(m_valid);
|
||||
VERIFY(index < header().e_shnum);
|
||||
return *reinterpret_cast<const Elf32_Shdr*>(raw_data(header().e_shoff + (index * header().e_shentsize)));
|
||||
}
|
||||
|
||||
Image::Symbol Image::symbol(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
ASSERT(index < symbol_count());
|
||||
VERIFY(m_valid);
|
||||
VERIFY(index < symbol_count());
|
||||
auto* raw_syms = reinterpret_cast<const Elf32_Sym*>(raw_data(section(m_symbol_table_section_index).offset()));
|
||||
return Symbol(*this, index, raw_syms[index]);
|
||||
}
|
||||
|
||||
Image::Section Image::section(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
ASSERT(index < section_count());
|
||||
VERIFY(m_valid);
|
||||
VERIFY(index < section_count());
|
||||
return Section(*this, index);
|
||||
}
|
||||
|
||||
Image::ProgramHeader Image::program_header(unsigned index) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
ASSERT(index < program_header_count());
|
||||
VERIFY(m_valid);
|
||||
VERIFY(index < program_header_count());
|
||||
return ProgramHeader(*this, index);
|
||||
}
|
||||
|
||||
Image::Relocation Image::RelocationSection::relocation(unsigned index) const
|
||||
{
|
||||
ASSERT(index < relocation_count());
|
||||
VERIFY(index < relocation_count());
|
||||
auto* rels = reinterpret_cast<const Elf32_Rel*>(m_image.raw_data(offset()));
|
||||
return Relocation(m_image, rels[index]);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ Image::RelocationSection Image::Section::relocations() const
|
|||
|
||||
Image::Section Image::lookup_section(const String& name) const
|
||||
{
|
||||
ASSERT(m_valid);
|
||||
VERIFY(m_valid);
|
||||
for (unsigned i = 0; i < section_count(); ++i) {
|
||||
auto section = this->section(i);
|
||||
if (section.name() == name)
|
||||
|
|
|
@ -219,7 +219,7 @@ bool validate_program_headers(const Elf32_Ehdr& elf_header, size_t file_size, co
|
|||
|
||||
if (file_size < buffer_size) {
|
||||
dbgln("We somehow read more from a file than was in the file in the first place!");
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
size_t num_program_headers = elf_header.e_phnum;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue