瀏覽代碼

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.
Idan Horowitz 3 年之前
父節點
當前提交
1616460312
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      Userland/Libraries/LibELF/Core.h

+ 6 - 1
Userland/Libraries/LibELF/Core.h

@@ -6,10 +6,13 @@
 
 #pragma once
 
-#include <AK/String.h>
 #include <AK/Types.h>
 #include <LibC/sys/arch/i386/regs.h>
 
+#ifndef KERNEL
+#    include <AK/String.h>
+#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 {