From 42b61cfe2c788704693cb1f550f8f80127884ea5 Mon Sep 17 00:00:00 2001 From: Itamar Date: Wed, 6 May 2020 17:17:42 +0300 Subject: [PATCH] LibELF: Add Image::Section::wrapping_byte_buffer This can be used to get a ByteBuffer that wrapps the section's data. --- Libraries/LibELF/Image.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibELF/Image.h b/Libraries/LibELF/Image.h index a4e5497431..1f210544f4 100644 --- a/Libraries/LibELF/Image.h +++ b/Libraries/LibELF/Image.h @@ -26,6 +26,7 @@ #pragma once +#include #include #include #include @@ -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(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; }