summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-15 23:19:31 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-16 22:21:37 +0100
commitd296001f3fea970956ad253a4db26ef3f2ac5210 (patch)
tree2ee83239d0f470442995bb1745b4c56f900a0e6a
parent1616460312a782465b83abd55f53f0d51901a641 (diff)
downloadserenity-d296001f3fea970956ad253a4db26ef3f2ac5210.zip
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.
-rw-r--r--Userland/Libraries/LibELF/Image.cpp2
-rw-r--r--Userland/Libraries/LibELF/Image.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibELF/Image.cpp b/Userland/Libraries/LibELF/Image.cpp
index 53ea48a304..77e09277b7 100644
--- a/Userland/Libraries/LibELF/Image.cpp
+++ b/Userland/Libraries/LibELF/Image.cpp
@@ -381,7 +381,6 @@ Optional<Image::Symbol> Image::find_demangled_function(StringView name) const
});
return found;
}
-#endif
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
{
auto symbol_count = this->symbol_count();
diff --git a/Userland/Libraries/LibELF/Image.h b/Userland/Libraries/LibELF/Image.h
index 3adcae87c1..f005a20f41 100644
--- a/Userland/Libraries/LibELF/Image.h
+++ b/Userland/Libraries/LibELF/Image.h
@@ -7,11 +7,14 @@
#pragma once
#include <AK/Concepts.h>
-#include <AK/String.h>
#include <AK/Vector.h>
#include <Kernel/VirtualAddress.h>
#include <LibC/elf.h>
+#ifndef KERNEL
+# include <AK/String.h>
+#endif
+
namespace ELF {
class Image {
@@ -255,6 +258,7 @@ private:
unsigned m_symbol_table_section_index { 0 };
unsigned m_string_table_section_index { 0 };
+#ifndef KERNEL
struct SortedSymbol {
FlatPtr address;
StringView name;
@@ -266,6 +270,7 @@ private:
SortedSymbol* find_sorted_symbol(FlatPtr) const;
mutable Vector<SortedSymbol> m_sorted_symbols;
+#endif
};
template<IteratorFunction<Image::Section> F>