Bläddra i källkod

LibELF: Exclude sorted symbols APIs from the Kernel

These are only used by userland, and are implemented using infallible
Strings, so let's just ifdef them out of the Kernel.
Idan Horowitz 3 år sedan
förälder
incheckning
d296001f3f
2 ändrade filer med 6 tillägg och 3 borttagningar
  1. 0 2
      Userland/Libraries/LibELF/Image.cpp
  2. 6 1
      Userland/Libraries/LibELF/Image.h

+ 0 - 2
Userland/Libraries/LibELF/Image.cpp

@@ -381,7 +381,6 @@ Optional<Image::Symbol> Image::find_demangled_function(StringView name) const
     });
     });
     return found;
     return found;
 }
 }
-#endif
 
 
 Image::SortedSymbol* Image::find_sorted_symbol(FlatPtr address) const
 Image::SortedSymbol* Image::find_sorted_symbol(FlatPtr address) const
 {
 {
@@ -428,7 +427,6 @@ NEVER_INLINE void Image::sort_symbols() const
     });
     });
 }
 }
 
 
-#ifndef KERNEL
 String Image::symbolicate(FlatPtr address, u32* out_offset) const
 String Image::symbolicate(FlatPtr address, u32* out_offset) const
 {
 {
     auto symbol_count = this->symbol_count();
     auto symbol_count = this->symbol_count();

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

@@ -7,11 +7,14 @@
 #pragma once
 #pragma once
 
 
 #include <AK/Concepts.h>
 #include <AK/Concepts.h>
-#include <AK/String.h>
 #include <AK/Vector.h>
 #include <AK/Vector.h>
 #include <Kernel/VirtualAddress.h>
 #include <Kernel/VirtualAddress.h>
 #include <LibC/elf.h>
 #include <LibC/elf.h>
 
 
+#ifndef KERNEL
+#    include <AK/String.h>
+#endif
+
 namespace ELF {
 namespace ELF {
 
 
 class Image {
 class Image {
@@ -255,6 +258,7 @@ private:
     unsigned m_symbol_table_section_index { 0 };
     unsigned m_symbol_table_section_index { 0 };
     unsigned m_string_table_section_index { 0 };
     unsigned m_string_table_section_index { 0 };
 
 
+#ifndef KERNEL
     struct SortedSymbol {
     struct SortedSymbol {
         FlatPtr address;
         FlatPtr address;
         StringView name;
         StringView name;
@@ -266,6 +270,7 @@ private:
     SortedSymbol* find_sorted_symbol(FlatPtr) const;
     SortedSymbol* find_sorted_symbol(FlatPtr) const;
 
 
     mutable Vector<SortedSymbol> m_sorted_symbols;
     mutable Vector<SortedSymbol> m_sorted_symbols;
+#endif
 };
 };
 
 
 template<IteratorFunction<Image::Section> F>
 template<IteratorFunction<Image::Section> F>