summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2022-03-31 00:29:56 -0700
committerAndreas Kling <kling@serenityos.org>2022-03-31 10:18:07 +0200
commit7d667b9f69774a688c26a0a05acc45f9b9efd86c (patch)
tree84612d77771af7efa58b790bc396cd739e1acbf5 /Userland/Libraries
parent39f924a7315470da26d293fa4e6ecfedbf982828 (diff)
downloadserenity-7d667b9f69774a688c26a0a05acc45f9b9efd86c.zip
LibELF: Remove unused m_program_interpreter member from DynamicLoader
While profiling I realized that this member is unused, so the StringBuilder and String allocation are completely un-necessary.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp4
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.h1
-rw-r--r--Userland/Libraries/LibELF/Validation.h2
3 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp
index 793ffb4e4d..2ea5e16df6 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.cpp
+++ b/Userland/Libraries/LibELF/DynamicLoader.cpp
@@ -122,11 +122,9 @@ bool DynamicLoader::validate()
auto* elf_header = (ElfW(Ehdr)*)m_file_data;
if (!validate_elf_header(*elf_header, m_file_size))
return false;
- StringBuilder interpreter_path_builder;
- auto result_or_error = validate_program_headers(*elf_header, m_file_size, { m_file_data, m_file_size }, &interpreter_path_builder);
+ auto result_or_error = validate_program_headers(*elf_header, m_file_size, { m_file_data, m_file_size });
if (result_or_error.is_error() || !result_or_error.value())
return false;
- m_program_interpreter = interpreter_path_builder.string_view();
return true;
}
diff --git a/Userland/Libraries/LibELF/DynamicLoader.h b/Userland/Libraries/LibELF/DynamicLoader.h
index c6ca8fc7ab..23ef8ff5c9 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.h
+++ b/Userland/Libraries/LibELF/DynamicLoader.h
@@ -135,7 +135,6 @@ private:
ssize_t negative_offset_from_tls_block_end(ssize_t tls_offset, size_t value_of_symbol) const;
String m_filename;
- String m_program_interpreter;
size_t m_file_size { 0 };
int m_image_fd { -1 };
void* m_file_data { nullptr };
diff --git a/Userland/Libraries/LibELF/Validation.h b/Userland/Libraries/LibELF/Validation.h
index 3311f1b29f..cee09a8c41 100644
--- a/Userland/Libraries/LibELF/Validation.h
+++ b/Userland/Libraries/LibELF/Validation.h
@@ -13,6 +13,6 @@
namespace ELF {
bool validate_elf_header(ElfW(Ehdr) const& elf_header, size_t file_size, bool verbose = true);
-ErrorOr<bool> validate_program_headers(ElfW(Ehdr) const& elf_header, size_t file_size, ReadonlyBytes buffer, StringBuilder* interpreter_path_builder, bool verbose = true);
+ErrorOr<bool> validate_program_headers(ElfW(Ehdr) const& elf_header, size_t file_size, ReadonlyBytes buffer, StringBuilder* interpreter_path_builder = nullptr, bool verbose = true);
} // end namespace ELF