File indexing completed on 2024-05-12 05:43:30
0001 /* 0002 Copyright (C) 2015 Volker Krause <vkrause@kde.org> 0003 0004 This program is free software; you can redistribute it and/or modify it 0005 under the terms of the GNU Library General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or (at your 0007 option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, but WITHOUT 0010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 0012 License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program. If not, see <https://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include "dynamicsectionprinter.h" 0019 #include "printerutils_p.h" 0020 0021 #include <QByteArray> 0022 0023 #include <elf.h> 0024 0025 static const LookupTableEntry<uint64_t> dt_flag_infos[] { 0026 { DF_ORIGIN, "object may use DF_ORIGIN" }, 0027 { DF_SYMBOLIC, "symbol resolutions starts here" }, 0028 { DF_TEXTREL, "object contains text relocations" }, 0029 { DF_BIND_NOW, "no lazy binding for this object" }, 0030 { DF_STATIC_TLS, "module uses the static TLS model" } 0031 }; 0032 0033 static const LookupTableEntry<uint64_t> dt_flag_1_infos[] { 0034 { DF_1_GLOBAL, "set RTLD_GLOBAL for this object" }, 0035 { DF_1_NODELETE, "set RTLD_NODELETE for this object" }, 0036 { DF_1_LOADFLTR, "trigger filtee loading at runtime" }, 0037 { DF_1_NOOPEN, "set RTLD_NOOPEN for this object" }, 0038 { DF_1_ORIGIN, "$ORIGIN must be handled" }, 0039 { DF_1_INTERPOSE, "object is used to interpose" }, 0040 { DF_1_NODEFLIB, "ignore default lib search path" }, 0041 #ifdef DF_1_NOW 0042 // Presumably GLIBC-dwarf.h defines, not available on FreeBSD 0043 { DF_1_NOW, "set RTLD_NOW for this object" }, 0044 { DF_1_GROUP, "set RTLD_GROUP for this object" }, 0045 { DF_1_INITFIRST, "set RTLD_INITFIRST for this object" }, 0046 { DF_1_DIRECT, "direct binding enabled" }, 0047 { DF_1_TRANS, "DF_1_TRANS" }, 0048 { DF_1_NODUMP, "object cannot be dldump'ed" }, 0049 { DF_1_CONFALT, "configuration alternative created" }, 0050 { DF_1_ENDFILTEE, "filtee terminates filters search" }, 0051 { DF_1_DISPRELDNE, "disp reloc applied at build time" }, 0052 { DF_1_DISPRELPND, "disp reloc applied at run-time" }, 0053 #endif 0054 #ifdef __GLIBC_PREREQ 0055 #if __GLIBC_PREREQ(2, 17) 0056 { DF_1_NODIRECT, "object has no-direct binding" }, 0057 { DF_1_IGNMULDEF, "DF_1_IGNMULDEF" }, 0058 { DF_1_NOKSYMS, "DF_1_NOKSYMS" }, 0059 { DF_1_NOHDR, "DF_!_NOHDR" }, 0060 { DF_1_EDITED, "Object is modified after built" }, 0061 { DF_1_NORELOC, "DF_1_NORELOC" }, 0062 { DF_1_SYMINTPOSE, "Object has individual interposers" }, 0063 { DF_1_GLOBAUDIT, "Global auditing required" }, 0064 { DF_1_SINGLETON, "Singleton symbols are used" } 0065 #endif 0066 #endif 0067 }; 0068 0069 namespace DynamicSectionPrinter { 0070 0071 QByteArray flagsToDescriptions(uint64_t flags) 0072 { 0073 return lookupFlags(flags, dt_flag_infos); 0074 } 0075 0076 QByteArray flags1ToDescriptions(uint64_t flags) 0077 { 0078 return lookupFlags(flags, dt_flag_1_infos); 0079 } 0080 0081 }