summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibELF/DynamicObject.cpp12
-rw-r--r--Userland/Libraries/LibELF/DynamicObject.h6
2 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp
index 8d2b08ca6b..c379d21e82 100644
--- a/Userland/Libraries/LibELF/DynamicObject.cpp
+++ b/Userland/Libraries/LibELF/DynamicObject.cpp
@@ -72,6 +72,10 @@ void DynamicObject::dump() const
if (m_has_soname)
builder.appendff("DT_SONAME: {}\n", soname()); // FIXME: Validate that this string is null terminated?
+ if (m_has_rpath)
+ builder.appendff("DT_RPATH: {}\n", rpath());
+ if (m_has_runpath)
+ builder.appendff("DT_RUNPATH: {}\n", runpath());
dbgln_if(DYNAMIC_LOAD_DEBUG, "Dynamic section at address {} contains {} entries:", m_dynamic_address.as_ptr(), num_dynamic_sections);
dbgln_if(DYNAMIC_LOAD_DEBUG, "{}", builder.string_view());
@@ -163,6 +167,14 @@ void DynamicObject::parse()
case DT_BIND_NOW:
m_dt_flags |= DF_BIND_NOW;
break;
+ case DT_RPATH:
+ m_rpath_index = entry.val();
+ m_has_rpath = true;
+ break;
+ case DT_RUNPATH:
+ m_runpath_index = entry.val();
+ m_has_runpath = true;
+ break;
case DT_DEBUG:
break;
case DT_FLAGS_1:
diff --git a/Userland/Libraries/LibELF/DynamicObject.h b/Userland/Libraries/LibELF/DynamicObject.h
index 151f5d898d..8fa50bc18c 100644
--- a/Userland/Libraries/LibELF/DynamicObject.h
+++ b/Userland/Libraries/LibELF/DynamicObject.h
@@ -238,6 +238,8 @@ public:
VirtualAddress plt_got_base_address() const { return m_base_address.offset(m_procedure_linkage_table_offset.value()); }
VirtualAddress base_address() const { return m_base_address; }
+ StringView rpath() const { return m_has_rpath ? symbol_string_table_string(m_rpath_index) : StringView {}; }
+ StringView runpath() const { return m_has_runpath ? symbol_string_table_string(m_runpath_index) : StringView {}; }
StringView soname() const { return m_has_soname ? symbol_string_table_string(m_soname_index) : StringView {}; }
Optional<FlatPtr> tls_offset() const { return m_tls_offset; }
@@ -320,6 +322,10 @@ private:
bool m_has_soname { false };
Elf32_Word m_soname_index { 0 }; // Index into dynstr table for SONAME
+ bool m_has_rpath { false };
+ Elf32_Word m_rpath_index { 0 }; // Index into dynstr table for RPATH
+ bool m_has_runpath { false };
+ Elf32_Word m_runpath_index { 0 }; // Index into dynstr table for RUNPATH
Optional<FlatPtr> m_tls_offset;
Optional<FlatPtr> m_tls_size;