1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibELF: Add Image::Section::wrapping_byte_buffer

This can be used to get a ByteBuffer that wrapps the section's data.
This commit is contained in:
Itamar 2020-05-06 17:17:42 +03:00 committed by Andreas Kling
parent dca0483e9a
commit 42b61cfe2c

View file

@ -26,6 +26,7 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
@ -131,6 +132,7 @@ public:
unsigned entry_count() const { return !entry_size() ? 0 : size() / entry_size(); }
u32 address() const { return m_section_header.sh_addr; }
const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); }
ByteBuffer wrapping_byte_buffer() { return ByteBuffer::wrap(reinterpret_cast<const u8*>(raw_data()), size()); }
bool is_undefined() const { return m_section_index == SHN_UNDEF; }
const RelocationSection relocations() const;
u32 flags() const { return m_section_header.sh_flags; }