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

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.
This commit is contained in:
Idan Horowitz 2022-02-15 23:13:41 +02:00 committed by Andreas Kling
parent 7923b3b884
commit 1616460312

View file

@ -6,10 +6,13 @@
#pragma once #pragma once
#include <AK/String.h>
#include <AK/Types.h> #include <AK/Types.h>
#include <LibC/sys/arch/i386/regs.h> #include <LibC/sys/arch/i386/regs.h>
#ifndef KERNEL
# include <AK/String.h>
#endif
namespace ELF::Core { namespace ELF::Core {
struct [[gnu::packed]] NotesEntryHeader { struct [[gnu::packed]] NotesEntryHeader {
@ -55,6 +58,7 @@ struct [[gnu::packed]] MemoryRegionInfo {
uint16_t program_header_index; uint16_t program_header_index;
char region_name[]; // Null terminated char region_name[]; // Null terminated
#ifndef KERNEL
String object_name() const String object_name() const
{ {
StringView memory_region_name { region_name }; StringView memory_region_name { region_name };
@ -65,6 +69,7 @@ struct [[gnu::packed]] MemoryRegionInfo {
return {}; return {};
return memory_region_name.substring_view(0, *maybe_colon_index).to_string(); return memory_region_name.substring_view(0, *maybe_colon_index).to_string();
} }
#endif
}; };
struct [[gnu::packed]] Metadata { struct [[gnu::packed]] Metadata {