From 1616460312a782465b83abd55f53f0d51901a641 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 15 Feb 2022 23:13:41 +0200 Subject: [PATCH] LibELF: Exclude MemoryRegionInfo::object_name() from the Kernel This API is only used by userland, and it uses infallible Strings, so let's just ifdef it out of the Kernel. --- Userland/Libraries/LibELF/Core.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibELF/Core.h b/Userland/Libraries/LibELF/Core.h index fbbef3f254..eb29e56866 100644 --- a/Userland/Libraries/LibELF/Core.h +++ b/Userland/Libraries/LibELF/Core.h @@ -6,10 +6,13 @@ #pragma once -#include #include #include +#ifndef KERNEL +# include +#endif + namespace ELF::Core { struct [[gnu::packed]] NotesEntryHeader { @@ -55,6 +58,7 @@ struct [[gnu::packed]] MemoryRegionInfo { uint16_t program_header_index; char region_name[]; // Null terminated +#ifndef KERNEL String object_name() const { StringView memory_region_name { region_name }; @@ -65,6 +69,7 @@ struct [[gnu::packed]] MemoryRegionInfo { return {}; return memory_region_name.substring_view(0, *maybe_colon_index).to_string(); } +#endif }; struct [[gnu::packed]] Metadata {