From a67e06184b9a5c6ee6ae64ad3d7dcd196b94825c Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Tue, 21 Sep 2021 00:51:26 +0800 Subject: [PATCH] LibC+LibELF: Add definitions for extra dtags These are found in some libraries, and LibELF doesn't know how to handle them, not even their name. Adding these definitions should at least help readelf display information correctly, but more work is needed to actually implement them. --- Userland/Libraries/LibC/elf.h | 5 +++++ Userland/Libraries/LibELF/DynamicObject.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/Userland/Libraries/LibC/elf.h b/Userland/Libraries/LibC/elf.h index 425a83234d4..abb21e45365 100644 --- a/Userland/Libraries/LibC/elf.h +++ b/Userland/Libraries/LibC/elf.h @@ -552,9 +552,14 @@ typedef struct { /* some other useful tags */ #define DT_GNU_HASH 0x6ffffef5 /* address of GNU hash table */ +#define DT_VERSYM 0x6ffffff0 /* address of table provided by .gnu.version */ #define DT_RELACOUNT 0x6ffffff9 /* if present, number of RELATIVE */ #define DT_RELCOUNT 0x6ffffffa /* relocs, which must come first */ #define DT_FLAGS_1 0x6ffffffb +#define DT_VERDEF 0x6ffffffc /* address of version definition table */ +#define DT_VERDEFNUM 0x6ffffffd /* number of version definitions */ +#define DT_VERNEEDED 0x6ffffffe /* address of the dependency table */ +#define DT_VERNEEDEDNUM 0x6fffffff /* number of entries in VERNEEDED */ /* Dynamic Flags - DT_FLAGS .dynamic entry */ #define DF_ORIGIN 0x00000001 diff --git a/Userland/Libraries/LibELF/DynamicObject.cpp b/Userland/Libraries/LibELF/DynamicObject.cpp index ca76f8bf04a..805927ca0fb 100644 --- a/Userland/Libraries/LibELF/DynamicObject.cpp +++ b/Userland/Libraries/LibELF/DynamicObject.cpp @@ -422,6 +422,16 @@ const char* DynamicObject::name_for_dtag(ElfW(Sword) d_tag) return "RELCOUNT"; /* relocs, which must come first */ case DT_FLAGS_1: return "FLAGS_1"; + case DT_VERDEF: + return "VERDEF"; + case DT_VERDEFNUM: + return "VERDEFNUM"; + case DT_VERSYM: + return "VERSYM"; + case DT_VERNEEDED: + return "VERNEEDED"; + case DT_VERNEEDEDNUM: + return "VERNEEDEDNUM"; default: return "??"; }