Projects STRLCPY LIEF Commits 7a62df9b
🤬
Showing first 73 files as there are too many
  • ■ ■ ■ ■ ■
    .github/workflows/windows-all.yml
    skipped 134 lines
    135 135   python -m pip install -r tests/requirements.txt
    136 136   python tests/dl_samples.py %LIEF_SAMPLES_DIR%
    137 137   python -m pip -vvv install --user api/python
     138 + - name: Download samples
     139 + shell: cmd
     140 + run: |
     141 + python -m pip install -r tests/requirements.txt
     142 + python tests/dl_samples.py %LIEF_SAMPLES_DIR%
    138 143   - name: Run tests
    139 144   timeout-minutes: 20
    140 145   shell: cmd
    skipped 112 lines
  • ■ ■ ■ ■
    .github/workflows/windows-quick.yml
    skipped 61 lines
    62 62   shell: cmd
    63 63   run: |
    64 64   python -m pip install -r tests/requirements.txt
     65 + python -m pip -vvv install api/python
     66 + - name: Download samples
     67 + shell: cmd
     68 + run: |
    65 69   python tests/dl_samples.py %LIEF_SAMPLES_DIR%
    66  - python -m pip -vvv install api/python
    67 70   - name: Run tests
    68 71   shell: cmd
    69 72   timeout-minutes: 20
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    api/c/ELF/Binary.cpp
    skipped 35 lines
    36 36  namespace ELF {
    37 37  void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
    38 38   c_binary->handler = reinterpret_cast<void*>(binary);
    39  - c_binary->type = static_cast<enum LIEF_ELF_ELF_CLASS>(binary->type());
     39 + c_binary->type = static_cast<uint32_t>(binary->type());
    40 40   c_binary->interpreter = nullptr;
    41 41   if (binary->has_interpreter()) {
    42 42   const std::string& interp = binary->interpreter();
    skipped 4 lines
    47 47   interp.size());
    48 48   reinterpret_cast<char*>(const_cast<char*>(c_binary->interpreter))[interp.size()] = '\0';
    49 49   }
    50  - 
    51 50   
    52 51   init_c_header(c_binary, binary);
    53 52   init_c_sections(c_binary, binary);
    skipped 27 lines
    81 80  int elf_binary_save_header(Elf_Binary_t* binary) {
    82 81   Header& hdr = reinterpret_cast<Binary*>(binary->handler)->header();
    83 82   
    84  - hdr.file_type(static_cast<LIEF::ELF::E_TYPE>(binary->header.file_type));
    85  - hdr.machine_type(static_cast<LIEF::ELF::ARCH>(binary->header.machine_type));
    86  - hdr.object_file_version(static_cast<LIEF::ELF::VERSION>(binary->header.object_file_version));
     83 + hdr.file_type(LIEF::ELF::Header::FILE_TYPE(binary->header.file_type));
     84 + hdr.machine_type(LIEF::ELF::ARCH(binary->header.machine_type));
     85 + hdr.object_file_version(LIEF::ELF::Header::VERSION(binary->header.object_file_version));
    87 86   hdr.program_headers_offset(binary->header.program_headers_offset);
    88 87   hdr.section_headers_offset(binary->header.section_headers_offset);
    89 88   hdr.processor_flag(binary->header.processor_flags);
    skipped 30 lines
  • ■ ■ ■ ■ ■
    api/c/ELF/CMakeLists.txt
    skipped 4 lines
    5 5   DynamicEntry.cpp
    6 6   Header.cpp
    7 7   Binary.cpp
    8  - EnumToString.cpp
    9 8   utils.cpp
    10 9  )
    11 10   
  • ■ ■ ■ ■ ■ ■
    api/c/ELF/DynamicEntry.cpp
    skipped 33 lines
    34 34   for (size_t i = 0; i < dyn_entries.size(); ++i) {
    35 35   DynamicEntry& entry = dyn_entries[i];
    36 36   switch(entry.tag()) {
    37  - case DYNAMIC_TAGS::DT_NEEDED:
     37 + case DynamicEntry::TAG::NEEDED:
    38 38   {
    39  - 
    40 39   auto* e = static_cast<Elf_DynamicEntry_Library_t*>(
    41 40   malloc(sizeof(Elf_DynamicEntry_Library_t)));
    42 41   
    43  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     42 + e->tag = static_cast<uint64_t>(entry.tag());
    44 43   e->value = entry.value();
    45 44   e->name = reinterpret_cast<DynamicEntryLibrary*>(&entry)->name().c_str();
    46 45   
    skipped 1 lines
    48 47   break;
    49 48   }
    50 49   
    51  - case DYNAMIC_TAGS::DT_SONAME:
     50 + case DynamicEntry::TAG::SONAME:
    52 51   {
    53 52   auto* e = static_cast<Elf_DynamicEntry_SharedObject_t*>(
    54 53   malloc(sizeof(Elf_DynamicEntry_SharedObject_t)));
    55 54   
    56  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     55 + e->tag = static_cast<uint64_t>(entry.tag());
    57 56   e->value = entry.value();
    58 57   e->name = reinterpret_cast<DynamicSharedObject*>(&entry)->name().c_str();
    59 58   
    skipped 1 lines
    61 60   break;
    62 61   }
    63 62   
    64  - case DYNAMIC_TAGS::DT_RPATH:
     63 + case DynamicEntry::TAG::RPATH:
    65 64   {
    66 65   auto* e = static_cast<Elf_DynamicEntry_Rpath_t*>(
    67 66   malloc(sizeof(Elf_DynamicEntry_Rpath_t)));
    68 67   
    69  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     68 + e->tag = static_cast<uint64_t>(entry.tag());
    70 69   e->value = entry.value();
    71  - e->rpath = reinterpret_cast<DynamicEntryRpath*>(&entry)->name().c_str();
     70 + e->rpath = reinterpret_cast<DynamicEntryRpath*>(&entry)->rpath().c_str();
    72 71   
    73 72   c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
    74 73   
    75 74   break;
    76 75   }
    77 76   
    78  - case DYNAMIC_TAGS::DT_RUNPATH:
     77 + case DynamicEntry::TAG::RUNPATH:
    79 78   {
    80 79   auto* e = static_cast<Elf_DynamicEntry_RunPath_t*>(
    81 80   malloc(sizeof(Elf_DynamicEntry_RunPath_t)));
    82 81   
    83  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     82 + e->tag = static_cast<uint64_t>(entry.tag());
    84 83   e->value = entry.value();
    85  - e->runpath = reinterpret_cast<DynamicEntryRunPath*>(&entry)->name().c_str();
     84 + e->runpath = reinterpret_cast<DynamicEntryRunPath*>(&entry)->runpath().c_str();
    86 85   
    87 86   c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
    88 87   
    89 88   break;
    90 89   }
    91 90   
    92  - case DYNAMIC_TAGS::DT_INIT_ARRAY:
    93  - case DYNAMIC_TAGS::DT_FINI_ARRAY:
    94  - case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
     91 + case DynamicEntry::TAG::INIT_ARRAY:
     92 + case DynamicEntry::TAG::FINI_ARRAY:
     93 + case DynamicEntry::TAG::PREINIT_ARRAY:
    95 94   {
    96 95   auto* e = static_cast<Elf_DynamicEntry_Array_t*>(
    97 96   malloc(sizeof(Elf_DynamicEntry_Array_t)));
    98 97   
    99  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     98 + e->tag = static_cast<uint64_t>(entry.tag());
    100 99   e->value = entry.value();
    101 100   const std::vector<uint64_t>& array = reinterpret_cast<DynamicEntryArray*>(&entry)->array();
    102 101   e->array = static_cast<uint64_t*>(malloc((array.size() + 1) * sizeof(uint64_t)));
    skipped 6 lines
    109 108   break;
    110 109   }
    111 110   
    112  - case DYNAMIC_TAGS::DT_FLAGS:
     111 + case DynamicEntry::TAG::FLAGS:
    113 112   {
    114 113   auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
    115 114   malloc(sizeof(Elf_DynamicEntry_Flags_t)));
    116 115   
    117  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     116 + e->tag = static_cast<uint64_t>(entry.tag());
    118 117   e->value = entry.value();
    119 118   const DynamicEntryFlags::flags_list_t& flags = reinterpret_cast<DynamicEntryFlags*>(&entry)->flags();
    120  - e->flags = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS)));
    121  - e->flags_1 = nullptr;
    122 119   
    123  - auto it = std::begin(flags);
    124  - 
    125  - for (size_t i = 0; it != std::end(flags); ++i, ++it) {
    126  - e->flags[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(*it);
    127  - }
    128  - 
    129  - e->flags[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(0);
    130 120   c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
    131 121   
    132 122   break;
    133 123   }
    134 124   
    135  - case DYNAMIC_TAGS::DT_FLAGS_1:
     125 + case DynamicEntry::TAG::FLAGS_1:
    136 126   {
    137 127   auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
    138 128   malloc(sizeof(Elf_DynamicEntry_Flags_t)));
    139 129   
    140  - e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
     130 + e->tag = static_cast<uint64_t>(entry.tag());
    141 131   e->value = entry.value();
    142 132   const DynamicEntryFlags::flags_list_t& flags = reinterpret_cast<DynamicEntryFlags*>(&entry)->flags();
    143  - e->flags_1 = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS_1)));
    144  - e->flags = nullptr;
    145  - 
    146  - auto it = std::begin(flags);
    147  - 
    148  - for (size_t i = 0; it != std::end(flags); ++i, ++it) {
    149  - e->flags_1[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(*it);
    150  - }
    151  - 
    152  - e->flags_1[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(0);
    153 133   c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
    154 134   
    155 135   break;
    156 136   }
    157  - 
    158  - 
    159  - 
    160 137   
    161 138   default:
    162 139   {
    skipped 7 lines
    170 147   }
    171 148   
    172 149   c_binary->dynamic_entries[dyn_entries.size()] = nullptr;
    173  - 
    174 150  }
    175 151   
    176 152   
    skipped 2 lines
    179 155   
    180 156   Elf_DynamicEntry_t **dynamic_entries = c_binary->dynamic_entries;
    181 157   for (size_t idx = 0; dynamic_entries[idx] != nullptr; ++idx) {
    182  - switch(static_cast<DYNAMIC_TAGS>(dynamic_entries[idx]->tag)) {
    183  - case DYNAMIC_TAGS::DT_NEEDED:
     158 + switch(DynamicEntry::TAG(dynamic_entries[idx]->tag)) {
     159 + case DynamicEntry::TAG::NEEDED:
    184 160   {
    185 161   free(reinterpret_cast<Elf_DynamicEntry_Library_t*>(dynamic_entries[idx]));
    186 162   break;
    187 163   }
    188 164   
    189  - case DYNAMIC_TAGS::DT_SONAME:
     165 + case DynamicEntry::TAG::SONAME:
    190 166   {
    191 167   free(reinterpret_cast<Elf_DynamicEntry_SharedObject_t*>(dynamic_entries[idx]));
    192 168   break;
    193 169   }
    194 170   
    195  - case DYNAMIC_TAGS::DT_RPATH:
     171 + case DynamicEntry::TAG::RPATH:
    196 172   {
    197 173   free(reinterpret_cast<Elf_DynamicEntry_Rpath_t*>(dynamic_entries[idx]));
    198 174   break;
    199 175   }
    200 176   
    201  - case DYNAMIC_TAGS::DT_RUNPATH:
     177 + case DynamicEntry::TAG::RUNPATH:
    202 178   {
    203 179   free(reinterpret_cast<Elf_DynamicEntry_RunPath_t*>(dynamic_entries[idx]));
    204 180   break;
    205 181   }
    206 182   
    207  - case DYNAMIC_TAGS::DT_INIT_ARRAY:
    208  - case DYNAMIC_TAGS::DT_FINI_ARRAY:
    209  - case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
     183 + case DynamicEntry::TAG::INIT_ARRAY:
     184 + case DynamicEntry::TAG::FINI_ARRAY:
     185 + case DynamicEntry::TAG::PREINIT_ARRAY:
    210 186   {
    211 187   Elf_DynamicEntry_Array_t* entry_array=reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]);
    212 188   free(entry_array->array);
    skipped 1 lines
    214 190   break;
    215 191   }
    216 192   
    217  - case DYNAMIC_TAGS::DT_FLAGS:
     193 + case DynamicEntry::TAG::FLAGS:
    218 194   {
    219 195   Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
    220  - free(entry_flags->flags);
    221 196   free(entry_flags);
    222 197   break;
    223 198   }
    224  - case DYNAMIC_TAGS::DT_FLAGS_1:
     199 + case DynamicEntry::TAG::FLAGS_1:
    225 200   {
    226 201   Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
    227  - free(entry_flags->flags_1);
    228 202   free(entry_flags);
    229 203   break;
    230 204   }
    231 205   
    232 206   default:
    233 207   {
    234  - 
    235 208   free(dynamic_entries[idx]);
    236 209   }
    237 210   
    skipped 7 lines
    245 218  }
    246 219  }
    247 220   
    248  - 
    249  - 
  • ■ ■ ■ ■ ■ ■
    api/c/ELF/EnumToString.cpp
    1  -/* Copyright 2017 - 2023 R. Thomas
    2  - * Copyright 2017 - 2023 Quarkslab
    3  - *
    4  - * Licensed under the Apache License, Version 2.0 (the "License");
    5  - * you may not use this file except in compliance with the License.
    6  - * You may obtain a copy of the License at
    7  - *
    8  - * http://www.apache.org/licenses/LICENSE-2.0
    9  - *
    10  - * Unless required by applicable law or agreed to in writing, software
    11  - * distributed under the License is distributed on an "AS IS" BASIS,
    12  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  - * See the License for the specific language governing permissions and
    14  - * limitations under the License.
    15  - */
    16  -#include "LIEF/ELF/EnumToString.h"
    17  -#include "LIEF/ELF/EnumToString.hpp"
    18  - 
    19  -#include "LIEF/ELF/enums.h"
    20  -#include "LIEF/ELF/enums.hpp"
    21  - 
    22  -extern "C"
    23  -{
    24  - const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e) {
    25  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::E_TYPE>(e));
    26  - }
    27  - 
    28  - const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e) {
    29  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::SYMBOL_BINDINGS>(e));
    30  - }
    31  - 
    32  - const char* VERSION_to_string(enum LIEF_ELF_VERSION e) {
    33  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::VERSION>(e));
    34  - }
    35  - 
    36  - const char* ARCH_to_string(enum LIEF_ELF_ARCH e) {
    37  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ARCH>(e));
    38  - }
    39  - 
    40  - const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e) {
    41  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::SEGMENT_TYPES>(e));
    42  - }
    43  - 
    44  - const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e) {
    45  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_TAGS>(e));
    46  - }
    47  - 
    48  - const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e) {
    49  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_TYPES>(e));
    50  - }
    51  - 
    52  - const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e) {
    53  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_FLAGS>(e));
    54  - }
    55  - 
    56  - const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e) {
    57  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SYMBOL_TYPES>(e));
    58  - }
    59  - 
    60  - const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e) {
    61  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_CLASS>(e));
    62  - }
    63  - 
    64  - const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e) {
    65  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_DATA>(e));
    66  - }
    67  - 
    68  - const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e) {
    69  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::OS_ABI>(e));
    70  - }
    71  - 
    72  - const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e) {
    73  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS>(e));
    74  - }
    75  - 
    76  - const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e) {
    77  - return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS_1>(e));
    78  - }
    79  - 
    80  -}
    81  - 
  • ■ ■ ■ ■ ■ ■
    api/c/ELF/Header.cpp
    skipped 20 lines
    21 21  void init_c_header(Elf_Binary_t* c_binary, Binary* binary) {
    22 22   
    23 23   const Header& hdr = binary->header();
    24  - c_binary->header.file_type = static_cast<enum LIEF_ELF_E_TYPE>(hdr.file_type());
    25  - c_binary->header.machine_type = static_cast<enum LIEF_ELF_ARCH>(hdr.machine_type());
    26  - c_binary->header.object_file_version = static_cast<enum LIEF_ELF_VERSION>(hdr.object_file_version());
     24 + c_binary->header.file_type = static_cast<uint32_t>(hdr.file_type());
     25 + c_binary->header.machine_type = static_cast<uint32_t>(hdr.machine_type());
     26 + c_binary->header.object_file_version = static_cast<uint32_t>(hdr.object_file_version());
    27 27   c_binary->header.program_headers_offset = hdr.program_headers_offset();
    28 28   c_binary->header.section_headers_offset = hdr.section_headers_offset();
    29 29   c_binary->header.processor_flags = hdr.processor_flag();
    skipped 5 lines
    35 35   c_binary->header.name_string_table_idx = hdr.section_name_table_idx();
    36 36   c_binary->header.entrypoint = hdr.entrypoint();
    37 37   const Header::identity_t& ident = hdr.identity();
    38  - std::copy(
    39  - std::begin(ident),
    40  - std::end(ident),
    41  - c_binary->header.identity);
     38 + std::copy(std::begin(ident), std::end(ident), c_binary->header.identity);
    42 39   
    43 40  }
    44 41   
    skipped 3 lines
  • ■ ■ ■ ■
    api/c/ELF/Section.cpp
    skipped 30 lines
    31 31   
    32 32   c_binary->sections[i]->name = b_section.fullname().c_str();
    33 33   c_binary->sections[i]->flags = b_section.flags();
    34  - c_binary->sections[i]->type = static_cast<enum LIEF_ELF_ELF_SECTION_TYPES>(b_section.type());
     34 + c_binary->sections[i]->type = static_cast<uint32_t>(b_section.type());
    35 35   c_binary->sections[i]->virtual_address = b_section.virtual_address();
    36 36   c_binary->sections[i]->offset = b_section.file_offset();
    37 37   c_binary->sections[i]->original_size = b_section.original_size();
    skipped 30 lines
  • ■ ■ ■ ■
    api/c/ELF/Segment.cpp
    skipped 28 lines
    29 29   span<const uint8_t> segment_content = segment.content();
    30 30   
    31 31   c_binary->segments[i] = static_cast<Elf_Segment_t*>(malloc(sizeof(Elf_Segment_t)));
    32  - c_binary->segments[i]->type = static_cast<enum LIEF_ELF_SEGMENT_TYPES>(segment.type());
     32 + c_binary->segments[i]->type = static_cast<uint32_t>(segment.type());
    33 33   c_binary->segments[i]->flags = static_cast<uint32_t>(segment.flags());
    34 34   c_binary->segments[i]->virtual_address = segment.virtual_address();
    35 35   c_binary->segments[i]->virtual_size = segment.virtual_size();
    skipped 8 lines
    44 44   
    45 45  }
    46 46   
    47  - 
    48  - 
    49 47  void destroy_segments(Elf_Binary_t* c_binary) {
    50  - 
    51 48   Elf_Segment_t **segments = c_binary->segments;
    52 49   for (size_t idx = 0; segments[idx] != nullptr; ++idx) {
    53 50   free(segments[idx]);
    skipped 10 lines
  • ■ ■ ■ ■ ■ ■
    api/c/ELF/Symbol.cpp
    skipped 27 lines
    28 28   Symbol& b_sym = dyn_symb[i];
    29 29   c_binary->dynamic_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
    30 30   c_binary->dynamic_symbols[i]->name = b_sym.name().c_str();
    31  - c_binary->dynamic_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
    32  - c_binary->dynamic_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
     31 + c_binary->dynamic_symbols[i]->type = static_cast<uint32_t>(b_sym.type());
     32 + c_binary->dynamic_symbols[i]->binding = static_cast<uint32_t>(b_sym.binding());
    33 33   c_binary->dynamic_symbols[i]->other = b_sym.other();
    34 34   c_binary->dynamic_symbols[i]->shndx = b_sym.shndx();
    35 35   c_binary->dynamic_symbols[i]->value = b_sym.value();
    skipped 4 lines
    40 40   }
    41 41   c_binary->dynamic_symbols[dyn_symb.size()] = nullptr;
    42 42   
    43  - 
    44  - 
    45 43  }
    46 44   
    47 45   
    skipped 7 lines
    55 53   Symbol& b_sym = static_symb[i];
    56 54   c_binary->static_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
    57 55   c_binary->static_symbols[i]->name = b_sym.name().c_str();
    58  - c_binary->static_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
    59  - c_binary->static_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
     56 + c_binary->static_symbols[i]->type = static_cast<uint32_t>(b_sym.type());
     57 + c_binary->static_symbols[i]->binding = static_cast<uint32_t>(b_sym.binding());
    60 58   c_binary->static_symbols[i]->other = b_sym.other();
    61 59   c_binary->static_symbols[i]->shndx = b_sym.shndx();
    62 60   c_binary->static_symbols[i]->value = b_sym.value();
    skipped 33 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/Binary.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_BINARY_H_
    17  -#define C_LIEF_ELF_BINARY_H_
     16 +#ifndef LIEF_C_ELF_BINARY_H
     17 +#define LIEF_C_ELF_BINARY_H
    18 18   
    19 19  #include <stddef.h>
    20 20   
    skipped 16 lines
    37 37   void* handler;
    38 38   const char* name;
    39 39   const char* interpreter;
    40  - enum LIEF_ELF_ELF_CLASS type;
     40 + uint32_t type;
    41 41   Elf_Header_t header;
    42 42   Elf_Section_t **sections;
    43 43   Elf_Segment_t **segments;
    skipped 21 lines
  • ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/DynamicEntry.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_DYNAMIC_ENTRY_H_
    17  -#define C_LIEF_ELF_DYNAMIC_ENTRY_H_
     16 +#ifndef LIEF_C_ELF_DYNAMIC_ENTRY_H
     17 +#define LIEF_C_ELF_DYNAMIC_ENTRY_H
    18 18   
    19 19  #include <stdint.h>
    20  - 
    21  -#include "LIEF/ELF/enums.h"
    22 20   
    23 21  #ifdef __cplusplus
    24 22  extern "C" {
    skipped 34 lines
    59 57   const char* runpath;
    60 58  };
    61 59   
    62  - 
    63 60  struct Elf_DynamicEntry_Flags_t {
    64 61   uint64_t tag;
    65 62   uint64_t value;
    66  - enum LIEF_ELF_DYNAMIC_FLAGS *flags;
    67  - enum LIEF_ELF_DYNAMIC_FLAGS_1 *flags_1;
    68 63  };
    69 64   
    70 65  typedef struct Elf_DynamicEntry_t Elf_DynamicEntry_t;
    skipped 13 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/EnumToString.h
    1  -/* Copyright 2017 - 2023 R. Thomas
    2  - * Copyright 2017 - 2023 Quarkslab
    3  - *
    4  - * Licensed under the Apache License, Version 2.0 (the "License");
    5  - * you may not use this file except in compliance with the License.
    6  - * You may obtain a copy of the License at
    7  - *
    8  - * http://www.apache.org/licenses/LICENSE-2.0
    9  - *
    10  - * Unless required by applicable law or agreed to in writing, software
    11  - * distributed under the License is distributed on an "AS IS" BASIS,
    12  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  - * See the License for the specific language governing permissions and
    14  - * limitations under the License.
    15  - */
    16  -#ifndef C_LIEF_ELF_ENUM_TO_STRING_H_
    17  -#define C_LIEF_ELF_ENUM_TO_STRING_H_
    18  - 
    19  -#include "LIEF/visibility.h"
    20  - 
    21  -#include "LIEF/ELF/enums.h"
    22  - 
    23  -#ifdef __cplusplus
    24  -extern "C" {
    25  -#endif
    26  - 
    27  -LIEF_API const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e);
    28  -LIEF_API const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e);
    29  -LIEF_API const char* VERSION_to_string(enum LIEF_ELF_VERSION e);
    30  -LIEF_API const char* ARCH_to_string(enum LIEF_ELF_ARCH e);
    31  -LIEF_API const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e);
    32  -LIEF_API const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e);
    33  -LIEF_API const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e);
    34  -LIEF_API const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e);
    35  -LIEF_API const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e);
    36  -LIEF_API const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e);
    37  -LIEF_API const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e);
    38  -LIEF_API const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e);
    39  -LIEF_API const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e);
    40  -LIEF_API const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e);
    41  - 
    42  -#ifdef __cplusplus
    43  -}
    44  -#endif
    45  - 
    46  - 
    47  -#endif
    48  - 
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/Header.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_HEADER_H_
    17  -#define C_LIEF_ELF_HEADER_H_
     16 +#ifndef LIEF_C_ELF_HEADER_H
     17 +#define LIEF_C_ELF_HEADER_H
    18 18  #include <inttypes.h>
    19 19   
    20 20  #include "LIEF/ELF/enums.h"
    skipped 3 lines
    24 24  #endif
    25 25   
    26 26  struct Elf_Header_t {
    27  - uint8_t identity[LIEF_ELF_EI_NIDENT];
    28  - enum LIEF_ELF_E_TYPE file_type;
    29  - enum LIEF_ELF_ARCH machine_type;
    30  - enum LIEF_ELF_VERSION object_file_version;
    31  - uint64_t entrypoint;
    32  - uint64_t program_headers_offset;
    33  - uint64_t section_headers_offset;
    34  - uint32_t processor_flags;
    35  - uint32_t header_size;
    36  - uint32_t program_header_size;
    37  - uint32_t numberof_segments;
    38  - uint32_t section_header_size;
    39  - uint32_t numberof_sections;
    40  - uint32_t name_string_table_idx;
     27 + uint8_t identity[LIEF_EI_NIDENT];
     28 + uint32_t file_type;
     29 + uint32_t machine_type;
     30 + uint32_t object_file_version;
     31 + uint64_t entrypoint;
     32 + uint64_t program_headers_offset;
     33 + uint64_t section_headers_offset;
     34 + uint32_t processor_flags;
     35 + uint32_t header_size;
     36 + uint32_t program_header_size;
     37 + uint32_t numberof_segments;
     38 + uint32_t section_header_size;
     39 + uint32_t numberof_sections;
     40 + uint32_t name_string_table_idx;
    41 41  };
    42 42   
    43 43  typedef struct Elf_Header_t Elf_Header_t;
    skipped 8 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/Section.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_SECTION_H_
    17  -#define C_LIEF_ELF_SECTION_H_
     16 +#ifndef LIEF_C_ELF_SECTION_H
     17 +#define LIEF_C_ELF_SECTION_H
    18 18   
    19 19  #include <stdint.h>
    20 20   
    21  -#include "LIEF/ELF/enums.h"
    22  - 
    23 21  #ifdef __cplusplus
    24 22  extern "C" {
    25 23  #endif
    26 24   
    27 25  struct Elf_Section_t {
    28  - const char* name;
    29  - uint32_t flags;
    30  - enum LIEF_ELF_ELF_SECTION_TYPES type;
    31  - uint64_t virtual_address;
    32  - uint64_t offset;
    33  - uint64_t original_size;
    34  - uint32_t link;
    35  - uint32_t info;
    36  - uint64_t alignment;
    37  - uint64_t entry_size;
    38  - uint64_t size;
    39  - uint8_t* content;
    40  - double entropy;
     26 + const char* name;
     27 + uint32_t flags;
     28 + uint32_t type;
     29 + uint64_t virtual_address;
     30 + uint64_t offset;
     31 + uint64_t original_size;
     32 + uint32_t link;
     33 + uint32_t info;
     34 + uint64_t alignment;
     35 + uint64_t entry_size;
     36 + uint64_t size;
     37 + uint8_t* content;
     38 + double entropy;
    41 39  };
    42 40   
    43 41  typedef struct Elf_Section_t Elf_Section_t;
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/Segment.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_SEGMENT_H_
    17  -#define C_LIEF_ELF_SEGMENT_H_
     16 +#ifndef LIEF_C_ELF_SEGMENT_H_
     17 +#define LIEF_C_ELF_SEGMENT_H_
    18 18   
    19 19  #include <stdint.h>
    20 20  #include "LIEF/ELF/enums.h"
    skipped 3 lines
    24 24  #endif
    25 25   
    26 26  struct Elf_Segment_t {
    27  - enum LIEF_ELF_SEGMENT_TYPES type;
    28  - uint32_t flags;
    29  - uint64_t virtual_address;
    30  - uint64_t virtual_size;
    31  - uint64_t offset;
    32  - uint64_t alignment;
    33  - uint64_t size;
    34  - uint8_t* content;
     27 + uint32_t type;
     28 + uint32_t flags;
     29 + uint64_t virtual_address;
     30 + uint64_t virtual_size;
     31 + uint64_t offset;
     32 + uint64_t alignment;
     33 + uint64_t size;
     34 + uint8_t* content;
    35 35  };
    36 36   
    37 37  typedef struct Elf_Segment_t Elf_Segment_t;
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/Symbol.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_SYMBOL_H_
    17  -#define C_LIEF_ELF_SYMBOL_H_
     16 +#ifndef LIEF_C_ELF_SYMBOL_H
     17 +#define LIEF_C_ELF_SYMBOL_H
    18 18   
    19 19  #include <stdint.h>
    20  - 
    21  -#include "LIEF/ELF/enums.h"
    22 20  #include "LIEF/types.h"
    23 21   
    24 22  #ifdef __cplusplus
    skipped 1 lines
    26 24  #endif
    27 25   
    28 26  struct Elf_Symbol_t {
    29  - const char* name;
    30  - enum LIEF_ELF_ELF_SYMBOL_TYPES type;
    31  - enum LIEF_ELF_SYMBOL_BINDINGS binding;
    32  - uint8_t information;
    33  - uint8_t other;
    34  - uint16_t shndx;
    35  - uint64_t value;
    36  - uint64_t size;
    37  - bool is_exported; /**< Whether or not the symbol is exported */
    38  - bool is_imported; /**< Whether or not the symbol is imported */
     27 + const char* name;
     28 + uint32_t type;
     29 + uint32_t binding;
     30 + uint8_t information;
     31 + uint8_t other;
     32 + uint16_t shndx;
     33 + uint64_t value;
     34 + uint64_t size;
     35 + bool is_exported; /**< Whether or not the symbol is exported */
     36 + bool is_imported; /**< Whether or not the symbol is imported */
    39 37  };
    40 38   
    41 39  typedef struct Elf_Symbol_t Elf_Symbol_t;
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/enums.h
    skipped 5 lines
    6 6  extern "C" {
    7 7  #endif
    8 8   
    9  -#define _LIEF_EN(N) LIEF_ELF_##N
    10  -#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N
    11  -#define _LIEF_EI(X) LIEF_ELF_##X
     9 +/** e_ident size and indices. */
     10 +enum LIEF_IDENTITY {
     11 + LIEF_EI_MAG0 = 0, /**< File identification index. */
     12 + LIEF_EI_MAG1 = 1, /**< File identification index. */
     13 + LIEF_EI_MAG2 = 2, /**< File identification index. */
     14 + LIEF_EI_MAG3 = 3, /**< File identification index. */
     15 + LIEF_EI_CLASS = 4, /**< File class. */
     16 + LIEF_EI_DATA = 5, /**< Data encoding. */
     17 + LIEF_EI_VERSION = 6, /**< File version. */
     18 + LIEF_EI_OSABI = 7, /**< OS/ABI identification. */
     19 + LIEF_EI_ABIVERSION = 8, /**< ABI version. */
     20 + LIEF_EI_PAD = 9, /**< Start of padding bytes. */
     21 + LIEF_EI_NIDENT = 16 /**< Number of bytes in e_ident. */
     22 +};
     23 + 
     24 + 
     25 +/** Enum associated with *e_type* */
     26 +enum LIEF_E_TYPE {
     27 + LIEF_ET_NONE = 0, /**< No file type */
     28 + LIEF_ET_REL = 1, /**< Relocatable file */
     29 + LIEF_ET_EXEC = 2, /**< Executable file */
     30 + LIEF_ET_DYN = 3, /**< Shared object file */
     31 + LIEF_ET_CORE = 4, /**< Core file */
     32 + LIEF_ET_LOPROC = 0xff00, /**< Beginning of processor-specific codes */
     33 + LIEF_ET_HIPROC = 0xffff /**< Processor-specific */
     34 +};
     35 + 
     36 + 
     37 +/** Versioning */
     38 +enum LIEF_VERSION {
     39 + LIEF_EV_NONE = 0,
     40 + LIEF_EV_CURRENT = 1 /**< Default value */
     41 +};
     42 + 
     43 +/**
     44 + * @brief Machine architectures
     45 + * See current registered ELF machine architectures at:
     46 + * http://www.sco.com/developers/gabi/latest/ch4.eheader.html
     47 + */
     48 +enum LIEF_ARCH {
     49 + LIEF_EM_NONE = 0, /**< No machine */
     50 + LIEF_EM_M32 = 1, /**< AT&T WE 32100 */
     51 + LIEF_EM_SPARC = 2, /**< SPARC */
     52 + LIEF_EM_386 = 3, /**< Intel 386 */
     53 + LIEF_EM_68K = 4, /**< Motorola 68000 */
     54 + LIEF_EM_88K = 5, /**< Motorola 88000 */
     55 + LIEF_EM_IAMCU = 6, /**< Intel MCU */
     56 + LIEF_EM_860 = 7, /**< Intel 80860 */
     57 + LIEF_EM_MIPS = 8, /**< MIPS R3000 */
     58 + LIEF_EM_S370 = 9, /**< IBM System/370 */
     59 + LIEF_EM_MIPS_RS3_LE = 10, /**< MIPS RS3000 Little-endian */
     60 + LIEF_EM_PARISC = 15, /**< Hewlett-Packard PA-RISC */
     61 + LIEF_EM_VPP500 = 17, /**< Fujitsu VPP500 */
     62 + LIEF_EM_SPARC32PLUS = 18, /**< Enhanced instruction set SPARC */
     63 + LIEF_EM_960 = 19, /**< Intel 80960 */
     64 + LIEF_EM_PPC = 20, /**< PowerPC */
     65 + LIEF_EM_PPC64 = 21, /**< PowerPC64 */
     66 + LIEF_EM_S390 = 22, /**< IBM System/390 */
     67 + LIEF_EM_SPU = 23, /**< IBM SPU/SPC */
     68 + LIEF_EM_V800 = 36, /**< NEC V800 */
     69 + LIEF_EM_FR20 = 37, /**< Fujitsu FR20 */
     70 + LIEF_EM_RH32 = 38, /**< TRW RH-32 */
     71 + LIEF_EM_RCE = 39, /**< Motorola RCE */
     72 + LIEF_EM_ARM = 40, /**< ARM */
     73 + LIEF_EM_ALPHA = 41, /**< DEC Alpha */
     74 + LIEF_EM_SH = 42, /**< Hitachi SH */
     75 + LIEF_EM_SPARCV9 = 43, /**< SPARC V9 */
     76 + LIEF_EM_TRICORE = 44, /**< Siemens TriCore */
     77 + LIEF_EM_ARC = 45, /**< Argonaut RISC Core */
     78 + LIEF_EM_H8_300 = 46, /**< Hitachi H8/300 */
     79 + LIEF_EM_H8_300H = 47, /**< Hitachi H8/300H */
     80 + LIEF_EM_H8S = 48, /**< Hitachi H8S */
     81 + LIEF_EM_H8_500 = 49, /**< Hitachi H8/500 */
     82 + LIEF_EM_IA_64 = 50, /**< Intel IA-64 processor architecture */
     83 + LIEF_EM_MIPS_X = 51, /**< Stanford MIPS-X */
     84 + LIEF_EM_COLDFIRE = 52, /**< Motorola ColdFire */
     85 + LIEF_EM_68HC12 = 53, /**< Motorola M68HC12 */
     86 + LIEF_EM_MMA = 54, /**< Fujitsu MMA Multimedia Accelerator */
     87 + LIEF_EM_PCP = 55, /**< Siemens PCP */
     88 + LIEF_EM_NCPU = 56, /**< Sony nCPU embedded RISC processor */
     89 + LIEF_EM_NDR1 = 57, /**< Denso NDR1 microprocessor */
     90 + LIEF_EM_STARCORE = 58, /**< Motorola Star*Core processor */
     91 + LIEF_EM_ME16 = 59, /**< Toyota ME16 processor */
     92 + LIEF_EM_ST100 = 60, /**< STMicroelectronics ST100 processor */
     93 + LIEF_EM_TINYJ = 61, /**< Advanced Logic Corp. TinyJ embedded processor family */
     94 + LIEF_EM_X86_64 = 62, /**< AMD x86-64 architecture */
     95 + LIEF_EM_PDSP = 63, /**< Sony DSP Processor */
     96 + LIEF_EM_PDP10 = 64, /**< Digital Equipment Corp. PDP-10 */
     97 + LIEF_EM_PDP11 = 65, /**< Digital Equipment Corp. PDP-11 */
     98 + LIEF_EM_FX66 = 66, /**< Siemens FX66 microcontroller */
     99 + LIEF_EM_ST9PLUS = 67, /**< STMicroelectronics ST9+ 8/16 bit microcontroller */
     100 + LIEF_EM_ST7 = 68, /**< STMicroelectronics ST7 8-bit microcontroller */
     101 + LIEF_EM_68HC16 = 69, /**< Motorola MC68HC16 Microcontroller */
     102 + LIEF_EM_68HC11 = 70, /**< Motorola MC68HC11 Microcontroller */
     103 + LIEF_EM_68HC08 = 71, /**< Motorola MC68HC08 Microcontroller */
     104 + LIEF_EM_68HC05 = 72, /**< Motorola MC68HC05 Microcontroller */
     105 + LIEF_EM_SVX = 73, /**< Silicon Graphics SVx */
     106 + LIEF_EM_ST19 = 74, /**< STMicroelectronics ST19 8-bit microcontroller */
     107 + LIEF_EM_VAX = 75, /**< Digital VAX */
     108 + LIEF_EM_CRIS = 76, /**< Axis Communications 32-bit embedded processor */
     109 + LIEF_EM_JAVELIN = 77, /**< Infineon Technologies 32-bit embedded processor */
     110 + LIEF_EM_FIREPATH = 78, /**< Element 14 64-bit DSP Processor */
     111 + LIEF_EM_ZSP = 79, /**< LSI Logic 16-bit DSP Processor */
     112 + LIEF_EM_MMIX = 80, /**< Donald Knuth's educational 64-bit processor */
     113 + LIEF_EM_HUANY = 81, /**< Harvard University machine-independent object files */
     114 + LIEF_EM_PRISM = 82, /**< SiTera Prism */
     115 + LIEF_EM_AVR = 83, /**< Atmel AVR 8-bit microcontroller */
     116 + LIEF_EM_FR30 = 84, /**< Fujitsu FR30 */
     117 + LIEF_EM_D10V = 85, /**< Mitsubishi D10V */
     118 + LIEF_EM_D30V = 86, /**< Mitsubishi D30V */
     119 + LIEF_EM_V850 = 87, /**< NEC v850 */
     120 + LIEF_EM_M32R = 88, /**< Mitsubishi M32R */
     121 + LIEF_EM_MN10300 = 89, /**< Matsushita MN10300 */
     122 + LIEF_EM_MN10200 = 90, /**< Matsushita MN10200 */
     123 + LIEF_EM_PJ = 91, /**< picoJava */
     124 + LIEF_EM_OPENRISC = 92, /**< OpenRISC 32-bit embedded processor */
     125 + LIEF_EM_ARC_COMPACT = 93, /**< ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5 */
     126 + LIEF_EM_XTENSA = 94, /**< Tensilica Xtensa Architecture */
     127 + LIEF_EM_VIDEOCORE = 95, /**< Alphamosaic VideoCore processor */
     128 + LIEF_EM_TMM_GPP = 96, /**< Thompson Multimedia General Purpose Processor */
     129 + LIEF_EM_NS32K = 97, /**< National Semiconductor 32000 series */
     130 + LIEF_EM_TPC = 98, /**< Tenor Network TPC processor */
     131 + LIEF_EM_SNP1K = 99, /**< Trebia SNP 1000 processor */
     132 + LIEF_EM_ST200 = 100, /**< STMicroelectronics (www.st.com ST200 */
     133 + LIEF_EM_IP2K = 101, /**< Ubicom IP2xxx microcontroller family */
     134 + LIEF_EM_MAX = 102, /**< MAX Processor */
     135 + LIEF_EM_CR = 103, /**< National Semiconductor CompactRISC microprocessor */
     136 + LIEF_EM_F2MC16 = 104, /**< Fujitsu F2MC16 */
     137 + LIEF_EM_MSP430 = 105, /**< Texas Instruments embedded microcontroller msp430 */
     138 + LIEF_EM_BLACKFIN = 106, /**< Analog Devices Blackfin (DSP processor */
     139 + LIEF_EM_SE_C33 = 107, /**< S1C33 Family of Seiko Epson processors */
     140 + LIEF_EM_SEP = 108, /**< Sharp embedded microprocessor */
     141 + LIEF_EM_ARCA = 109, /**< Arca RISC Microprocessor */
     142 + LIEF_EM_UNICORE = 110, /**< Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
     143 + LIEF_EM_EXCESS = 111, /**< eXcess: 16/32/64-bit configurable embedded CPU */
     144 + LIEF_EM_DXP = 112, /**< Icera Semiconductor Inc. Deep Execution Processor */
     145 + LIEF_EM_ALTERA_NIOS2 = 113, /**< Altera Nios II soft-core processor */
     146 + LIEF_EM_CRX = 114, /**< National Semiconductor CompactRISC CRX */
     147 + LIEF_EM_XGATE = 115, /**< Motorola XGATE embedded processor */
     148 + LIEF_EM_C166 = 116, /**< Infineon C16x/XC16x processor */
     149 + LIEF_EM_M16C = 117, /**< Renesas M16C series microprocessors */
     150 + LIEF_EM_DSPIC30F = 118, /**< Microchip Technology dsPIC30F Digital Signal */
     151 + /* Controller */
     152 + LIEF_EM_CE = 119, /**< Freescale Communication Engine RISC core */
     153 + LIEF_EM_M32C = 120, /**< Renesas M32C series microprocessors */
     154 + LIEF_EM_TSK3000 = 131, /**< Altium TSK3000 core */
     155 + LIEF_EM_RS08 = 132, /**< Freescale RS08 embedded processor */
     156 + LIEF_EM_SHARC = 133, /**< Analog Devices SHARC family of 32-bit DSP */
     157 + /* processors */
     158 + LIEF_EM_ECOG2 = 134, /**< Cyan Technology eCOG2 microprocessor */
     159 + LIEF_EM_SCORE7 = 135, /**< Sunplus S+core7 RISC processor */
     160 + LIEF_EM_DSP24 = 136, /**< New Japan Radio (NJR 24-bit DSP Processor */
     161 + LIEF_EM_VIDEOCORE3 = 137, /**< Broadcom VideoCore III processor */
     162 + LIEF_EM_LATTICEMICO32 = 138, /**< RISC processor for Lattice FPGA architecture */
     163 + LIEF_EM_SE_C17 = 139, /**< Seiko Epson C17 family */
     164 + LIEF_EM_TI_C6000 = 140, /**< The Texas Instruments TMS320C6000 DSP family */
     165 + LIEF_EM_TI_C2000 = 141, /**< The Texas Instruments TMS320C2000 DSP family */
     166 + LIEF_EM_TI_C5500 = 142, /**< The Texas Instruments TMS320C55x DSP family */
     167 + LIEF_EM_MMDSP_PLUS = 160, /**< STMicroelectronics 64bit VLIW Data Signal Processor */
     168 + LIEF_EM_CYPRESS_M8C = 161, /**< Cypress M8C microprocessor */
     169 + LIEF_EM_R32C = 162, /**< Renesas R32C series microprocessors */
     170 + LIEF_EM_TRIMEDIA = 163, /**< NXP Semiconductors TriMedia architecture family */
     171 + LIEF_EM_HEXAGON = 164, /**< Qualcomm Hexagon processor */
     172 + LIEF_EM_8051 = 165, /**< Intel 8051 and variants */
     173 + LIEF_EM_STXP7X = 166, /**< STMicroelectronics STxP7x family of configurable */
     174 + /* and extensible RISC processors */
     175 + LIEF_EM_NDS32 = 167, /* Andes Technology compact code size embedded RISC */
     176 + /* processor family */
     177 + LIEF_EM_ECOG1 = 168, /**< Cyan Technology eCOG1X family */
     178 + LIEF_EM_ECOG1X = 168, /**< Cyan Technology eCOG1X family */
     179 + LIEF_EM_MAXQ30 = 169, /**< Dallas Semiconductor MAXQ30 Core Micro-controllers */
     180 + LIEF_EM_XIMO16 = 170, /**< New Japan Radio (NJR 16-bit DSP Processor */
     181 + LIEF_EM_MANIK = 171, /**< M2000 Reconfigurable RISC Microprocessor */
     182 + LIEF_EM_CRAYNV2 = 172, /**< Cray Inc. NV2 vector architecture */
     183 + LIEF_EM_RX = 173, /**< Renesas RX family */
     184 + LIEF_EM_METAG = 174, /**< Imagination Technologies META processor */
     185 + /* architecture */
     186 + LIEF_EM_MCST_ELBRUS = 175, /**< MCST Elbrus general purpose hardware architecture */
     187 + LIEF_EM_ECOG16 = 176, /**< Cyan Technology eCOG16 family */
     188 + LIEF_EM_CR16 = 177, /**< National Semiconductor CompactRISC CR16 16-bit */
     189 + /* microprocessor */
     190 + LIEF_EM_ETPU = 178, /**< Freescale Extended Time Processing Unit */
     191 + LIEF_EM_SLE9X = 179, /**< Infineon Technologies SLE9X core */
     192 + LIEF_EM_L10M = 180, /**< Intel L10M */
     193 + LIEF_EM_K10M = 181, /**< Intel K10M */
     194 + LIEF_EM_AARCH64 = 183, /**< ARM AArch64 */
     195 + LIEF_EM_AVR32 = 185, /**< Atmel Corporation 32-bit microprocessor family */
     196 + LIEF_EM_STM8 = 186, /**< STMicroeletronics STM8 8-bit microcontroller */
     197 + LIEF_EM_TILE64 = 187, /**< Tilera TILE64 multicore architecture family */
     198 + LIEF_EM_TILEPRO = 188, /**< Tilera TILEPro multicore architecture family */
     199 + LIEF_EM_CUDA = 190, /**< NVIDIA CUDA architecture */
     200 + LIEF_EM_TILEGX = 191, /**< Tilera TILE-Gx multicore architecture family */
     201 + LIEF_EM_CLOUDSHIELD = 192, /**< CloudShield architecture family */
     202 + LIEF_EM_COREA_1ST = 193, /**< KIPO-KAIST Core-A 1st generation processor family */
     203 + LIEF_EM_COREA_2ND = 194, /**< KIPO-KAIST Core-A 2nd generation processor family */
     204 + LIEF_EM_ARC_COMPACT2 = 195, /**< Synopsys ARCompact V2 */
     205 + LIEF_EM_OPEN8 = 196, /**< Open8 8-bit RISC soft processor core */
     206 + LIEF_EM_RL78 = 197, /**< Renesas RL78 family */
     207 + LIEF_EM_VIDEOCORE5 = 198, /**< Broadcom VideoCore V processor */
     208 + LIEF_EM_78KOR = 199, /**< Renesas 78KOR family */
     209 + LIEF_EM_56800EX = 200, /**< Freescale 56800EX Digital Signal Controller (DSC */
     210 + LIEF_EM_BA1 = 201, /**< Beyond BA1 CPU architecture */
     211 + LIEF_EM_BA2 = 202, /**< Beyond BA2 CPU architecture */
     212 + LIEF_EM_XCORE = 203, /**< XMOS xCORE processor family */
     213 + LIEF_EM_MCHP_PIC = 204, /**< Microchip 8-bit PIC(r family */
     214 + LIEF_EM_INTEL205 = 205, /**< Reserved by Intel */
     215 + LIEF_EM_INTEL206 = 206, /**< Reserved by Intel */
     216 + LIEF_EM_INTEL207 = 207, /**< Reserved by Intel */
     217 + LIEF_EM_INTEL208 = 208, /**< Reserved by Intel */
     218 + LIEF_EM_INTEL209 = 209, /**< Reserved by Intel */
     219 + LIEF_EM_KM32 = 210, /**< KM211 KM32 32-bit processor */
     220 + LIEF_EM_KMX32 = 211, /**< KM211 KMX32 32-bit processor */
     221 + LIEF_EM_KMX16 = 212, /**< KM211 KMX16 16-bit processor */
     222 + LIEF_EM_KMX8 = 213, /**< KM211 KMX8 8-bit processor */
     223 + LIEF_EM_KVARC = 214, /**< KM211 KVARC processor */
     224 + LIEF_EM_CDP = 215, /**< Paneve CDP architecture family */
     225 + LIEF_EM_COGE = 216, /**< Cognitive Smart Memory Processor */
     226 + LIEF_EM_COOL = 217, /**< iCelero CoolEngine */
     227 + LIEF_EM_NORC = 218, /**< Nanoradio Optimized RISC */
     228 + LIEF_EM_CSR_KALIMBA = 219, /**< CSR Kalimba architecture family */
     229 + LIEF_EM_AMDGPU = 224, /**< AMD GPU architecture */
     230 + LIEF_EM_RISCV = 243, /**< RISC-V */
     231 + LIEF_EM_BPF = 247, /**< eBPF Filter */
     232 + LIEF_EM_LOONGARCH = 258 /**< LoongArch */
     233 +};
     234 + 
     235 + 
     236 +/** Object file classes. */
     237 +enum LIEF_ELF_CLASS {
     238 + LIEF_ELFCLASSNONE = 0, /**< Unknown */
     239 + LIEF_ELFCLASS32 = 1, /**< 32-bit object file */
     240 + LIEF_ELFCLASS64 = 2 /**< 64-bit object file */
     241 +};
     242 + 
     243 +/** Object file byte orderings. */
     244 +enum LIEF_ELF_DATA {
     245 + LIEF_ELFDATANONE = 0, /**< Invalid data encoding. */
     246 + LIEF_ELFDATA2LSB = 1, /**< Little-endian object file */
     247 + LIEF_ELFDATA2MSB = 2 /**< Big-endian object file */
     248 +};
     249 + 
     250 +/** OS ABI identification. */
     251 +enum LIEF_OS_ABI {
     252 + LIEF_OSABI_SYSTEMV = 0, /**< UNIX System V ABI */
     253 + LIEF_OSABI_HPUX = 1, /**< HP-UX operating system */
     254 + LIEF_OSABI_NETBSD = 2, /**< NetBSD */
     255 + LIEF_OSABI_GNU = 3, /**< GNU/Linux */
     256 + LIEF_OSABI_LINUX = 3, /**< Historical alias for ELFOSABI_GNU. */
     257 + LIEF_OSABI_HURD = 4, /**< GNU/Hurd */
     258 + LIEF_OSABI_SOLARIS = 6, /**< Solaris */
     259 + LIEF_OSABI_AIX = 7, /**< AIX */
     260 + LIEF_OSABI_IRIX = 8, /**< IRIX */
     261 + LIEF_OSABI_FREEBSD = 9, /**< FreeBSD */
     262 + LIEF_OSABI_TRU64 = 10, /**< TRU64 UNIX */
     263 + LIEF_OSABI_MODESTO = 11, /**< Novell Modesto */
     264 + LIEF_OSABI_OPENBSD = 12, /**< OpenBSD */
     265 + LIEF_OSABI_OPENVMS = 13, /**< OpenVMS */
     266 + LIEF_OSABI_NSK = 14, /**< Hewlett-Packard Non-Stop Kernel */
     267 + LIEF_OSABI_AROS = 15, /**< AROS */
     268 + LIEF_OSABI_FENIXOS = 16, /**< FenixOS */
     269 + LIEF_OSABI_CLOUDABI = 17, /**< Nuxi CloudABI */
     270 + LIEF_OSABI_C6000_ELFABI = 64, /**< Bare-metal TMS320C6000 */
     271 + LIEF_OSABI_AMDGPU_HSA = 64, /**< AMD HSA runtime */
     272 + LIEF_OSABI_C6000_LINUX = 65, /**< Linux TMS320C6000 */
     273 + LIEF_OSABI_ARM = 97, /**< ARM */
     274 + LIEF_OSABI_STANDALONE = 255 /**< Standalone (embedded application */
     275 +};
     276 + 
     277 +/* ELF Relocations */
     278 + 
     279 +#define ELF_RELOC(name, value) name = value,
     280 + 
     281 +/** x86_64 relocations. */
     282 +enum LIEF_RELOC_x86_64 {
     283 + #include "LIEF/ELF/Relocations/x86_64.def"
     284 +};
     285 + 
     286 +/** i386 relocations. */
     287 +enum RELOC_i386 {
     288 + #include "LIEF/ELF/Relocations/i386.def"
     289 +};
     290 + 
     291 +/* ELF Relocation types for PPC32 */
     292 +enum LIEF_RELOC_POWERPC32 {
     293 + #include "LIEF/ELF/Relocations/PowerPC.def"
     294 +};
     295 + 
     296 +/* ELF Relocation types for PPC64 */
     297 +enum LIEF_RELOC_POWERPC64 {
     298 + #include "LIEF/ELF/Relocations/PowerPC64.def"
     299 +};
     300 + 
     301 +/* ELF Relocation types for AArch64 */
     302 +enum LIEF_RELOC_AARCH64 {
     303 + #include "LIEF/ELF/Relocations/AArch64.def"
     304 +};
     305 + 
     306 +/* ELF Relocation types for ARM */
     307 +enum LIEF_RELOC_ARM {
     308 + #include "LIEF/ELF/Relocations/ARM.def"
     309 +};
     310 + 
     311 +/* ELF Relocation types for Mips */
     312 +enum LIEF_RELOC_MIPS {
     313 + #include "LIEF/ELF/Relocations/Mips.def"
     314 +};
     315 + 
     316 +/* ELF Relocation types for Hexagon */
     317 +enum LIEF_RELOC_HEXAGON {
     318 + #include "LIEF/ELF/Relocations/Hexagon.def"
     319 +};
     320 + 
     321 +/* ELF Relocation types for S390/zSeries */
     322 +enum LIEF_RELOC_SYSTEMZ {
     323 + #include "LIEF/ELF/Relocations/SystemZ.def"
     324 +};
     325 + 
     326 +/* ELF Relocation type for Sparc. */
     327 +enum LIEF_RELOC_SPARC {
     328 + #include "LIEF/ELF/Relocations/Sparc.def"
     329 +};
     330 + 
     331 +/* ELF Relocation types for LoongArch. */
     332 +enum LIEF_RELOC_LOONGARCH {
     333 + #include "LIEF/ELF/Relocations/LoongArch.def"
     334 +};
     335 + 
     336 +#undef ELF_RELOC
     337 + 
     338 +/* Specific e_flags for PPC64 */
     339 +enum LIEF_PPC64_EFLAGS {
     340 + /* e_flags bits specifying ABI: */
     341 + /* 1 for original ABI using function descriptors, */
     342 + /* 2 for revised ABI without function descriptors, */
     343 + /* 0 for unspecified or not using any features affected by the differences. */
     344 + LIEF_EF_PPC64_ABI = 3
     345 +};
     346 + 
     347 +/* ARM Specific e_flags */
     348 +enum LIEF_ARM_EFLAGS {
     349 + LIEF_EF_ARM_SOFT_FLOAT = 0x00000200U,
     350 + LIEF_EF_ARM_VFP_FLOAT = 0x00000400U,
     351 + LIEF_EF_ARM_EABI_UNKNOWN = 0x00000000U,
     352 + LIEF_EF_ARM_EABI_VER1 = 0x01000000U,
     353 + LIEF_EF_ARM_EABI_VER2 = 0x02000000U,
     354 + LIEF_EF_ARM_EABI_VER3 = 0x03000000U,
     355 + LIEF_EF_ARM_EABI_VER4 = 0x04000000U,
     356 + LIEF_EF_ARM_EABI_VER5 = 0x05000000U,
     357 + LIEF_EF_ARM_EABIMASK = 0xFF000000U
     358 +};
     359 + 
     360 +/* Mips Specific e_flags */
     361 +enum LIEF_MIPS_EFLAGS {
     362 + LIEF_EF_MIPS_NOREORDER = 0x00000001, /* Don't reorder instructions */
     363 + LIEF_EF_MIPS_PIC = 0x00000002, /* Position independent code */
     364 + LIEF_EF_MIPS_CPIC = 0x00000004, /* Call object with Position independent code */
     365 + LIEF_EF_MIPS_ABI2 = 0x00000020, /* File uses N32 ABI */
     366 + LIEF_EF_MIPS_32BITMODE = 0x00000100, /* Code compiled for a 64-bit machine */
     367 + /* in 32-bit mode */
     368 + LIEF_EF_MIPS_FP64 = 0x00000200, /* Code compiled for a 32-bit machine */
     369 + /* but uses 64-bit FP registers */
     370 + LIEF_EF_MIPS_NAN2008 = 0x00000400, /* Uses IEE 754-2008 NaN encoding */
     371 + 
     372 + /* ABI flags */
     373 + LIEF_EF_MIPS_ABI_O32 = 0x00001000, /* This file follows the first MIPS 32 bit ABI */
     374 + LIEF_EF_MIPS_ABI_O64 = 0x00002000, /* O32 ABI extended for 64-bit architecture. */
     375 + LIEF_EF_MIPS_ABI_EABI32 = 0x00003000, /* EABI in 32 bit mode. */
     376 + LIEF_EF_MIPS_ABI_EABI64 = 0x00004000, /* EABI in 64 bit mode. */
     377 + LIEF_EF_MIPS_ABI = 0x0000f000, /* Mask for selecting EF_MIPS_ABI_ variant. */
     378 + 
     379 + /* MIPS machine variant */
     380 + LIEF_EF_MIPS_MACH_3900 = 0x00810000, /* Toshiba R3900 */
     381 + LIEF_EF_MIPS_MACH_4010 = 0x00820000, /* LSI R4010 */
     382 + LIEF_EF_MIPS_MACH_4100 = 0x00830000, /* NEC VR4100 */
     383 + LIEF_EF_MIPS_MACH_4650 = 0x00850000, /* MIPS R4650 */
     384 + LIEF_EF_MIPS_MACH_4120 = 0x00870000, /* NEC VR4120 */
     385 + LIEF_EF_MIPS_MACH_4111 = 0x00880000, /* NEC VR4111/VR4181 */
     386 + LIEF_EF_MIPS_MACH_SB1 = 0x008a0000, /* Broadcom SB-1 */
     387 + LIEF_EF_MIPS_MACH_OCTEON = 0x008b0000, /* Cavium Networks Octeon */
     388 + LIEF_EF_MIPS_MACH_XLR = 0x008c0000, /* RMI Xlr */
     389 + LIEF_EF_MIPS_MACH_OCTEON2 = 0x008d0000, /* Cavium Networks Octeon2 */
     390 + LIEF_EF_MIPS_MACH_OCTEON3 = 0x008e0000, /* Cavium Networks Octeon3 */
     391 + LIEF_EF_MIPS_MACH_5400 = 0x00910000, /* NEC VR5400 */
     392 + LIEF_EF_MIPS_MACH_5900 = 0x00920000, /* MIPS R5900 */
     393 + LIEF_EF_MIPS_MACH_5500 = 0x00980000, /* NEC VR5500 */
     394 + LIEF_EF_MIPS_MACH_9000 = 0x00990000, /* Unknown */
     395 + LIEF_EF_MIPS_MACH_LS2E = 0x00a00000, /* ST Microelectronics Loongson 2E */
     396 + LIEF_EF_MIPS_MACH_LS2F = 0x00a10000, /* ST Microelectronics Loongson 2F */
     397 + LIEF_EF_MIPS_MACH_LS3A = 0x00a20000, /* Loongson 3A */
     398 + LIEF_EF_MIPS_MACH = 0x00ff0000, /* EF_MIPS_MACH_xxx selection mask */
     399 + 
     400 + /* ARCH_ASE */
     401 + LIEF_EF_MIPS_MICROMIPS = 0x02000000, /* microMIPS */
     402 + LIEF_EF_MIPS_ARCH_ASE_M16 = 0x04000000, /* Has Mips-16 ISA extensions */
     403 + LIEF_EF_MIPS_ARCH_ASE_MDMX = 0x08000000, /* Has MDMX multimedia extensions */
     404 + LIEF_EF_MIPS_ARCH_ASE = 0x0f000000, /* Mask for EF_MIPS_ARCH_ASE_xxx flags */
     405 + 
     406 + /* ARCH */
     407 + LIEF_EF_MIPS_ARCH_1 = 0x00000000, /* MIPS1 instruction set */
     408 + LIEF_EF_MIPS_ARCH_2 = 0x10000000, /* MIPS2 instruction set */
     409 + LIEF_EF_MIPS_ARCH_3 = 0x20000000, /* MIPS3 instruction set */
     410 + LIEF_EF_MIPS_ARCH_4 = 0x30000000, /* MIPS4 instruction set */
     411 + LIEF_EF_MIPS_ARCH_5 = 0x40000000, /* MIPS5 instruction set */
     412 + LIEF_EF_MIPS_ARCH_32 = 0x50000000, /* MIPS32 instruction set per linux not elf.h */
     413 + LIEF_EF_MIPS_ARCH_64 = 0x60000000, /* MIPS64 instruction set per linux not elf.h */
     414 + LIEF_EF_MIPS_ARCH_32R2 = 0x70000000, /* mips32r2, mips32r3, mips32r5 */
     415 + LIEF_EF_MIPS_ARCH_64R2 = 0x80000000, /* mips64r2, mips64r3, mips64r5 */
     416 + LIEF_EF_MIPS_ARCH_32R6 = 0x90000000, /* mips32r6 */
     417 + LIEF_EF_MIPS_ARCH_64R6 = 0xa0000000, /* mips64r6 */
     418 + LIEF_EF_MIPS_ARCH = 0xf0000000 /* Mask for applying EF_MIPS_ARCH_ variant */
     419 +};
     420 + 
     421 +/* Hexagon Specific e_flags */
     422 +/* Release 5 ABI */
     423 +enum LIEF_HEXAGON_EFLAGS {
     424 + /* Object processor version flags, bits[3:0] */
     425 + LIEF_EF_HEXAGON_MACH_V2 = 0x00000001, /* Hexagon V2 */
     426 + LIEF_EF_HEXAGON_MACH_V3 = 0x00000002, /* Hexagon V3 */
     427 + LIEF_EF_HEXAGON_MACH_V4 = 0x00000003, /* Hexagon V4 */
     428 + LIEF_EF_HEXAGON_MACH_V5 = 0x00000004, /* Hexagon V5 */
     429 + 
     430 + /* Highest ISA version flags */
     431 + LIEF_EF_HEXAGON_ISA_MACH = 0x00000000, /* Same as specified in bits[3:0] */
     432 + /* of e_flags */
     433 + LIEF_EF_HEXAGON_ISA_V2 = 0x00000010, /* Hexagon V2 ISA */
     434 + LIEF_EF_HEXAGON_ISA_V3 = 0x00000020, /* Hexagon V3 ISA */
     435 + LIEF_EF_HEXAGON_ISA_V4 = 0x00000030, /* Hexagon V4 ISA */
     436 + LIEF_EF_HEXAGON_ISA_V5 = 0x00000040 /* Hexagon V5 ISA */
     437 +};
     438 + 
     439 + 
     440 +/* LoongArch Specific e_flags */
     441 +enum LIEF_LOONGARCH_EFLAGS {
     442 + LIEF_EF_LOONGARCH_ABI_SOFT_FLOAT = 0x1,
     443 + LIEF_EF_LOONGARCH_ABI_SINGLE_FLOAT = 0x2,
     444 + LIEF_EF_LOONGARCH_ABI_DOUBLE_FLOAT = 0x3
     445 +};
     446 + 
     447 +/** Special section indices. */
     448 +enum LIEF_SYMBOL_SECTION_INDEX {
     449 + LIEF_SHN_UNDEF = 0, /**< Undefined, missing, irrelevant, or meaningless */
     450 + LIEF_SHN_LORESERVE = 0xff00, /**< Lowest reserved index */
     451 + LIEF_SHN_LOPROC = 0xff00, /**< Lowest processor-specific index */
     452 + LIEF_SHN_HIPROC = 0xff1f, /**< Highest processor-specific index */
     453 + LIEF_SHN_LOOS = 0xff20, /**< Lowest operating system-specific index */
     454 + LIEF_SHN_HIOS = 0xff3f, /**< Highest operating system-specific index */
     455 + LIEF_SHN_ABS = 0xfff1, /**< Symbol has absolute value; does not need relocation */
     456 + LIEF_SHN_COMMON = 0xfff2, /**< FORTRAN COMMON or C external global variables */
     457 + LIEF_SHN_XINDEX = 0xffff, /**< Mark that the index is >= SHN_LORESERVE */
     458 + LIEF_SHN_HIRESERVE = 0xffff /**< Highest reserved index */
     459 +};
     460 + 
     461 +/** Section types. */
     462 +enum LIEF_ELF_SECTION_TYPES {
     463 + LIEF_SHT_NULL = 0, /**< No associated section (inactive entry. */
     464 + LIEF_SHT_PROGBITS = 1, /**< Program-defined contents. */
     465 + LIEF_SHT_SYMTAB = 2, /**< Symbol table. */
     466 + LIEF_SHT_STRTAB = 3, /**< String table. */
     467 + LIEF_SHT_RELA = 4, /**< Relocation entries; explicit addends. */
     468 + LIEF_SHT_HASH = 5, /**< Symbol hash table. */
     469 + LIEF_SHT_DYNAMIC = 6, /**< Information for dynamic linking. */
     470 + LIEF_SHT_NOTE = 7, /**< Information about the file. */
     471 + LIEF_SHT_NOBITS = 8, /**< Data occupies no space in the file. */
     472 + LIEF_SHT_REL = 9, /**< Relocation entries; no explicit addends. */
     473 + LIEF_SHT_SHLIB = 10, /**< Reserved. */
     474 + LIEF_SHT_DYNSYM = 11, /**< Symbol table. */
     475 + LIEF_SHT_INIT_ARRAY = 14, /**< Pointers to initialization functions. */
     476 + LIEF_SHT_FINI_ARRAY = 15, /**< Pointers to termination functions. */
     477 + LIEF_SHT_PREINIT_ARRAY = 16, /**< Pointers to pre-init functions. */
     478 + LIEF_SHT_GROUP = 17, /**< Section group. */
     479 + LIEF_SHT_SYMTAB_SHNDX = 18, /**< Indices for SHN_XINDEX entries. */
     480 + LIEF_SHT_LOOS = 0x60000000, /**< Lowest operating system-specific type. */
     481 + LIEF_SHT_ANDROID_REL = 0x60000001, /**< Packed relocations (Android specific. */
     482 + LIEF_SHT_ANDROID_RELA = 0x60000002, /**< Packed relocations (Android specific. */
     483 + LIEF_SHT_LLVM_ADDRSIG = 0x6fff4c03, /**< This section is used to mark symbols as address-significant. */
     484 + LIEF_SHT_RELR = 0x6fffff00, /**< New relr relocations (Android specific. */
     485 + LIEF_SHT_GNU_ATTRIBUTES = 0x6ffffff5, /**< Object attributes. */
     486 + LIEF_SHT_GNU_HASH = 0x6ffffff6, /**< GNU-style hash table. */
     487 + LIEF_SHT_GNU_verdef = 0x6ffffffd, /**< GNU version definitions. */
     488 + LIEF_SHT_GNU_verneed = 0x6ffffffe, /**< GNU version references. */
     489 + LIEF_SHT_GNU_versym = 0x6fffffff, /**< GNU symbol versions table. */
     490 + LIEF_SHT_HIOS = 0x6fffffff, /**< Highest operating system-specific type. */
     491 + LIEF_SHT_LOPROC = 0x70000000, /**< Lowest processor arch-specific type. */
     492 + LIEF_SHT_ARM_EXIDX = 0x70000001U, /**< Exception Index table */
     493 + LIEF_SHT_ARM_PREEMPTMAP = 0x70000002U, /**< BPABI DLL dynamic linking pre-emption map */
     494 + LIEF_SHT_ARM_ATTRIBUTES = 0x70000003U, /**< Object file compatibility attributes */
     495 + LIEF_SHT_ARM_DEBUGOVERLAY = 0x70000004U,
     496 + LIEF_SHT_ARM_OVERLAYSECTION = 0x70000005U,
     497 + LIEF_SHT_HEX_ORDERED = 0x70000000, /**< Link editor is to sort the entries in */
     498 + 
     499 + /* this section based on their sizes */
     500 + LIEF_SHT_X86_64_UNWIND = 0x70000001, /**< Unwind information */
     501 + LIEF_SHT_MIPS_REGINFO = 0x70000006, /**< Register usage information */
     502 + LIEF_SHT_MIPS_OPTIONS = 0x7000000d, /**< General options */
     503 + LIEF_SHT_MIPS_ABIFLAGS = 0x7000002a, /**< ABI information. */
     504 + 
     505 + LIEF_SHT_HIPROC = 0x7fffffff, /**< Highest processor arch-specific type. */
     506 + LIEF_SHT_LOUSER = 0x80000000, /**< Lowest type reserved for applications. */
     507 + LIEF_SHT_HIUSER = 0xffffffff /**< Highest type reserved for applications. */
     508 +};
     509 + 
     510 + 
     511 + 
     512 +/** Section flags. */
     513 +enum LIEF_ELF_SECTION_FLAGS {
     514 + LIEF_SHF_NONE = 0x0,
     515 + LIEF_SHF_WRITE = 0x1, /**< Section data should be writable during execution. */
     516 + LIEF_SHF_ALLOC = 0x2, /**< Section occupies memory during program execution. */
     517 + LIEF_SHF_EXECINSTR = 0x4, /**< Section contains executable machine instructions. */
     518 + LIEF_SHF_MERGE = 0x10, /**< The data in this section may be merged. */
     519 + LIEF_SHF_STRINGS = 0x20, /**< The data in this section is null-terminated strings. */
     520 + LIEF_SHF_INFO_LINK = 0x40U, /**< A field in this section holds a section header table index. */
     521 + LIEF_SHF_LINK_ORDER = 0x80U, /**< Adds special ordering requirements for link editors. */
     522 + LIEF_SHF_OS_NONCONFORMING = 0x100U, /**< This section requires special OS-specific processing to avoid incorrect behavior */
     523 + LIEF_SHF_GROUP = 0x200U, /**< This section is a member of a section group. */
     524 + LIEF_SHF_TLS = 0x400U, /**< This section holds Thread-Local Storage. */
     525 + LIEF_SHF_EXCLUDE = 0x80000000U, /**< This section is excluded from the final executable or shared library. */
     526 + /* Start of target-specific flags. */
     527 + 
     528 + /* XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
     529 + * together by the linker to form the constant pool and the cp register is
     530 + * set to the start of the constant pool by the boot code.
     531 + */
     532 + LIEF_XCORE_SHF_CP_SECTION = 0x800U,
     533 + 
     534 + /* XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
     535 + * together by the linker to form the data section and the dp register is
     536 + * set to the start of the section by the boot code.
     537 + */
     538 + LIEF_XCORE_SHF_DP_SECTION = 0x1000U,
     539 + LIEF_SHF_MASKOS = 0x0ff00000,
     540 + LIEF_SHF_MASKPROC = 0xf0000000, /**< Bits indicating processor-specific flags. */
     541 + 
     542 + /* If an object file section does not have this flag set, then it may not hold
     543 + * more than 2GB and can be freely referred to in objects using smaller code
     544 + * models. Otherwise, only objects using larger code models can refer to them.
     545 + * For example, a medium code model object can refer to data in a section that
     546 + * sets this flag besides being able to refer to data in a section that does
     547 + * not set it; likewise, a small code model object can refer only to code in a
     548 + * section that does not set this flag.
     549 + */
     550 + LIEF_SHF_X86_64_LARGE = 0x10000000,
     551 + 
     552 + /* All sections with the GPREL flag are grouped into a global data area
     553 + * for faster accesses.
     554 + */
     555 + LIEF_SHF_HEX_GPREL = 0x10000000,
     556 + 
     557 + /* Section contains text/data which may be replicated in other sections.
     558 + * Linker must retain only one copy.
     559 + */
     560 + LIEF_SHF_MIPS_NODUPES = 0x01000000,
     561 + 
     562 + LIEF_SHF_MIPS_NAMES = 0x02000000, /**< Linker must generate implicit hidden weak names. */
     563 + LIEF_SHF_MIPS_LOCAL = 0x04000000, /**< Section data local to process. */
     564 + LIEF_SHF_MIPS_NOSTRIP = 0x08000000, /**< Do not strip this section. */
     565 + LIEF_SHF_MIPS_GPREL = 0x10000000, /**< Section must be part of global data area. */
     566 + LIEF_SHF_MIPS_MERGE = 0x20000000, /**< This section should be merged. */
     567 + LIEF_SHF_MIPS_ADDR = 0x40000000, /**< Address size to be inferred from section entry size. */
     568 + LIEF_SHF_MIPS_STRING = 0x80000000 /**< Section data is string data by default. */
     569 +};
     570 + 
     571 + 
     572 +/** Symbol bindings. */
     573 +enum LIEF_SYMBOL_BINDINGS {
     574 + LIEF_STB_LOCAL = 0, /**< Local symbol, not visible outside obj file containing def */
     575 + LIEF_STB_GLOBAL = 1, /**< Global symbol, visible to all object files being combined */
     576 + LIEF_STB_WEAK = 2, /**< Weak symbol, like global but lower-precedence */
     577 + LIEF_STB_GNU_UNIQUE = 10,
     578 + LIEF_STB_LOOS = 10, /**< Lowest operating system-specific binding type */
     579 + LIEF_STB_HIOS = 12, /**< Highest operating system-specific binding type */
     580 + LIEF_STB_LOPROC = 13, /**< Lowest processor-specific binding type */
     581 + LIEF_STB_HIPROC = 15 /**< Highest processor-specific binding type */
     582 +};
     583 + 
     584 + 
     585 +/* Symbol types. */
     586 +enum LIEF_ELF_SYMBOL_TYPES {
     587 + LIEF_STT_NOTYPE = 0, /* Symbol's type is not specified */
     588 + LIEF_STT_OBJECT = 1, /* Symbol is a data object (variable, array, etc. */
     589 + LIEF_STT_FUNC = 2, /* Symbol is executable code (function, etc. */
     590 + LIEF_STT_SECTION = 3, /* Symbol refers to a section */
     591 + LIEF_STT_FILE = 4, /* Local, absolute symbol that refers to a file */
     592 + LIEF_STT_COMMON = 5, /* An uninitialized common block */
     593 + LIEF_STT_TLS = 6, /* Thread local data object */
     594 + LIEF_STT_GNU_IFUNC = 10, /* GNU indirect function */
     595 + LIEF_STT_LOOS = 10, /* Lowest operating system-specific symbol type */
     596 + LIEF_STT_HIOS = 12, /* Highest operating system-specific symbol type */
     597 + LIEF_STT_LOPROC = 13, /* Lowest processor-specific symbol type */
     598 + LIEF_STT_HIPROC = 15 /* Highest processor-specific symbol type */
     599 +};
     600 + 
     601 +enum LIEF_ELF_SYMBOL_VISIBILITY {
     602 + LIEF_STV_DEFAULT = 0, /* Visibility is specified by binding type */
     603 + LIEF_STV_INTERNAL = 1, /* Defined by processor supplements */
     604 + LIEF_STV_HIDDEN = 2, /* Not visible to other components */
     605 + LIEF_STV_PROTECTED = 3 /* Visible in other components but not preemptable */
     606 +};
     607 + 
     608 + 
     609 +/** @brief Segment types. */
     610 +enum LIEF_SEGMENT_TYPES {
     611 + LIEF_PT_NULL = 0, /**< Unused segment. */
     612 + LIEF_PT_LOAD = 1, /**< Loadable segment. */
     613 + LIEF_PT_DYNAMIC = 2, /**< Dynamic linking information. */
     614 + LIEF_PT_INTERP = 3, /**< Interpreter pathname. */
     615 + LIEF_PT_NOTE = 4, /**< Auxiliary information. */
     616 + LIEF_PT_SHLIB = 5, /**< Reserved. */
     617 + LIEF_PT_PHDR = 6, /**< The program header table itself. */
     618 + LIEF_PT_TLS = 7, /**< The thread-local storage template. */
     619 + LIEF_PT_LOOS = 0x60000000, /**< Lowest operating system-specific pt entry type. */
     620 + LIEF_PT_HIOS = 0x6fffffff, /**< Highest operating system-specific pt entry type. */
     621 + LIEF_PT_LOPROC = 0x70000000, /**< Lowest processor-specific program hdr entry type. */
     622 + LIEF_PT_HIPROC = 0x7fffffff, /**< Highest processor-specific program hdr entry type. */
     623 + 
     624 + /* x86-64 program header types. */
     625 + /* These all contain stack unwind tables. */
     626 + LIEF_PT_GNU_EH_FRAME = 0x6474e550,
     627 + LIEF_PT_SUNW_EH_FRAME = 0x6474e550,
     628 + LIEF_PT_SUNW_UNWIND = 0x6464e550,
     629 + 
     630 + LIEF_PT_GNU_STACK = 0x6474e551, /**< Indicates stack executability. */
     631 + LIEF_PT_GNU_PROPERTY = 0x6474e553, /**< GNU property */
     632 + LIEF_PT_GNU_RELRO = 0x6474e552, /**< Read-only after relocation. */
     633 + 
     634 + /* ARM program header types. */
     635 + LIEF_PT_ARM_ARCHEXT = 0x70000000, /**< Platform architecture compatibility info */
     636 + 
     637 + /* These all contain stack unwind tables. */
     638 + LIEF_PT_ARM_EXIDX = 0x70000001,
     639 + LIEF_PT_ARM_UNWIND = 0x70000001,
     640 + 
     641 + /* MIPS program header types. */
     642 + LIEF_PT_MIPS_REGINFO = 0x70000000, /**< Register usage information. */
     643 + LIEF_PT_MIPS_RTPROC = 0x70000001, /**< Runtime procedure table. */
     644 + LIEF_PT_MIPS_OPTIONS = 0x70000002, /**< Options segment. */
     645 + LIEF_PT_MIPS_ABIFLAGS = 0x70000003 /**< Abiflags segment. */
     646 +};
     647 + 
     648 + 
     649 +/** Segment flags. */
     650 +enum LIEF_ELF_SEGMENT_FLAGS {
     651 + LIEF_PF_NONE = 0,
     652 + LIEF_PF_X = 1, /**< Execute */
     653 + LIEF_PF_W = 2, /**< Write */
     654 + LIEF_PF_R = 4, /**< Read */
     655 + LIEF_PF_MASKOS = 0x0ff00000,/**< Bits for operating system-specific semantics. */
     656 + LIEF_PF_MASKPROC = 0xf0000000 /**< Bits for processor-specific semantics. */
     657 +};
     658 + 
     659 + 
     660 +/** Dynamic table entry tags. */
     661 +enum LIEF_DYNAMIC_TAGS {
     662 + LIEF_DT_NULL = 0, /**< Marks end of dynamic array. */
     663 + LIEF_DT_NEEDED = 1, /**< String table offset of needed library. */
     664 + LIEF_DT_PLTRELSZ = 2, /**< Size of relocation entries in PLT. */
     665 + LIEF_DT_PLTGOT = 3, /**< Address associated with linkage table. */
     666 + LIEF_DT_HASH = 4, /**< Address of symbolic hash table. */
     667 + LIEF_DT_STRTAB = 5, /**< Address of dynamic string table. */
     668 + LIEF_DT_SYMTAB = 6, /**< Address of dynamic symbol table. */
     669 + LIEF_DT_RELA = 7, /**< Address of relocation table (Rela entries. */
     670 + LIEF_DT_RELASZ = 8, /**< Size of Rela relocation table. */
     671 + LIEF_DT_RELAENT = 9, /**< Size of a Rela relocation entry. */
     672 + LIEF_DT_STRSZ = 10, /**< Total size of the string table. */
     673 + LIEF_DT_SYMENT = 11, /**< Size of a symbol table entry. */
     674 + LIEF_DT_INIT = 12, /**< Address of initialization function. */
     675 + LIEF_DT_FINI = 13, /**< Address of termination function. */
     676 + LIEF_DT_SONAME = 14, /**< String table offset of a shared objects name. */
     677 + LIEF_DT_RPATH = 15, /**< String table offset of library search path. */
     678 + LIEF_DT_SYMBOLIC = 16, /**< Changes symbol resolution algorithm. */
     679 + LIEF_DT_REL = 17, /**< Address of relocation table (Rel entries. */
     680 + LIEF_DT_RELSZ = 18, /**< Size of Rel relocation table. */
     681 + LIEF_DT_RELENT = 19, /**< Size of a Rel relocation entry. */
     682 + LIEF_DT_PLTREL = 20, /**< Type of relocation entry used for linking. */
     683 + LIEF_DT_DEBUG = 21, /**< Reserved for debugger. */
     684 + LIEF_DT_TEXTREL = 22, /**< Relocations exist for non-writable segments. */
     685 + LIEF_DT_JMPREL = 23, /**< Address of relocations associated with PLT. */
     686 + LIEF_DT_BIND_NOW = 24, /**< Process all relocations before execution. */
     687 + LIEF_DT_INIT_ARRAY = 25, /**< Pointer to array of initialization functions. */
     688 + LIEF_DT_FINI_ARRAY = 26, /**< Pointer to array of termination functions. */
     689 + LIEF_DT_INIT_ARRAYSZ = 27, /**< Size of DT_INIT_ARRAY. */
     690 + LIEF_DT_FINI_ARRAYSZ = 28, /**< Size of DT_FINI_ARRAY. */
     691 + LIEF_DT_RUNPATH = 29, /**< String table offset of lib search path. */
     692 + LIEF_DT_FLAGS = 30, /**< Flags. */
     693 + LIEF_DT_ENCODING = 32, /**< Values from here to DT_LOOS follow the rules for the interpretation of the d_un union. */
     694 + 
     695 + LIEF_DT_PREINIT_ARRAY = 32, /**< Pointer to array of preinit functions. */
     696 + LIEF_DT_PREINIT_ARRAYSZ = 33, /**< Size of the DT_PREINIT_ARRAY array. */
     697 + 
     698 + LIEF_DT_LOOS = 0x60000000, /**< Start of environment specific tags. */
     699 + LIEF_DT_HIOS = 0x6FFFFFFF, /**< End of environment specific tags. */
     700 + LIEF_DT_LOPROC = 0x70000000, /**< Start of processor specific tags. */
     701 + LIEF_DT_HIPROC = 0x7FFFFFFF, /**< End of processor specific tags. */
     702 + 
     703 + LIEF_DT_GNU_HASH = 0x6FFFFEF5, /**< Reference to the GNU hash table. */
     704 + LIEF_DT_RELACOUNT = 0x6FFFFFF9, /**< ELF32_Rela count. */
     705 + LIEF_DT_RELCOUNT = 0x6FFFFFFA, /**< ELF32_Rel count. */
     706 + 
     707 + LIEF_DT_FLAGS_1 = 0x6FFFFFFB, /**< Flags_1. */
     708 + LIEF_DT_VERSYM = 0x6FFFFFF0, /**< The address of .gnu.version section. */
     709 + LIEF_DT_VERDEF = 0x6FFFFFFC, /**< The address of the version definition table. */
     710 + LIEF_DT_VERDEFNUM = 0x6FFFFFFD, /**< The number of entries in DT_VERDEF. */
     711 + LIEF_DT_VERNEED = 0x6FFFFFFE, /**< The address of the version Dependency table. */
     712 + LIEF_DT_VERNEEDNUM = 0x6FFFFFFF, /**< The number of entries in DT_VERNEED. */
     713 + 
     714 + /* Mips specific dynamic table entry tags. */
     715 + LIEF_DT_MIPS_RLD_VERSION = 0x70000001, /**< 32 bit version number for runtime linker interface. */
     716 + LIEF_DT_MIPS_TIME_STAMP = 0x70000002, /**< Time stamp. */
     717 + LIEF_DT_MIPS_ICHECKSUM = 0x70000003, /**< Checksum of external strings and common sizes. */
     718 + LIEF_DT_MIPS_IVERSION = 0x70000004, /**< Index of version string in string table. */
     719 + LIEF_DT_MIPS_FLAGS = 0x70000005, /**< 32 bits of flags. */
     720 + LIEF_DT_MIPS_BASE_ADDRESS = 0x70000006, /**< Base address of the segment. */
     721 + LIEF_DT_MIPS_MSYM = 0x70000007, /**< Address of .msym section. */
     722 + LIEF_DT_MIPS_CONFLICT = 0x70000008, /**< Address of .conflict section. */
     723 + LIEF_DT_MIPS_LIBLIST = 0x70000009, /**< Address of .liblist section. */
     724 + LIEF_DT_MIPS_LOCAL_GOTNO = 0x7000000a, /**< Number of local global offset table entries. */
     725 + LIEF_DT_MIPS_CONFLICTNO = 0x7000000b, /**< Number of entries in the .conflict section. */
     726 + LIEF_DT_MIPS_LIBLISTNO = 0x70000010, /**< Number of entries in the .liblist section. */
     727 + LIEF_DT_MIPS_SYMTABNO = 0x70000011, /**< Number of entries in the .dynsym section. */
     728 + LIEF_DT_MIPS_UNREFEXTNO = 0x70000012, /**< Index of first external dynamic symbol not referenced locally. */
     729 + LIEF_DT_MIPS_GOTSYM = 0x70000013, /**< Index of first dynamic symbol in global offset table. */
     730 + LIEF_DT_MIPS_HIPAGENO = 0x70000014, /**< Number of page table entries in global offset table. */
     731 + LIEF_DT_MIPS_RLD_MAP = 0x70000016, /**< Address of run time loader map, used for debugging. */
     732 + LIEF_DT_MIPS_DELTA_CLASS = 0x70000017, /**< Delta C++ class definition. */
     733 + LIEF_DT_MIPS_DELTA_CLASS_NO = 0x70000018, /**< Number of entries in DT_MIPS_DELTA_CLASS. */
     734 + LIEF_DT_MIPS_DELTA_INSTANCE = 0x70000019, /**< Delta C++ class instances. */
     735 + LIEF_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, /**< Number of entries in DT_MIPS_DELTA_INSTANCE. */
     736 + LIEF_DT_MIPS_DELTA_RELOC = 0x7000001B, /**< Delta relocations. */
     737 + LIEF_DT_MIPS_DELTA_RELOC_NO = 0x7000001C, /**< Number of entries in DT_MIPS_DELTA_RELOC. */
     738 + LIEF_DT_MIPS_DELTA_SYM = 0x7000001D, /**< Delta symbols that Delta relocations refer to. */
     739 + LIEF_DT_MIPS_DELTA_SYM_NO = 0x7000001E, /**< Number of entries in DT_MIPS_DELTA_SYM. */
     740 + LIEF_DT_MIPS_DELTA_CLASSSYM = 0x70000020, /**< Delta symbols that hold class declarations. */
     741 + LIEF_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, /**< Number of entries in DT_MIPS_DELTA_CLASSSYM. */
     742 + LIEF_DT_MIPS_CXX_FLAGS = 0x70000022, /**< Flags indicating information about C++ flavor. */
     743 + LIEF_DT_MIPS_PIXIE_INIT = 0x70000023, /**< Pixie information. */
     744 + LIEF_DT_MIPS_SYMBOL_LIB = 0x70000024, /**< Address of .MIPS.symlib */
     745 + LIEF_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, /**< The GOT index of the first PTE for a segment */
     746 + LIEF_DT_MIPS_LOCAL_GOTIDX = 0x70000026, /**< The GOT index of the first PTE for a local symbol */
     747 + LIEF_DT_MIPS_HIDDEN_GOTIDX = 0x70000027, /**< The GOT index of the first PTE for a hidden symbol */
     748 + LIEF_DT_MIPS_PROTECTED_GOTIDX = 0x70000028, /**< The GOT index of the first PTE for a protected symbol */
     749 + LIEF_DT_MIPS_OPTIONS = 0x70000029, /**< Address of `.MIPS.options'. */
     750 + LIEF_DT_MIPS_INTERFACE = 0x7000002A, /**< Address of `.interface'. */
     751 + LIEF_DT_MIPS_DYNSTR_ALIGN = 0x7000002B, /**< Unknown. */
     752 + LIEF_DT_MIPS_INTERFACE_SIZE = 0x7000002C, /**< Size of the .interface section. */
     753 + LIEF_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, /**< Size of rld_text_resolve function stored in the GOT. */
     754 + LIEF_DT_MIPS_PERF_SUFFIX = 0x7000002E, /**< Default suffix of DSO to be added by rld on dlopen( calls. */
     755 + LIEF_DT_MIPS_COMPACT_SIZE = 0x7000002F, /**< Size of compact relocation section (O32. */
     756 + LIEF_DT_MIPS_GP_VALUE = 0x70000030, /**< GP value for auxiliary GOTs. */
     757 + LIEF_DT_MIPS_AUX_DYNAMIC = 0x70000031, /**< Address of auxiliary .dynamic. */
     758 + LIEF_DT_MIPS_PLTGOT = 0x70000032, /**< Address of the base of the PLTGOT. */
     759 + LIEF_DT_MIPS_RWPLT = 0x70000034, /**< Points to the base of a writable PLT. */
     760 + 
     761 + /* Android specific dynamic table entry tags. */
     762 + LIEF_DT_ANDROID_REL_OFFSET = 0x6000000D, /**< The offset of packed relocation data (older version < M) (Android specific. */
     763 + LIEF_DT_ANDROID_REL_SIZE = 0x6000000E, /**< The size of packed relocation data in bytes (older version < M) (Android specific. */
     764 + LIEF_DT_ANDROID_REL = 0x6000000F, /**< The offset of packed relocation data (Android specific. */
     765 + LIEF_DT_ANDROID_RELSZ = 0x60000010, /**< The size of packed relocation data in bytes (Android specific. */
     766 + LIEF_DT_ANDROID_RELA = 0x60000011, /**< The offset of packed relocation data (Android specific. */
     767 + LIEF_DT_ANDROID_RELASZ = 0x60000012, /**< The size of packed relocation data in bytes (Android specific. */
     768 + LIEF_DT_RELR = 0x6FFFE000, /**< The offset of new relr relocation data (Android specific. */
     769 + LIEF_DT_RELRSZ = 0x6FFFE001, /**< The size of nre relr relocation data in bytes (Android specific. */
     770 + LIEF_DT_RELRENT = 0x6FFFE003, /**< The size of a new relr relocation entry (Android specific. */
     771 + LIEF_DT_RELRCOUNT = 0x6FFFE005 /**< Specifies the relative count of new relr relocation entries (Android specific. */
     772 +};
    12 773   
    13  -#include "LIEF/ELF/enums.inc"
     774 +/** DT_FLAGS and DT_FLAGS_1 values. */
     775 +enum LIEF_DYNAMIC_FLAGS {
     776 + LIEF_DF_ORIGIN = 0x00000001, /**< The object may reference $ORIGIN. */
     777 + LIEF_DF_SYMBOLIC = 0x00000002, /**< Search the shared lib before searching the exe. */
     778 + LIEF_DF_TEXTREL = 0x00000004, /**< Relocations may modify a non-writable segment. */
     779 + LIEF_DF_BIND_NOW = 0x00000008, /**< Process all relocations on load. */
     780 + LIEF_DF_STATIC_TLS = 0x00000010, /**< Reject attempts to load dynamically. */
     781 +};
    14 782   
    15  -#undef _LIEF_EN
    16  -#undef _LIEF_EN_2
    17  -#undef _LIEF_EI
     783 +enum LIEF_DYNAMIC_FLAGS_1 {
     784 + LIEF_DF_1_NOW = 0x00000001, /**< Set RTLD_NOW for this object. */
     785 + LIEF_DF_1_GLOBAL = 0x00000002, /**< Set RTLD_GLOBAL for this object. */
     786 + LIEF_DF_1_GROUP = 0x00000004, /**< Set RTLD_GROUP for this object. */
     787 + LIEF_DF_1_NODELETE = 0x00000008, /**< Set RTLD_NODELETE for this object. */
     788 + LIEF_DF_1_LOADFLTR = 0x00000010, /**< Trigger filtee loading at runtime. */
     789 + LIEF_DF_1_INITFIRST = 0x00000020, /**< Set RTLD_INITFIRST for this object. */
     790 + LIEF_DF_1_NOOPEN = 0x00000040, /**< Set RTLD_NOOPEN for this object. */
     791 + LIEF_DF_1_ORIGIN = 0x00000080, /**< $ORIGIN must be handled. */
     792 + LIEF_DF_1_DIRECT = 0x00000100, /**< Direct binding enabled. */
     793 + LIEF_DF_1_TRANS = 0x00000200,
     794 + LIEF_DF_1_INTERPOSE = 0x00000400, /**< Object is used to interpose. */
     795 + LIEF_DF_1_NODEFLIB = 0x00000800, /**< Ignore default lib search path. */
     796 + LIEF_DF_1_NODUMP = 0x00001000, /**< Object can't be dldump'ed. */
     797 + LIEF_DF_1_CONFALT = 0x00002000, /**< Configuration alternative created. */
     798 + LIEF_DF_1_ENDFILTEE = 0x00004000, /**< Filtee terminates filters search. */
     799 + LIEF_DF_1_DISPRELDNE = 0x00008000, /**< Disp reloc applied at build time. */
     800 + LIEF_DF_1_DISPRELPND = 0x00010000, /**< Disp reloc applied at run-time. */
     801 + LIEF_DF_1_NODIRECT = 0x00020000, /**< Object has no-direct binding. */
     802 + LIEF_DF_1_IGNMULDEF = 0x00040000,
     803 + LIEF_DF_1_NOKSYMS = 0x00080000,
     804 + LIEF_DF_1_NOHDR = 0x00100000,
     805 + LIEF_DF_1_EDITED = 0x00200000, /**< Object is modified after built. */
     806 + LIEF_DF_1_NORELOC = 0x00400000,
     807 + LIEF_DF_1_SYMINTPOSE = 0x00800000, /**< Object has individual interposers. */
     808 + LIEF_DF_1_GLOBAUDIT = 0x01000000, /**< Global auditing required. */
     809 + LIEF_DF_1_SINGLETON = 0x02000000, /**< Singleton symbols are used. */
     810 + LIEF_DF_1_PIE = 0x08000000 /**< Singleton symbols are used. */
     811 +};
     812 + 
     813 +/* DT_MIPS_FLAGS values. */
     814 +enum {
     815 + LIEF_RHF_NONE = 0x00000000, /* No flags. */
     816 + LIEF_RHF_QUICKSTART = 0x00000001, /* Uses shortcut pointers. */
     817 + LIEF_RHF_NOTPOT = 0x00000002, /* Hash size is not a power of two. */
     818 + LIEF_RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, /* Ignore LD_LIBRARY_PATH. */
     819 + LIEF_RHF_NO_MOVE = 0x00000008, /* DSO address may not be relocated. */
     820 + LIEF_RHF_SGI_ONLY = 0x00000010, /* SGI specific features. */
     821 + LIEF_RHF_GUARANTEE_INIT = 0x00000020, /* Guarantee that .init will finish */
     822 + /* executing before any non-init */
     823 + /* code in DSO is called. */
     824 + LIEF_RHF_DELTA_C_PLUS_PLUS = 0x00000040, /* Contains Delta C++ code. */
     825 + LIEF_RHF_GUARANTEE_START_INIT = 0x00000080, /* Guarantee that .init will start */
     826 + /* executing before any non-init */
     827 + /* code in DSO is called. */
     828 + LIEF_RHF_PIXIE = 0x00000100, /* Generated by pixie. */
     829 + LIEF_RHF_DEFAULT_DELAY_LOAD = 0x00000200, /* Delay-load DSO by default. */
     830 + LIEF_RHF_REQUICKSTART = 0x00000400, /* Object may be requickstarted */
     831 + LIEF_RHF_REQUICKSTARTED = 0x00000800, /* Object has been requickstarted */
     832 + LIEF_RHF_CORD = 0x00001000, /* Generated by cord. */
     833 + LIEF_RHF_NO_UNRES_UNDEF = 0x00002000, /* Object contains no unresolved */
     834 + /* undef symbols. */
     835 + LIEF_RHF_RLD_ORDER_SAFE = 0x00004000 /* Symbol table is in a safe order. */
     836 +};
     837 + 
     838 +/** ElfXX_VerDef structure version (GNU versioning) */
     839 +enum {
     840 + LIEF_VER_DEF_NONE = 0,
     841 + LIEF_VER_DEF_CURRENT = 1
     842 +};
     843 + 
     844 +/** VerDef Flags (ElfXX_VerDef::vd_flags) */
     845 +enum {
     846 + LIEF_VER_FLG_BASE = 0x1,
     847 + LIEF_VER_FLG_WEAK = 0x2,
     848 + LIEF_VER_FLG_INFO = 0x4
     849 +};
     850 + 
     851 +/** Special constants for the version table. (SHT_GNU_versym/.gnu.version) */
     852 +enum {
     853 + LIEF_VER_NDX_LOCAL = 0, /**< Unversioned local symbol */
     854 + LIEF_VER_NDX_GLOBAL = 1, /**< Unversioned global symbol */
     855 + LIEF_VERSYM_VERSION = 0x7fff, /**< Version Index mask */
     856 + LIEF_VERSYM_HIDDEN = 0x8000 /**< Hidden bit (non-default version */
     857 +};
     858 + 
     859 +/** ElfXX_VerNeed structure version (GNU versioning) */
     860 +enum {
     861 + LIEF_VER_NEED_NONE = 0,
     862 + LIEF_VER_NEED_CURRENT = 1
     863 +};
     864 + 
     865 +enum LIEF_AUX_TYPE {
     866 + LIEF_AT_NULL = 0, /**< End of vector */
     867 + LIEF_AT_IGNORE = 1, /**< Entry should be ignored */
     868 + LIEF_AT_EXECFD = 2, /**< File descriptor of program */
     869 + LIEF_AT_PHDR = 3, /**< Program headers for program */
     870 + LIEF_AT_PHENT = 4, /**< Size of program header entry */
     871 + LIEF_AT_PHNUM = 5, /**< Number of program headers */
     872 + LIEF_AT_PAGESZ = 6, /**< System page size */
     873 + LIEF_AT_BASE = 7, /**< Base address of interpreter */
     874 + LIEF_AT_FLAGS = 8, /**< Flags */
     875 + LIEF_AT_ENTRY = 9, /**< Entry point of program */
     876 + LIEF_AT_NOTELF = 10, /**< Program is not ELF */
     877 + LIEF_AT_UID = 11, /**< Real uid */
     878 + LIEF_AT_EUID = 12, /**< Effective uid */
     879 + LIEF_AT_GID = 13, /**< Real gid */
     880 + LIEF_AT_EGID = 14, /**< Effective gid */
     881 + LIEF_AT_CLKTCK = 17, /**< Frequency of times( */
     882 + 
     883 + /* Some more special a_type values describing the hardware. */
     884 + 
     885 + LIEF_AT_PLATFORM = 15, /**< String identifying platform. */
     886 + LIEF_AT_HWCAP = 16, /**< Machine dependent hints about processor capabilities. */
     887 + 
     888 + /* This entry gives some information about the FPU initialization
     889 + performed by the kernel. */
     890 + 
     891 + LIEF_AT_FPUCW = 18, /**< Used FPU control word. */
     892 + 
     893 + /* Cache block sizes. */
     894 + LIEF_AT_DCACHEBSIZE = 19, /**< Data cache block size. */
     895 + LIEF_AT_ICACHEBSIZE = 20, /**< Instruction cache block size. */
     896 + LIEF_AT_UCACHEBSIZE = 21, /**< Unified cache block size. */
     897 + 
     898 + /* A special ignored value for PPC, used by the kernel to control the
     899 + interpretation of the AUXV. Must be > 16. */
     900 + 
     901 + LIEF_AT_IGNOREPPC = 22, /**< Entry should be ignored. */
     902 + LIEF_AT_SECURE = 23, /**< Boolean, was exec setuid-like? */
     903 + LIEF_AT_BASE_PLATFORM = 24, /**< String identifying real platforms.*/
     904 + LIEF_AT_RANDOM = 25, /**< Address of 16 random bytes. */
     905 + LIEF_AT_HWCAP2 = 26, /**< Extension of AT_HWCAP. */
     906 + LIEF_AT_EXECFN = 31, /**< Filename of executable. */
     907 + 
     908 + /* Pointer to the global system page used for system calls and other
     909 + nice things. */
     910 + LIEF_AT_SYSINFO = 32,
     911 + LIEF_AT_SYSINFO_EHDR = 33,
     912 + 
     913 + /* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
     914 + log2 of line size; mask those to get cache size. */
     915 + LIEF_AT_L1I_CACHESHAPE = 34,
     916 + LIEF_AT_L1D_CACHESHAPE = 35,
     917 + LIEF_AT_L2_CACHESHAPE = 36,
     918 + LIEF_AT_L3_CACHESHAPE = 37
     919 +};
     920 + 
     921 +/** Methods that can be used by the LIEF::ELF::Parser
     922 + to count the number of dynamic symbols */
     923 +enum LIEF_DYNSYM_COUNT_METHODS {
     924 + LIEF_COUNT_AUTO = 0, /**< Automatic detection */
     925 + LIEF_COUNT_SECTION = 1, /**< Count based on sections (not very reliable */
     926 + LIEF_COUNT_HASH = 2, /**< Count based on hash table (reliable */
     927 + LIEF_COUNT_RELOCATIONS = 3, /**< Count based on PLT/GOT relocations (very reliable but not accurate */
     928 +};
     929 + 
     930 +enum LIEF_NOTE_TYPES {
     931 + LIEF_NT_UNKNOWN = 0,
     932 + LIEF_NT_GNU_ABI_TAG = 1,
     933 + LIEF_NT_GNU_HWCAP = 2,
     934 + LIEF_NT_GNU_BUILD_ID = 3,
     935 + LIEF_NT_GNU_GOLD_VERSION = 4,
     936 + LIEF_NT_GNU_PROPERTY_TYPE_0 = 5,
     937 + LIEF_NT_GNU_BUILD_ATTRIBUTE_OPEN = 0x100,
     938 + LIEF_NT_GNU_BUILD_ATTRIBUTE_FUNC = 0x101,
     939 + LIEF_NT_CRASHPAD = 0x4f464e49,
     940 +};
     941 + 
     942 +enum LIEF_NOTE_TYPES_CORE {
     943 + LIEF_NT_CORE_UNKNOWN = 0,
     944 + LIEF_NT_PRSTATUS = 1,
     945 + LIEF_NT_PRFPREG = 2,
     946 + LIEF_NT_PRPSINFO = 3,
     947 + LIEF_NT_TASKSTRUCT = 4,
     948 + LIEF_NT_AUXV = 6,
     949 + LIEF_NT_SIGINFO = 0x53494749,
     950 + LIEF_NT_FILE = 0x46494c45,
     951 + LIEF_NT_PRXFPREG = 0x46e62b7f,
     952 + 
     953 + LIEF_NT_ARM_VFP = 0x400,
     954 + LIEF_NT_ARM_TLS = 0x401,
     955 + LIEF_NT_ARM_HW_BREAK = 0x402,
     956 + LIEF_NT_ARM_HW_WATCH = 0x403,
     957 + LIEF_NT_ARM_SYSTEM_CALL = 0x404,
     958 + LIEF_NT_ARM_SVE = 0x405,
     959 + 
     960 + LIEF_NT_386_TLS = 0x200,
     961 + LIEF_NT_386_IOPERM = 0x201,
     962 + LIEF_NT_386_XSTATE = 0x202,
     963 + 
     964 +};
     965 + 
     966 + 
     967 +enum LIEF_NOTE_ABIS {
     968 + LIEF_ELF_NOTE_UNKNOWN = ~(unsigned int)(0),
     969 + LIEF_ELF_NOTE_OS_LINUX = 0,
     970 + LIEF_ELF_NOTE_OS_GNU = 1,
     971 + LIEF_ELF_NOTE_OS_SOLARIS2 = 2,
     972 + LIEF_ELF_NOTE_OS_FREEBSD = 3,
     973 + LIEF_ELF_NOTE_OS_NETBSD = 4,
     974 + LIEF_ELF_NOTE_OS_SYLLABLE = 5,
     975 +};
     976 + 
     977 +enum LIEF_RELOCATION_PURPOSES {
     978 + LIEF_RELOC_PURPOSE_NONE = 0,
     979 + LIEF_RELOC_PURPOSE_PLTGOT = 1,
     980 + LIEF_RELOC_PURPOSE_DYNAMIC = 2,
     981 + LIEF_RELOC_PURPOSE_OBJECT = 3,
     982 +};
    18 983   
    19 984  #ifdef __cplusplus
    20 985  }
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF/utils.h
    skipped 12 lines
    13 13   * See the License for the specific language governing permissions and
    14 14   * limitations under the License.
    15 15   */
    16  -#ifndef C_LIEF_ELF_UTILS_H_
    17  -#define C_LIEF_ELF_UTILS_H_
     16 +#ifndef LIEF_C_ELF_UTILS_H
     17 +#define LIEF_C_ELF_UTILS_H
    18 18   
    19 19  #include <stddef.h>
    20 20   
    skipped 18 lines
  • ■ ■ ■ ■ ■
    api/c/include/LIEF/ELF.h
    skipped 20 lines
    21 21  #include "LIEF/ELF/Section.h"
    22 22  #include "LIEF/ELF/Header.h"
    23 23  #include "LIEF/ELF/DynamicEntry.h"
    24  -#include "LIEF/ELF/EnumToString.h"
    25 24  #include "LIEF/ELF/utils.h"
    26 25   
    27 26  #endif
    skipped 1 lines
  • ■ ■ ■ ■
    api/python/examples/abstract_json.py
    skipped 16 lines
    17 17   args = parser.parse_args()
    18 18   
    19 19   binary = lief.parse(args.binary)
    20  - json_data = json.loads(lief.to_json_from_abstract(binary))
     20 + json_data = json.loads(lief.to_json(binary.abstract))
    21 21   print(json.dumps(json_data, sort_keys = True, indent = 4))
    22 22   
    23 23  if __name__ == "__main__":
    skipped 3 lines
  • ■ ■ ■ ■ ■
    api/python/examples/abstract_reader.py
    skipped 176 lines
    177 177   
    178 178   args = parser.parse_args()
    179 179   
    180  - binary = None
    181  - try:
    182  - binary = lief.parse(args.binary)
    183  - except lief.exception as e:
    184  - print(e)
    185  - sys.exit(1)
     180 + binary = lief.parse(args.binary)
    186 181   
    187 182   binary = binary.abstract
    188 183   if args.show_header or args.show_all:
    skipped 26 lines
  • ■ ■ ■ ■
    api/python/examples/change_elf_interpreter.py
    skipped 14 lines
    15 15   print("Wrong interpreter! ({})".format(interpreter))
    16 16   return 1
    17 17   
    18  - binary = lief.parse(target)
     18 + binary = lief.ELF.parse(target)
    19 19   if not binary.has_interpreter:
    20 20   print("The given target doesn't have interpreter!")
    21 21   return 1
    skipped 48 lines
  • ■ ■ ■ ■
    api/python/examples/dex_json.py
    skipped 14 lines
    15 15   parser.add_argument('file', help='DEX binary')
    16 16   args = parser.parse_args()
    17 17   
    18  - if not lief.DEX.is_dex(args.file):
     18 + if not lief.is_dex(args.file):
    19 19   print("{} is not a DEX file".format(args.file))
    20 20   return 1
    21 21   dexfile = lief.DEX.parse(args.file)
    skipped 7 lines
  • ■ ■ ■ ■ ■
    api/python/examples/dex_reader.py
    skipped 207 lines
    208 208   
    209 209   lief.logging.set_level(args.main_verbosity)
    210 210   
    211  - binary = None
    212  - try:
    213  - dexfile = DEX.parse(args.file)
    214  - except lief.exception as e:
    215  - print(e)
    216  - sys.exit(1)
     211 + dexfile = DEX.parse(args.file)
    217 212   
    218 213   print_information(dexfile)
    219 214   
    skipped 30 lines
  • ■ ■ ■ ■ ■ ■
    api/python/examples/elf_reader.py
    skipped 133 lines
    134 134   sections = segment.sections
    135 135   s = ", ".join([section.name for section in sections])
    136 136   flags_str = ["-"] * 3
    137  - if ELF.SEGMENT_FLAGS.R in segment:
     137 + if ELF.Segment.FLAGS.R in segment:
    138 138   flags_str[0] = "r"
    139 139   
    140  - if ELF.SEGMENT_FLAGS.W in segment:
     140 + if ELF.Segment.FLAGS.W in segment:
    141 141   flags_str[1] = "w"
    142 142   
    143  - if ELF.SEGMENT_FLAGS.X in segment:
     143 + if ELF.Segment.FLAGS.X in segment:
    144 144   flags_str[2] = "x"
    145 145   flags_str = "".join(flags_str)
    146 146   
    skipped 20 lines
    167 167   f_value = "|{:<16} | 0x{:<8x}| {:<20}|"
    168 168   print(f_title.format("Tag", "Value", "Info"))
    169 169   for entry in dynamic_entries:
    170  - if entry.tag == ELF.DYNAMIC_TAGS.NULL:
     170 + if entry.tag == ELF.DynamicEntry.TAG.NULL:
    171 171   continue
    172 172   
    173  - if entry.tag in [ELF.DYNAMIC_TAGS.SONAME, ELF.DYNAMIC_TAGS.NEEDED, ELF.DYNAMIC_TAGS.RUNPATH, ELF.DYNAMIC_TAGS.RPATH]:
     173 + if entry.tag in [ELF.DynamicEntry.TAG.SONAME, ELF.DynamicEntry.TAG.NEEDED, ELF.DynamicEntry.TAG.RUNPATH, ELF.DynamicEntry.TAG.RPATH]:
    174 174   print(f_value.format(str(entry.tag).split(".")[-1], entry.value, entry.name))
    175  - elif type(entry) is ELF.DynamicEntryArray: # [ELF.DYNAMIC_TAGS.INIT_ARRAY,ELF.DYNAMIC_TAGS.FINI_ARRAY]:
     175 + elif type(entry) is ELF.DynamicEntryArray: # [ELF.DynamicEntry.TAG.INIT_ARRAY,ELF.DynamicEntry.TAG.FINI_ARRAY]:
    176 176   print(f_value.format(str(entry.tag).split(".")[-1], entry.value, ", ".join(map(hex, entry.array))))
    177  - elif entry.tag == ELF.DYNAMIC_TAGS.FLAGS:
    178  - flags_str = " - ".join([str(ELF.DYNAMIC_FLAGS(s)).split(".")[-1] for s in entry.flags])
     177 + elif entry.tag == ELF.DynamicEntry.TAG.FLAGS:
     178 + flags_str = " - ".join([str(ELF.DynamicEntryFlags.FLAG(s)).split(".")[-1] for s in entry.flags])
    179 179   print(f_value.format(str(entry.tag).split(".")[-1], entry.value, flags_str))
    180  - elif entry.tag == ELF.DYNAMIC_TAGS.FLAGS_1:
    181  - flags_str = " - ".join([str(ELF.DYNAMIC_FLAGS_1(s)).split(".")[-1] for s in entry.flags])
     180 + elif entry.tag == ELF.DynamicEntry.TAG.FLAGS_1:
     181 + flags_str = " - ".join([str(ELF.DynamicEntryFlags.FLAG(s)).split(".")[-1] for s in entry.flags])
    182 182   print(f_value.format(str(entry.tag).split(".")[-1], entry.value, flags_str))
    183 183   else:
    184 184   print(f_value.format(str(entry.tag).split(".")[-1], entry.value, ""))
    skipped 82 lines
    267 267   symbol: lief.ELF.Symbol = relocation.symbol
    268 268   if len(symbol.name) > 0:
    269 269   symbol_name = symbol.name
    270  - elif symbol.type == lief.ELF.SYMBOL_TYPES.SECTION:
     270 + elif symbol.type == lief.ELF.Symbol.TYPE.SECTION:
    271 271   shndx = symbol.shndx
    272 272   sections = binary.sections
    273 273   if 0 < shndx and shndx < len(sections):
    skipped 128 lines
    402 402   
    403 403   note_details = note.details
    404 404   
    405  - if type(note_details) == lief.ELF.AndroidNote:
     405 + if isinstance(note_details, lief.ELF.AndroidIdent):
    406 406   print(format_dec.format("SDK Version:", note_details.sdk_version))
    407 407   print(format_str.format("NDK Version:", note_details.ndk_version))
    408 408   print(format_str.format("NDK build number:", note_details.ndk_build_number))
    409 409   
    410  - if type(note_details) == lief.ELF.NoteAbi:
     410 + if isinstance(note_details, lief.ELF.NoteAbi):
    411 411   version = note_details.version
    412 412   version_str = "{:d}.{:d}.{:d}".format(version[0], version[1], version[2])
    413 413   
    414 414   print(format_str.format("ABI:", note_details.abi))
    415 415   print(format_str.format("Version:", version_str))
    416 416   
    417  - if ELF.NOTE_TYPES(note.type) == ELF.NOTE_TYPES.GOLD_VERSION:
     417 + if note.type == ELF.Note.TYPE.GNU_GOLD_VERSION:
    418 418   print(format_str.format("Version:", "".join(map(chr, note.description))))
    419 419   
    420 420   if note.is_core:
    skipped 226 lines
  • ■ ■ ■ ■
    api/python/examples/elf_remove_section_table.py
    skipped 22 lines
    23 23  from lief import ELF
    24 24   
    25 25  def remove_section_table(filename, output):
    26  - binary = lief.parse(filename) # Build an ELF binary
     26 + binary = lief.ELF.parse(filename) # Build an ELF binary
    27 27   
    28 28   header = binary.header
    29 29   header.section_header_offset = 0;
    skipped 15 lines
  • ■ ■ ■ ■ ■ ■
    api/python/examples/elf_unstrip.py
    skipped 19 lines
    20 20   
    21 21   symtab_section = ELF.Section()
    22 22   symtab_section.name = ""
    23  - symtab_section.type = ELF.SECTION_TYPES.SYMTAB
     23 + symtab_section.type = ELF.Section.TYPE.SYMTAB
    24 24   symtab_section.entry_size = 0x18
    25 25   symtab_section.alignment = 8
    26 26   symtab_section.link = len(binary.sections) + 1
    skipped 1 lines
    28 28   
    29 29   symstr_section = ELF.Section()
    30 30   symstr_section.name = ""
    31  - symstr_section.type = ELF.SECTION_TYPES.STRTAB
     31 + symstr_section.type = ELF.Section.TYPE.STRTAB
    32 32   symstr_section.entry_size = 1
    33 33   symstr_section.alignment = 1
    34 34   symstr_section.content = [0] * 100
    skipped 3 lines
    38 38   
    39 39   symbol = ELF.Symbol()
    40 40   symbol.name = ""
    41  - symbol.type = ELF.SYMBOL_TYPES.NOTYPE
     41 + symbol.type = ELF.Symbol.TYPE.NOTYPE
    42 42   symbol.value = 0
    43  - symbol.binding = ELF.SYMBOL_BINDINGS.LOCAL
     43 + symbol.binding = ELF.Symbol.BINDING.LOCAL
    44 44   symbol.size = 0
    45 45   symbol.shndx = 0
    46 46   symbol = binary.add_static_symbol(symbol)
    47 47   
    48 48   symbol = ELF.Symbol()
    49 49   symbol.name = "main"
    50  - symbol.type = ELF.SYMBOL_TYPES.FUNC
     50 + symbol.type = ELF.Symbol.TYPE.FUNC
    51 51   symbol.value = 0x402A00
    52  - symbol.binding = ELF.SYMBOL_BINDINGS.LOCAL
     52 + symbol.binding = ELF.Symbol.BINDING.LOCAL
    53 53   symbol.shndx = 14
    54 54   symbol = binary.add_static_symbol(symbol)
    55 55   
    skipped 7 lines
  • ■ ■ ■ ■ ■
    api/python/examples/oat_reader.py
    skipped 182 lines
    183 183   lief.logging.set_level(args.main_verbosity)
    184 184   
    185 185   
    186  - binary = None
    187  - try:
    188  - binary = OAT.parse(args.binary)
    189  - except lief.exception as e:
    190  - print(e)
    191  - sys.exit(1)
     186 + binary = OAT.parse(args.binary)
    192 187   
    193 188   print_information(binary)
    194 189   
    skipped 18 lines
  • ■ ■ ■ ■
    api/python/examples/pe_forwardinfo.py
    1 1  import lief
    2 2  import sys
    3 3   
    4  -pe = lief.parse(sys.argv[1])
     4 +pe = lief.PE.parse(sys.argv[1])
    5 5  exports = pe.get_export()
    6 6   
    7 7  for e in filter(lambda e: e.is_forwarded, exports.entries):
    skipped 3 lines
  • ■ ■ ■ ■
    api/python/examples/pe_from_scratch.py
    skipped 2 lines
    3 3   
    4 4  # Description:
    5 5  # Create a PE which pop a MessageBox
    6  -# with the message "Hello World"
     6 +# with the message "Hello World"
    7 7   
    8 8  from lief import PE
    9 9   
    skipped 51 lines
  • ■ ■ ■ ■ ■
    api/python/examples/pe_reader.py
    skipped 564 lines
    565 565   args = parser.parse_args()
    566 566   lief.logging.set_level(args.main_verbosity)
    567 567   
    568  - binary = None
    569  - try:
    570  - binary = PE.parse(args.pe_file)
    571  - except lief.exception as e:
    572  - print(e)
    573  - sys.exit(1)
     568 + binary = PE.parse(args.pe_file)
    574 569   
    575 570   if binary is None:
    576 571   sys.exit(1)
    skipped 57 lines
  • ■ ■ ■ ■
    api/python/examples/pe_resources_manager.py
    skipped 1 lines
    2 2  import sys
    3 3  import lief
    4 4   
    5  -b = lief.parse(sys.argv[1])
     5 +b = lief.PE.parse(sys.argv[1])
    6 6  manager = b.resources_manager
    7 7  print(manager)
    8 8  print(manager.manifest)
    skipped 1 lines
  • ■ ■ ■ ■
    api/python/examples/vdex_json.py
    skipped 14 lines
    15 15   parser.add_argument('file', help='VDEX file')
    16 16   args = parser.parse_args()
    17 17   
    18  - if not lief.VDEX.is_vdex(args.file):
     18 + if not lief.is_vdex(args.file):
    19 19   print("{} is not a VDEX file".format(args.file))
    20 20   return 1
    21 21   dexfile = lief.VDEX.parse(args.file)
    skipped 7 lines
  • ■ ■ ■ ■ ■
    api/python/examples/vdex_reader.py
    skipped 119 lines
    120 120   
    121 121   lief.logging.set_level(args.main_verbosity)
    122 122   
    123  - vdexfile = None
    124  - try:
    125  - vdexfile = DEX.parse(args.file)
    126  - except lief.exception as e:
    127  - print(e)
    128  - sys.exit(1)
     123 + vdexfile = DEX.parse(args.file)
    129 124   
    130 125   print_information(vdexfile)
    131 126   
    skipped 9 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/CMakeLists.txt
    1 1  target_sources(pyLIEF PRIVATE
    2 2   init.cpp
    3 3   enums.cpp
     4 + pyProcessorFlags.cpp
    4 5  )
    5 6   
    6 7  add_subdirectory(objects)
    skipped 1 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/enums.cpp
    skipped 17 lines
    18 18  #include "LIEF/ELF/EnumToString.hpp"
    19 19  #include "enums_wrapper.hpp"
    20 20   
    21  -#define PY_ENUM(x) to_string(x), x
    22  - 
    23 21  namespace LIEF::ELF::py {
    24 22  void init_enums(nb::module_& m) {
    25  - enum_<ELF_CLASS>(m, "ELF_CLASS")
    26  - .value(PY_ENUM(ELF_CLASS::ELFCLASSNONE))
    27  - .value(PY_ENUM(ELF_CLASS::ELFCLASS32))
    28  - .value(PY_ENUM(ELF_CLASS::ELFCLASS64));
    29  - 
    30  - enum_<ELF_DATA>(m, "ELF_DATA")
    31  - .value(PY_ENUM(ELF_DATA::ELFDATANONE))
    32  - .value(PY_ENUM(ELF_DATA::ELFDATA2LSB))
    33  - .value(PY_ENUM(ELF_DATA::ELFDATA2MSB));
    34  - 
    35  - enum_<OS_ABI>(m, "OS_ABI")
    36  - .value(PY_ENUM(OS_ABI::ELFOSABI_SYSTEMV))
    37  - .value(PY_ENUM(OS_ABI::ELFOSABI_HPUX))
    38  - .value(PY_ENUM(OS_ABI::ELFOSABI_NETBSD))
    39  - .value(PY_ENUM(OS_ABI::ELFOSABI_LINUX))
    40  - .value("GNU", OS_ABI::ELFOSABI_GNU)
    41  - .value(PY_ENUM(OS_ABI::ELFOSABI_HURD))
    42  - .value(PY_ENUM(OS_ABI::ELFOSABI_SOLARIS))
    43  - .value(PY_ENUM(OS_ABI::ELFOSABI_AIX))
    44  - .value(PY_ENUM(OS_ABI::ELFOSABI_IRIX))
    45  - .value(PY_ENUM(OS_ABI::ELFOSABI_FREEBSD))
    46  - .value(PY_ENUM(OS_ABI::ELFOSABI_TRU64))
    47  - .value(PY_ENUM(OS_ABI::ELFOSABI_MODESTO))
    48  - .value(PY_ENUM(OS_ABI::ELFOSABI_OPENBSD))
    49  - .value(PY_ENUM(OS_ABI::ELFOSABI_OPENVMS))
    50  - .value(PY_ENUM(OS_ABI::ELFOSABI_NSK))
    51  - .value(PY_ENUM(OS_ABI::ELFOSABI_AROS))
    52  - .value(PY_ENUM(OS_ABI::ELFOSABI_FENIXOS))
    53  - .value(PY_ENUM(OS_ABI::ELFOSABI_CLOUDABI))
    54  - .value(PY_ENUM(OS_ABI::ELFOSABI_AMDGPU_HSA))
    55  - .value("C6000_ELFABI", OS_ABI::ELFOSABI_C6000_ELFABI)
    56  - .value(PY_ENUM(OS_ABI::ELFOSABI_C6000_LINUX))
    57  - .value(PY_ENUM(OS_ABI::ELFOSABI_ARM))
    58  - .value(PY_ENUM(OS_ABI::ELFOSABI_STANDALONE));
    59  - 
    60  - // Enum for the *e_type* of ElfXX_Ehdr
    61  - enum_<E_TYPE>(m, "E_TYPE")
    62  - .value(PY_ENUM(E_TYPE::ET_NONE))
    63  - .value(PY_ENUM(E_TYPE::ET_REL))
    64  - .value(PY_ENUM(E_TYPE::ET_EXEC))
    65  - .value(PY_ENUM(E_TYPE::ET_DYN))
    66  - .value(PY_ENUM(E_TYPE::ET_CORE))
    67  - .value(PY_ENUM(E_TYPE::ET_LOPROC))
    68  - .value(PY_ENUM(E_TYPE::ET_HIPROC));
    69  - 
    70  - //! Enum for the *e_version* of ElfXX_Ehdr;
    71  - enum_<VERSION>(m, "VERSION")
    72  - .value(PY_ENUM(VERSION::EV_NONE))
    73  - .value(PY_ENUM(VERSION::EV_CURRENT));
    74  - 
    75  - // Enum for the *e_machine* of ElfXX_Ehdr
     23 + #define ENTRY(X) .value(to_string(ARCH::X), ARCH::X)
    76 24   enum_<ARCH>(m, "ARCH")
    77  - .value(PY_ENUM(ARCH::EM_NONE))
    78  - .value(PY_ENUM(ARCH::EM_M32))
    79  - .value(PY_ENUM(ARCH::EM_SPARC))
    80  - .value(PY_ENUM(ARCH::EM_386))
    81  - .value(PY_ENUM(ARCH::EM_68K))
    82  - .value(PY_ENUM(ARCH::EM_88K))
    83  - .value(PY_ENUM(ARCH::EM_IAMCU))
    84  - .value(PY_ENUM(ARCH::EM_860))
    85  - .value(PY_ENUM(ARCH::EM_MIPS))
    86  - .value(PY_ENUM(ARCH::EM_S370))
    87  - .value(PY_ENUM(ARCH::EM_MIPS_RS3_LE))
    88  - .value(PY_ENUM(ARCH::EM_PARISC))
    89  - .value(PY_ENUM(ARCH::EM_VPP500))
    90  - .value(PY_ENUM(ARCH::EM_SPARC32PLUS))
    91  - .value(PY_ENUM(ARCH::EM_960))
    92  - .value(PY_ENUM(ARCH::EM_PPC))
    93  - .value(PY_ENUM(ARCH::EM_PPC64))
    94  - .value(PY_ENUM(ARCH::EM_S390))
    95  - .value(PY_ENUM(ARCH::EM_SPU))
    96  - .value(PY_ENUM(ARCH::EM_V800))
    97  - .value(PY_ENUM(ARCH::EM_FR20))
    98  - .value(PY_ENUM(ARCH::EM_RH32))
    99  - .value(PY_ENUM(ARCH::EM_RCE))
    100  - .value(PY_ENUM(ARCH::EM_ARM))
    101  - .value(PY_ENUM(ARCH::EM_ALPHA))
    102  - .value(PY_ENUM(ARCH::EM_SH))
    103  - .value(PY_ENUM(ARCH::EM_SPARCV9))
    104  - .value(PY_ENUM(ARCH::EM_TRICORE))
    105  - .value(PY_ENUM(ARCH::EM_ARC))
    106  - .value(PY_ENUM(ARCH::EM_H8_300))
    107  - .value(PY_ENUM(ARCH::EM_H8_300H))
    108  - .value(PY_ENUM(ARCH::EM_H8S))
    109  - .value(PY_ENUM(ARCH::EM_H8_500))
    110  - .value(PY_ENUM(ARCH::EM_IA_64))
    111  - .value(PY_ENUM(ARCH::EM_MIPS_X))
    112  - .value(PY_ENUM(ARCH::EM_COLDFIRE))
    113  - .value(PY_ENUM(ARCH::EM_68HC12))
    114  - .value(PY_ENUM(ARCH::EM_MMA))
    115  - .value(PY_ENUM(ARCH::EM_PCP))
    116  - .value(PY_ENUM(ARCH::EM_NCPU))
    117  - .value(PY_ENUM(ARCH::EM_NDR1))
    118  - .value(PY_ENUM(ARCH::EM_STARCORE))
    119  - .value(PY_ENUM(ARCH::EM_ME16))
    120  - .value(PY_ENUM(ARCH::EM_ST100))
    121  - .value(PY_ENUM(ARCH::EM_TINYJ))
    122  - .value(PY_ENUM(ARCH::EM_X86_64))
    123  - .value(PY_ENUM(ARCH::EM_PDSP))
    124  - .value(PY_ENUM(ARCH::EM_PDP10))
    125  - .value(PY_ENUM(ARCH::EM_PDP11))
    126  - .value(PY_ENUM(ARCH::EM_FX66))
    127  - .value(PY_ENUM(ARCH::EM_ST9PLUS))
    128  - .value(PY_ENUM(ARCH::EM_ST7))
    129  - .value(PY_ENUM(ARCH::EM_68HC16))
    130  - .value(PY_ENUM(ARCH::EM_68HC11))
    131  - .value(PY_ENUM(ARCH::EM_68HC08))
    132  - .value(PY_ENUM(ARCH::EM_68HC05))
    133  - .value(PY_ENUM(ARCH::EM_SVX))
    134  - .value(PY_ENUM(ARCH::EM_ST19))
    135  - .value(PY_ENUM(ARCH::EM_VAX))
    136  - .value(PY_ENUM(ARCH::EM_CRIS))
    137  - .value(PY_ENUM(ARCH::EM_JAVELIN))
    138  - .value(PY_ENUM(ARCH::EM_FIREPATH))
    139  - .value(PY_ENUM(ARCH::EM_ZSP))
    140  - .value(PY_ENUM(ARCH::EM_MMIX))
    141  - .value(PY_ENUM(ARCH::EM_HUANY))
    142  - .value(PY_ENUM(ARCH::EM_PRISM))
    143  - .value(PY_ENUM(ARCH::EM_AVR))
    144  - .value(PY_ENUM(ARCH::EM_FR30))
    145  - .value(PY_ENUM(ARCH::EM_D10V))
    146  - .value(PY_ENUM(ARCH::EM_D30V))
    147  - .value(PY_ENUM(ARCH::EM_V850))
    148  - .value(PY_ENUM(ARCH::EM_M32R))
    149  - .value(PY_ENUM(ARCH::EM_MN10300))
    150  - .value(PY_ENUM(ARCH::EM_MN10200))
    151  - .value(PY_ENUM(ARCH::EM_PJ))
    152  - .value(PY_ENUM(ARCH::EM_OPENRISC))
    153  - .value(PY_ENUM(ARCH::EM_ARC_COMPACT))
    154  - .value(PY_ENUM(ARCH::EM_XTENSA))
    155  - .value(PY_ENUM(ARCH::EM_VIDEOCORE))
    156  - .value(PY_ENUM(ARCH::EM_TMM_GPP))
    157  - .value(PY_ENUM(ARCH::EM_NS32K))
    158  - .value(PY_ENUM(ARCH::EM_TPC))
    159  - .value(PY_ENUM(ARCH::EM_SNP1K))
    160  - .value(PY_ENUM(ARCH::EM_ST200))
    161  - .value(PY_ENUM(ARCH::EM_IP2K))
    162  - .value(PY_ENUM(ARCH::EM_MAX))
    163  - .value(PY_ENUM(ARCH::EM_CR))
    164  - .value(PY_ENUM(ARCH::EM_F2MC16))
    165  - .value(PY_ENUM(ARCH::EM_MSP430))
    166  - .value(PY_ENUM(ARCH::EM_BLACKFIN))
    167  - .value(PY_ENUM(ARCH::EM_SE_C33))
    168  - .value(PY_ENUM(ARCH::EM_SEP))
    169  - .value(PY_ENUM(ARCH::EM_ARCA))
    170  - .value(PY_ENUM(ARCH::EM_UNICORE))
    171  - .value(PY_ENUM(ARCH::EM_EXCESS))
    172  - .value(PY_ENUM(ARCH::EM_DXP))
    173  - .value(PY_ENUM(ARCH::EM_ALTERA_NIOS2))
    174  - .value(PY_ENUM(ARCH::EM_CRX))
    175  - .value(PY_ENUM(ARCH::EM_XGATE))
    176  - .value(PY_ENUM(ARCH::EM_C166))
    177  - .value(PY_ENUM(ARCH::EM_M16C))
    178  - .value(PY_ENUM(ARCH::EM_DSPIC30F))
    179  - .value(PY_ENUM(ARCH::EM_CE))
    180  - .value(PY_ENUM(ARCH::EM_M32C))
    181  - .value(PY_ENUM(ARCH::EM_TSK3000))
    182  - .value(PY_ENUM(ARCH::EM_RS08))
    183  - .value(PY_ENUM(ARCH::EM_SHARC))
    184  - .value(PY_ENUM(ARCH::EM_ECOG2))
    185  - .value(PY_ENUM(ARCH::EM_SCORE7))
    186  - .value(PY_ENUM(ARCH::EM_DSP24))
    187  - .value(PY_ENUM(ARCH::EM_VIDEOCORE3))
    188  - .value(PY_ENUM(ARCH::EM_LATTICEMICO32))
    189  - .value(PY_ENUM(ARCH::EM_SE_C17))
    190  - .value(PY_ENUM(ARCH::EM_TI_C6000))
    191  - .value(PY_ENUM(ARCH::EM_TI_C2000))
    192  - .value(PY_ENUM(ARCH::EM_TI_C5500))
    193  - .value(PY_ENUM(ARCH::EM_MMDSP_PLUS))
    194  - .value(PY_ENUM(ARCH::EM_CYPRESS_M8C))
    195  - .value(PY_ENUM(ARCH::EM_R32C))
    196  - .value(PY_ENUM(ARCH::EM_TRIMEDIA))
    197  - .value(PY_ENUM(ARCH::EM_HEXAGON))
    198  - .value(PY_ENUM(ARCH::EM_8051))
    199  - .value(PY_ENUM(ARCH::EM_STXP7X))
    200  - .value(PY_ENUM(ARCH::EM_NDS32))
    201  - .value("ECOG1", ARCH::EM_ECOG1)
    202  - .value("ECOG1X", ARCH::EM_ECOG1X)
    203  - .value(PY_ENUM(ARCH::EM_MAXQ30))
    204  - .value(PY_ENUM(ARCH::EM_XIMO16))
    205  - .value(PY_ENUM(ARCH::EM_MANIK))
    206  - .value(PY_ENUM(ARCH::EM_CRAYNV2))
    207  - .value(PY_ENUM(ARCH::EM_RX))
    208  - .value(PY_ENUM(ARCH::EM_METAG))
    209  - .value(PY_ENUM(ARCH::EM_MCST_ELBRUS))
    210  - .value(PY_ENUM(ARCH::EM_ECOG16))
    211  - .value(PY_ENUM(ARCH::EM_CR16))
    212  - .value(PY_ENUM(ARCH::EM_ETPU))
    213  - .value(PY_ENUM(ARCH::EM_SLE9X))
    214  - .value(PY_ENUM(ARCH::EM_L10M))
    215  - .value(PY_ENUM(ARCH::EM_K10M))
    216  - .value(PY_ENUM(ARCH::EM_AARCH64))
    217  - .value(PY_ENUM(ARCH::EM_AVR32))
    218  - .value(PY_ENUM(ARCH::EM_STM8))
    219  - .value(PY_ENUM(ARCH::EM_TILE64))
    220  - .value(PY_ENUM(ARCH::EM_TILEPRO))
    221  - .value(PY_ENUM(ARCH::EM_CUDA))
    222  - .value(PY_ENUM(ARCH::EM_TILEGX))
    223  - .value(PY_ENUM(ARCH::EM_CLOUDSHIELD))
    224  - .value(PY_ENUM(ARCH::EM_COREA_1ST))
    225  - .value(PY_ENUM(ARCH::EM_COREA_2ND))
    226  - .value(PY_ENUM(ARCH::EM_ARC_COMPACT2))
    227  - .value(PY_ENUM(ARCH::EM_OPEN8))
    228  - .value(PY_ENUM(ARCH::EM_RL78))
    229  - .value(PY_ENUM(ARCH::EM_VIDEOCORE5))
    230  - .value(PY_ENUM(ARCH::EM_78KOR))
    231  - .value(PY_ENUM(ARCH::EM_56800EX))
    232  - .value(PY_ENUM(ARCH::EM_BA1))
    233  - .value(PY_ENUM(ARCH::EM_BA2))
    234  - .value(PY_ENUM(ARCH::EM_XCORE))
    235  - .value(PY_ENUM(ARCH::EM_MCHP_PIC))
    236  - .value(PY_ENUM(ARCH::EM_INTEL205))
    237  - .value(PY_ENUM(ARCH::EM_INTEL206))
    238  - .value(PY_ENUM(ARCH::EM_INTEL207))
    239  - .value(PY_ENUM(ARCH::EM_INTEL208))
    240  - .value(PY_ENUM(ARCH::EM_INTEL209))
    241  - .value(PY_ENUM(ARCH::EM_KM32))
    242  - .value(PY_ENUM(ARCH::EM_KMX32))
    243  - .value(PY_ENUM(ARCH::EM_KMX16))
    244  - .value(PY_ENUM(ARCH::EM_KMX8))
    245  - .value(PY_ENUM(ARCH::EM_KVARC))
    246  - .value(PY_ENUM(ARCH::EM_CDP))
    247  - .value(PY_ENUM(ARCH::EM_COGE))
    248  - .value(PY_ENUM(ARCH::EM_COOL))
    249  - .value(PY_ENUM(ARCH::EM_NORC))
    250  - .value(PY_ENUM(ARCH::EM_CSR_KALIMBA))
    251  - .value(PY_ENUM(ARCH::EM_AMDGPU))
    252  - .value(PY_ENUM(ARCH::EM_RISCV))
    253  - .value(PY_ENUM(ARCH::EM_BPF))
    254  - .value(PY_ENUM(ARCH::EM_LOONGARCH));
    255  - 
    256  - 
    257  - //! Enum for the *sh_type* of ElfXX_Shdr;
    258  - enum_<ELF_SECTION_TYPES>(m, "SECTION_TYPES")
    259  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NULL))
    260  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_PROGBITS))
    261  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SYMTAB))
    262  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_STRTAB))
    263  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_RELA))
    264  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HASH))
    265  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_DYNAMIC))
    266  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NOTE))
    267  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_NOBITS))
    268  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_REL))
    269  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SHLIB))
    270  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_DYNSYM))
    271  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_INIT_ARRAY))
    272  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_FINI_ARRAY))
    273  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_PREINIT_ARRAY))
    274  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GROUP))
    275  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_SYMTAB_SHNDX))
    276  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LOOS))
    277  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_ATTRIBUTES))
    278  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_HASH))
    279  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_verdef))
    280  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_verneed))
    281  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_GNU_versym))
    282  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ANDROID_REL))
    283  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ANDROID_RELA))
    284  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LLVM_ADDRSIG))
    285  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_RELR))
    286  - 
    287  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_EXIDX))
    288  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_PREEMPTMAP))
    289  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_ATTRIBUTES))
    290  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_DEBUGOVERLAY))
    291  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_ARM_OVERLAYSECTION))
    292  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HEX_ORDERED))
    293  - .value("X86_64_UNWIND", ELF_SECTION_TYPES::SHT_X86_64_UNWIND)
    294  - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_REGINFO))
    295  - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_OPTIONS))
    296  - //.value(PY_ENUM(ELF_SECTION_TYPES::SHT_MIPS_ABIFLAGS))
    297  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HIPROC))
    298  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_LOUSER))
    299  - .value(PY_ENUM(ELF_SECTION_TYPES::SHT_HIUSER));
    300  - 
    301  - 
    302  - //! Enum for the *sh_flags* field of ElfXX_Shdr;
    303  - enum_<ELF_SECTION_FLAGS>(m, "SECTION_FLAGS", nb::is_arithmetic())
    304  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_NONE))
    305  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_WRITE))
    306  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_ALLOC))
    307  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_EXECINSTR))
    308  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MERGE))
    309  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_STRINGS))
    310  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_INFO_LINK))
    311  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_LINK_ORDER))
    312  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_OS_NONCONFORMING))
    313  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_GROUP))
    314  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_TLS))
    315  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_EXCLUDE))
    316  - .value("SHF_CP_SECTION", ELF_SECTION_FLAGS::XCORE_SHF_CP_SECTION)
    317  - .value(PY_ENUM(ELF_SECTION_FLAGS::XCORE_SHF_DP_SECTION))
    318  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MASKOS))
    319  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_MASKPROC))
    320  - .value(PY_ENUM(ELF_SECTION_FLAGS::SHF_HEX_GPREL));
    321  - 
    322  - //! Enum for the *p_type* field of ElfXX_Phdr
    323  - enum_<SEGMENT_TYPES>(m, "SEGMENT_TYPES")
    324  - .value(PY_ENUM(SEGMENT_TYPES::PT_NULL))
    325  - .value(PY_ENUM(SEGMENT_TYPES::PT_LOAD))
    326  - .value(PY_ENUM(SEGMENT_TYPES::PT_DYNAMIC))
    327  - .value(PY_ENUM(SEGMENT_TYPES::PT_INTERP))
    328  - .value(PY_ENUM(SEGMENT_TYPES::PT_NOTE))
    329  - .value(PY_ENUM(SEGMENT_TYPES::PT_SHLIB))
    330  - .value(PY_ENUM(SEGMENT_TYPES::PT_PHDR))
    331  - .value(PY_ENUM(SEGMENT_TYPES::PT_TLS))
    332  - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_EH_FRAME))
    333  - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_PROPERTY))
    334  - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_STACK))
    335  - .value(PY_ENUM(SEGMENT_TYPES::PT_GNU_RELRO))
    336  - .value(PY_ENUM(SEGMENT_TYPES::PT_ARM_ARCHEXT))
    337  - .value(PY_ENUM(SEGMENT_TYPES::PT_ARM_EXIDX))
    338  - .value("UNWIND", SEGMENT_TYPES::PT_ARM_UNWIND);
    339  - 
    340  - //! Enum for the *p_flags* field of ElfXX_Phdr
    341  - enum_<ELF_SEGMENT_FLAGS>(m, "SEGMENT_FLAGS", nb::is_arithmetic())
    342  - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_NONE))
    343  - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_X))
    344  - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_W))
    345  - .value(PY_ENUM(ELF_SEGMENT_FLAGS::PF_R));
    346  - 
    347  - enum_<DYNAMIC_TAGS>(m, "DYNAMIC_TAGS")
    348  - .value(PY_ENUM(DYNAMIC_TAGS::DT_NULL))
    349  - .value(PY_ENUM(DYNAMIC_TAGS::DT_NEEDED))
    350  - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTRELSZ))
    351  - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTGOT))
    352  - .value(PY_ENUM(DYNAMIC_TAGS::DT_HASH))
    353  - .value(PY_ENUM(DYNAMIC_TAGS::DT_STRTAB))
    354  - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMTAB))
    355  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELA))
    356  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELASZ))
    357  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELAENT))
    358  - .value(PY_ENUM(DYNAMIC_TAGS::DT_STRSZ))
    359  - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMENT))
    360  - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT))
    361  - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI))
    362  - .value(PY_ENUM(DYNAMIC_TAGS::DT_SONAME))
    363  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RPATH))
    364  - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMBOLIC))
    365  - .value(PY_ENUM(DYNAMIC_TAGS::DT_REL))
    366  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELSZ))
    367  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELENT))
    368  - .value(PY_ENUM(DYNAMIC_TAGS::DT_PLTREL))
    369  - .value(PY_ENUM(DYNAMIC_TAGS::DT_DEBUG))
    370  - .value(PY_ENUM(DYNAMIC_TAGS::DT_TEXTREL))
    371  - .value(PY_ENUM(DYNAMIC_TAGS::DT_JMPREL))
    372  - .value(PY_ENUM(DYNAMIC_TAGS::DT_BIND_NOW))
    373  - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT_ARRAY))
    374  - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI_ARRAY))
    375  - .value(PY_ENUM(DYNAMIC_TAGS::DT_INIT_ARRAYSZ))
    376  - .value(PY_ENUM(DYNAMIC_TAGS::DT_FINI_ARRAYSZ))
    377  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RUNPATH))
    378  - .value(PY_ENUM(DYNAMIC_TAGS::DT_FLAGS))
    379  - .value(PY_ENUM(DYNAMIC_TAGS::DT_PREINIT_ARRAY))
    380  - .value(PY_ENUM(DYNAMIC_TAGS::DT_PREINIT_ARRAYSZ))
    381  - .value(PY_ENUM(DYNAMIC_TAGS::DT_GNU_HASH))
    382  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELACOUNT))
    383  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELCOUNT))
    384  - .value(PY_ENUM(DYNAMIC_TAGS::DT_FLAGS_1))
    385  - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERSYM))
    386  - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERDEF))
    387  - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERDEFNUM))
    388  - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERNEED))
    389  - .value(PY_ENUM(DYNAMIC_TAGS::DT_VERNEEDNUM))
    390  - .value(PY_ENUM(DYNAMIC_TAGS::DT_SYMTAB_SHNDX))
    391  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELRSZ))
    392  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELR))
    393  - .value(PY_ENUM(DYNAMIC_TAGS::DT_RELRENT))
    394  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_VERSION))
    395  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_TIME_STAMP))
    396  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_ICHECKSUM))
    397  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_IVERSION))
    398  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_FLAGS))
    399  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_BASE_ADDRESS))
    400  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_MSYM))
    401  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CONFLICT))
    402  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LIBLIST))
    403  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCAL_GOTNO))
    404  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CONFLICTNO))
    405  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LIBLISTNO))
    406  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_SYMTABNO))
    407  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_UNREFEXTNO))
    408  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_GOTSYM))
    409  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_HIPAGENO))
    410  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_MAP))
    411  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASS))
    412  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASS_NO))
    413  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_INSTANCE))
    414  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_INSTANCE_NO))
    415  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_RELOC))
    416  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_RELOC_NO))
    417  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_SYM))
    418  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_SYM_NO))
    419  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASSSYM))
    420  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DELTA_CLASSSYM_NO))
    421  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_CXX_FLAGS))
    422  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PIXIE_INIT))
    423  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_SYMBOL_LIB))
    424  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCALPAGE_GOTIDX))
    425  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_LOCAL_GOTIDX))
    426  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_HIDDEN_GOTIDX))
    427  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PROTECTED_GOTIDX))
    428  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_OPTIONS))
    429  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_INTERFACE))
    430  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_DYNSTR_ALIGN))
    431  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_INTERFACE_SIZE))
    432  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RLD_TEXT_RESOLVE_ADDR))
    433  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PERF_SUFFIX))
    434  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_COMPACT_SIZE))
    435  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_GP_VALUE))
    436  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_AUX_DYNAMIC))
    437  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_PLTGOT))
    438  - .value(PY_ENUM(DYNAMIC_TAGS::DT_MIPS_RWPLT))
    439  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL_OFFSET))
    440  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL_SIZE))
    441  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_REL))
    442  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELSZ))
    443  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELA))
    444  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELASZ))
    445  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELR))
    446  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELRSZ))
    447  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELRENT))
    448  - .value(PY_ENUM(DYNAMIC_TAGS::DT_ANDROID_RELRCOUNT));
    449  - 
    450  - 
    451  - enum_<ELF_SYMBOL_TYPES>(m, "SYMBOL_TYPES")
    452  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_NOTYPE))
    453  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_OBJECT))
    454  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_FUNC))
    455  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_SECTION))
    456  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_FILE))
    457  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_COMMON))
    458  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_TLS))
    459  - .value(PY_ENUM(ELF_SYMBOL_TYPES::STT_GNU_IFUNC));
    460  - 
    461  - 
    462  - enum_<SYMBOL_BINDINGS>(m, "SYMBOL_BINDINGS")
    463  - .value(PY_ENUM(SYMBOL_BINDINGS::STB_LOCAL))
    464  - .value(PY_ENUM(SYMBOL_BINDINGS::STB_GLOBAL))
    465  - .value(PY_ENUM(SYMBOL_BINDINGS::STB_WEAK))
    466  - .value(PY_ENUM(SYMBOL_BINDINGS::STB_GNU_UNIQUE));
    467  - 
    468  - 
    469  - enum_<RELOC_x86_64>(m, "RELOCATION_X86_64")
    470  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_NONE))
    471  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_64))
    472  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC32))
    473  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOT32))
    474  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLT32))
    475  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_COPY))
    476  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GLOB_DAT))
    477  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_JUMP_SLOT))
    478  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_RELATIVE))
    479  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCREL))
    480  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_32))
    481  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_32S))
    482  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_16))
    483  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC16))
    484  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_8))
    485  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC8))
    486  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPMOD64))
    487  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPOFF64))
    488  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TPOFF64))
    489  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSGD))
    490  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSLD))
    491  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_DTPOFF32))
    492  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTTPOFF))
    493  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TPOFF32))
    494  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC64))
    495  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTOFF64))
    496  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC32))
    497  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOT64))
    498  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCREL64))
    499  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC64))
    500  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPLT64))
    501  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLTOFF64))
    502  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_SIZE32))
    503  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_SIZE64))
    504  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPC32_TLSDESC))
    505  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSDESC_CALL))
    506  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_TLSDESC))
    507  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_IRELATIVE))
    508  - 
    509  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_RELATIVE64))
    510  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PC32_BND))
    511  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_PLT32_BND))
    512  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_GOTPCRELX))
    513  - .value(PY_ENUM(RELOC_x86_64::R_X86_64_REX_GOTPCRELX));
    514  - 
    515  - 
    516  - enum_<RELOC_ARM>(m, "RELOCATION_ARM")
    517  - .value(PY_ENUM(RELOC_ARM::R_ARM_NONE))
    518  - .value(PY_ENUM(RELOC_ARM::R_ARM_PC24))
    519  - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS32))
    520  - .value(PY_ENUM(RELOC_ARM::R_ARM_REL32))
    521  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G0))
    522  - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS16))
    523  - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS12))
    524  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_ABS5))
    525  - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS8))
    526  - .value(PY_ENUM(RELOC_ARM::R_ARM_SBREL32))
    527  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_CALL))
    528  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_PC8))
    529  - .value(PY_ENUM(RELOC_ARM::R_ARM_BREL_ADJ))
    530  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DESC))
    531  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_SWI8))
    532  - .value(PY_ENUM(RELOC_ARM::R_ARM_XPC25))
    533  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_XPC22))
    534  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DTPMOD32))
    535  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DTPOFF32))
    536  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_TPOFF32))
    537  - .value(PY_ENUM(RELOC_ARM::R_ARM_COPY))
    538  - .value(PY_ENUM(RELOC_ARM::R_ARM_GLOB_DAT))
    539  - .value(PY_ENUM(RELOC_ARM::R_ARM_JUMP_SLOT))
    540  - .value(PY_ENUM(RELOC_ARM::R_ARM_RELATIVE))
    541  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTOFF32))
    542  - .value(PY_ENUM(RELOC_ARM::R_ARM_BASE_PREL))
    543  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_BREL))
    544  - .value(PY_ENUM(RELOC_ARM::R_ARM_PLT32))
    545  - .value(PY_ENUM(RELOC_ARM::R_ARM_CALL))
    546  - .value(PY_ENUM(RELOC_ARM::R_ARM_JUMP24))
    547  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP24))
    548  - .value(PY_ENUM(RELOC_ARM::R_ARM_BASE_ABS))
    549  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_7_0))
    550  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_15_8))
    551  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PCREL_23_15))
    552  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SBREL_11_0_NC))
    553  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SBREL_19_12_NC))
    554  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SBREL_27_20_CK))
    555  - .value(PY_ENUM(RELOC_ARM::R_ARM_TARGET1))
    556  - .value(PY_ENUM(RELOC_ARM::R_ARM_SBREL31))
    557  - .value(PY_ENUM(RELOC_ARM::R_ARM_V4BX))
    558  - .value(PY_ENUM(RELOC_ARM::R_ARM_TARGET2))
    559  - .value(PY_ENUM(RELOC_ARM::R_ARM_PREL31))
    560  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_ABS_NC))
    561  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_ABS))
    562  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_PREL_NC))
    563  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_PREL))
    564  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_ABS_NC))
    565  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_ABS))
    566  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_PREL_NC))
    567  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_PREL))
    568  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP19))
    569  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP6))
    570  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_ALU_PREL_11_0))
    571  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_PC12))
    572  - .value(PY_ENUM(RELOC_ARM::R_ARM_ABS32_NOI))
    573  - .value(PY_ENUM(RELOC_ARM::R_ARM_REL32_NOI))
    574  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G0_NC))
    575  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G0))
    576  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G1_NC))
    577  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G1))
    578  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_PC_G2))
    579  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G1))
    580  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_PC_G2))
    581  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G0))
    582  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G1))
    583  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_PC_G2))
    584  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G0))
    585  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G1))
    586  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_PC_G2))
    587  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G0_NC))
    588  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G0))
    589  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G1_NC))
    590  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G1))
    591  - .value(PY_ENUM(RELOC_ARM::R_ARM_ALU_SB_G2))
    592  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G0))
    593  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G1))
    594  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDR_SB_G2))
    595  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G0))
    596  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G1))
    597  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDRS_SB_G2))
    598  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G0))
    599  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G1))
    600  - .value(PY_ENUM(RELOC_ARM::R_ARM_LDC_SB_G2))
    601  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_BREL_NC))
    602  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVT_BREL))
    603  - .value(PY_ENUM(RELOC_ARM::R_ARM_MOVW_BREL))
    604  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_BREL_NC))
    605  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVT_BREL))
    606  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_MOVW_BREL))
    607  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_GOTDESC))
    608  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_CALL))
    609  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_DESCSEQ))
    610  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_CALL))
    611  - .value(PY_ENUM(RELOC_ARM::R_ARM_PLT32_ABS))
    612  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_ABS))
    613  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_PREL))
    614  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOT_BREL12))
    615  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTOFF12))
    616  - .value(PY_ENUM(RELOC_ARM::R_ARM_GOTRELAX))
    617  - .value(PY_ENUM(RELOC_ARM::R_ARM_GNU_VTENTRY))
    618  - .value(PY_ENUM(RELOC_ARM::R_ARM_GNU_VTINHERIT))
    619  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP11))
    620  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_JUMP8))
    621  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_GD32))
    622  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDM32))
    623  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDO32))
    624  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_IE32))
    625  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LE32))
    626  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LDO12))
    627  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_LE12))
    628  - .value(PY_ENUM(RELOC_ARM::R_ARM_TLS_IE12GP))
    629  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_0))
    630  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_1))
    631  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_2))
    632  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_3))
    633  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_4))
    634  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_5))
    635  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_6))
    636  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_7))
    637  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_8))
    638  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_9))
    639  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_10))
    640  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_11))
    641  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_12))
    642  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_13))
    643  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_14))
    644  - .value(PY_ENUM(RELOC_ARM::R_ARM_PRIVATE_15))
    645  - .value(PY_ENUM(RELOC_ARM::R_ARM_ME_TOO))
    646  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_DESCSEQ16))
    647  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_TLS_DESCSEQ32))
    648  - .value(PY_ENUM(RELOC_ARM::R_ARM_IRELATIVE))
    649  - .value(PY_ENUM(RELOC_ARM::R_ARM_RXPC25))
    650  - .value(PY_ENUM(RELOC_ARM::R_ARM_RSBREL32))
    651  - .value(PY_ENUM(RELOC_ARM::R_ARM_THM_RPC22))
    652  - .value(PY_ENUM(RELOC_ARM::R_ARM_RREL32))
    653  - .value(PY_ENUM(RELOC_ARM::R_ARM_RPC24))
    654  - .value(PY_ENUM(RELOC_ARM::R_ARM_RBASE));
    655  - 
    656  - 
    657  - enum_<RELOC_i386>(m, "RELOCATION_i386")
    658  - .value(PY_ENUM(RELOC_i386::R_386_NONE))
    659  - .value(PY_ENUM(RELOC_i386::R_386_32))
    660  - .value(PY_ENUM(RELOC_i386::R_386_PC32))
    661  - .value(PY_ENUM(RELOC_i386::R_386_GOT32))
    662  - .value(PY_ENUM(RELOC_i386::R_386_PLT32))
    663  - .value(PY_ENUM(RELOC_i386::R_386_COPY))
    664  - .value(PY_ENUM(RELOC_i386::R_386_GLOB_DAT))
    665  - .value(PY_ENUM(RELOC_i386::R_386_JUMP_SLOT))
    666  - .value(PY_ENUM(RELOC_i386::R_386_RELATIVE))
    667  - .value(PY_ENUM(RELOC_i386::R_386_GOTOFF))
    668  - .value(PY_ENUM(RELOC_i386::R_386_GOTPC))
    669  - .value(PY_ENUM(RELOC_i386::R_386_32PLT))
    670  - .value(PY_ENUM(RELOC_i386::R_386_TLS_TPOFF))
    671  - .value(PY_ENUM(RELOC_i386::R_386_TLS_IE))
    672  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GOTIE))
    673  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LE))
    674  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD))
    675  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM))
    676  - .value(PY_ENUM(RELOC_i386::R_386_16))
    677  - .value(PY_ENUM(RELOC_i386::R_386_PC16))
    678  - .value(PY_ENUM(RELOC_i386::R_386_8))
    679  - .value(PY_ENUM(RELOC_i386::R_386_PC8))
    680  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_32))
    681  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_PUSH))
    682  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_CALL))
    683  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GD_POP))
    684  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_32))
    685  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_PUSH))
    686  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_CALL))
    687  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDM_POP))
    688  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LDO_32))
    689  - .value(PY_ENUM(RELOC_i386::R_386_TLS_IE_32))
    690  - .value(PY_ENUM(RELOC_i386::R_386_TLS_LE_32))
    691  - .value(PY_ENUM(RELOC_i386::R_386_TLS_DTPMOD32))
    692  - .value(PY_ENUM(RELOC_i386::R_386_TLS_DTPOFF32))
    693  - .value(PY_ENUM(RELOC_i386::R_386_TLS_TPOFF32))
    694  - .value(PY_ENUM(RELOC_i386::R_386_TLS_GOTDESC))
    695  - .value(PY_ENUM(RELOC_i386::R_386_TLS_DESC_CALL))
    696  - .value(PY_ENUM(RELOC_i386::R_386_TLS_DESC))
    697  - .value(PY_ENUM(RELOC_i386::R_386_IRELATIVE))
    698  - .value(PY_ENUM(RELOC_i386::R_386_NUM));
    699  - 
    700  - 
    701  - enum_<RELOC_AARCH64>(m, "RELOCATION_AARCH64")
    702  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_NONE))
    703  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS64))
    704  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS32))
    705  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ABS16))
    706  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL64))
    707  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL32))
    708  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_PREL16))
    709  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G0))
    710  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G0_NC))
    711  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G1))
    712  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G1_NC))
    713  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G2))
    714  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G2_NC))
    715  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_UABS_G3))
    716  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G0))
    717  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G1))
    718  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_SABS_G2))
    719  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD_PREL_LO19))
    720  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_LO21))
    721  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_PG_HI21))
    722  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_PREL_PG_HI21_NC))
    723  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADD_ABS_LO12_NC))
    724  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST8_ABS_LO12_NC))
    725  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TSTBR14))
    726  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_CONDBR19))
    727  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_JUMP26))
    728  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_CALL26))
    729  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST16_ABS_LO12_NC))
    730  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST32_ABS_LO12_NC))
    731  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST64_ABS_LO12_NC))
    732  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G0))
    733  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G0_NC))
    734  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G1))
    735  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G1_NC))
    736  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G2))
    737  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G2_NC))
    738  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_PREL_G3))
    739  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LDST128_ABS_LO12_NC))
    740  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G0))
    741  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G0_NC))
    742  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G1))
    743  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G1_NC))
    744  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G2))
    745  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G2_NC))
    746  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_MOVW_GOTOFF_G3))
    747  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOTREL64))
    748  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOTREL32))
    749  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GOT_LD_PREL19))
    750  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOTOFF_LO15))
    751  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_ADR_GOT_PAGE))
    752  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOT_LO12_NC))
    753  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_LD64_GOTPAGE_LO15))
    754  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADR_PREL21))
    755  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADR_PAGE21))
    756  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_ADD_LO12_NC))
    757  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_MOVW_G1))
    758  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSGD_MOVW_G0_NC))
    759  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADR_PREL21))
    760  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADR_PAGE21))
    761  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_LO12_NC))
    762  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_G1))
    763  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_G0_NC))
    764  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LD_PREL19))
    765  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G2))
    766  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G1))
    767  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC))
    768  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G0))
    769  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC))
    770  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_HI12))
    771  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_LO12))
    772  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC))
    773  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST8_DTPREL_LO12))
    774  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC))
    775  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST16_DTPREL_LO12))
    776  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC))
    777  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST32_DTPREL_LO12))
    778  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC))
    779  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST64_DTPREL_LO12))
    780  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC))
    781  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_MOVW_GOTTPREL_G1))
    782  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC))
    783  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21))
    784  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC))
    785  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSIE_LD_GOTTPREL_PREL19))
    786  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G2))
    787  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G1))
    788  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC))
    789  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G0))
    790  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC))
    791  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_HI12))
    792  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_LO12))
    793  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC))
    794  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST8_TPREL_LO12))
    795  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC))
    796  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST16_TPREL_LO12))
    797  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC))
    798  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST32_TPREL_LO12))
    799  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC))
    800  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST64_TPREL_LO12))
    801  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC))
    802  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LD_PREL19))
    803  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADR_PREL21))
    804  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADR_PAGE21))
    805  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LD64_LO12_NC))
    806  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADD_LO12_NC))
    807  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_OFF_G1))
    808  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_OFF_G0_NC))
    809  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_LDR))
    810  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_ADD))
    811  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC_CALL))
    812  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST128_TPREL_LO12))
    813  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC))
    814  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST128_DTPREL_LO12))
    815  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC))
    816  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_COPY))
    817  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_GLOB_DAT))
    818  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_JUMP_SLOT))
    819  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_RELATIVE))
    820  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_DTPREL64))
    821  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_DTPMOD64))
    822  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLS_TPREL64))
    823  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_TLSDESC))
    824  - .value(PY_ENUM(RELOC_AARCH64::R_AARCH64_IRELATIVE));
    825  - 
    826  - enum_<RELOC_POWERPC32>(m, "RELOCATION_PPC")
    827  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_NONE))
    828  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR32))
    829  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR24))
    830  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16))
    831  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_LO))
    832  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_HI))
    833  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR16_HA))
    834  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14))
    835  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14_BRTAKEN))
    836  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_ADDR14_BRNTAKEN))
    837  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL24))
    838  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14))
    839  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14_BRTAKEN))
    840  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL14_BRNTAKEN))
    841  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16))
    842  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_LO))
    843  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_HI))
    844  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT16_HA))
    845  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_PLTREL24))
    846  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_JMP_SLOT))
    847  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_RELATIVE))
    848  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_LOCAL24PC))
    849  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL32))
    850  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLS))
    851  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPMOD32))
    852  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16))
    853  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_LO))
    854  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_HI))
    855  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL16_HA))
    856  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TPREL32))
    857  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16))
    858  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_LO))
    859  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_HI))
    860  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL16_HA))
    861  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_DTPREL32))
    862  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16))
    863  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_LO))
    864  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_HI))
    865  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSGD16_HA))
    866  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16))
    867  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_LO))
    868  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_HI))
    869  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TLSLD16_HA))
    870  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16))
    871  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_LO))
    872  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_HI))
    873  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_TPREL16_HA))
    874  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16))
    875  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_LO))
    876  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_HI))
    877  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_GOT_DTPREL16_HA))
    878  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLSGD))
    879  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_TLSLD))
    880  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16))
    881  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_LO))
    882  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_HI))
    883  - .value(PY_ENUM(RELOC_POWERPC32::R_PPC_REL16_HA));
    884  - 
    885  - enum_<RELOC_POWERPC64>(m, "RELOCATION_PPC64")
    886  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_NONE))
    887  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR32))
    888  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR24))
    889  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16))
    890  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_LO))
    891  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HI))
    892  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HA))
    893  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14))
    894  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14_BRTAKEN))
    895  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR14_BRNTAKEN))
    896  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL24))
    897  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14))
    898  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14_BRTAKEN))
    899  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL14_BRNTAKEN))
    900  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16))
    901  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_LO))
    902  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_HI))
    903  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_HA))
    904  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_JMP_SLOT))
    905  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_RELATIVE))
    906  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL32))
    907  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR64))
    908  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHER))
    909  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHERA))
    910  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHEST))
    911  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_HIGHESTA))
    912  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL64))
    913  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16))
    914  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_LO))
    915  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_HI))
    916  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_HA))
    917  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC))
    918  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_DS))
    919  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_ADDR16_LO_DS))
    920  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_DS))
    921  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT16_LO_DS))
    922  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_DS))
    923  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TOC16_LO_DS))
    924  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLS))
    925  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPMOD64))
    926  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16))
    927  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_LO))
    928  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HI))
    929  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HA))
    930  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL64))
    931  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16))
    932  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_LO))
    933  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HI))
    934  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HA))
    935  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL64))
    936  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16))
    937  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_LO))
    938  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_HI))
    939  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSGD16_HA))
    940  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16))
    941  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_LO))
    942  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_HI))
    943  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TLSLD16_HA))
    944  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_DS))
    945  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_LO_DS))
    946  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_HI))
    947  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_TPREL16_HA))
    948  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_DS))
    949  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_LO_DS))
    950  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_HI))
    951  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_GOT_DTPREL16_HA))
    952  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_DS))
    953  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_LO_DS))
    954  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHER))
    955  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHERA))
    956  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHEST))
    957  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TPREL16_HIGHESTA))
    958  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_DS))
    959  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_LO_DS))
    960  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHER))
    961  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHERA))
    962  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHEST))
    963  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_DTPREL16_HIGHESTA))
    964  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLSGD))
    965  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_TLSLD))
    966  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16))
    967  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_LO))
    968  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_HI))
    969  - .value(PY_ENUM(RELOC_POWERPC64::R_PPC64_REL16_HA));
    970  - 
    971  - enum_<RELOC_MIPS>(m, "RELOCATION_MIPS")
    972  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_NONE))
    973  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_16))
    974  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_32))
    975  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_REL32))
    976  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_26))
    977  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HI16))
    978  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_LO16))
    979  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GPREL16))
    980  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_LITERAL))
    981  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT16))
    982  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC16))
    983  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL16))
    984  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GPREL32))
    985  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED1))
    986  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED2))
    987  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_UNUSED3))
    988  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SHIFT5))
    989  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SHIFT6))
    990  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_64))
    991  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_DISP))
    992  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_PAGE))
    993  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_OFST))
    994  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_HI16))
    995  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GOT_LO16))
    996  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SUB))
    997  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_INSERT_A))
    998  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_INSERT_B))
    999  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_DELETE))
    1000  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HIGHER))
    1001  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_HIGHEST))
    1002  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL_HI16))
    1003  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_CALL_LO16))
    1004  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_SCN_DISP))
    1005  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_REL16))
    1006  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_ADD_IMMEDIATE))
    1007  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PJUMP))
    1008  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_RELGOT))
    1009  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_JALR))
    1010  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPMOD32))
    1011  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL32))
    1012  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPMOD64))
    1013  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL64))
    1014  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_GD))
    1015  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_LDM))
    1016  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL_HI16))
    1017  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_DTPREL_LO16))
    1018  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_GOTTPREL))
    1019  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL32))
    1020  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL64))
    1021  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL_HI16))
    1022  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_TLS_TPREL_LO16))
    1023  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_GLOB_DAT))
    1024  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC21_S2))
    1025  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC26_S2))
    1026  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC18_S3))
    1027  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PC19_S2))
    1028  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PCHI16))
    1029  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_PCLO16))
    1030  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_26))
    1031  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_GPREL))
    1032  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_GOT16))
    1033  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_CALL16))
    1034  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_HI16))
    1035  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_LO16))
    1036  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_GD))
    1037  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_LDM))
    1038  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_DTPREL_HI16))
    1039  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_DTPREL_LO16))
    1040  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_GOTTPREL))
    1041  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_TPREL_HI16))
    1042  - .value(PY_ENUM(RELOC_MIPS::R_MIPS16_TLS_TPREL_LO16))
    1043  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_COPY))
    1044  - .value(PY_ENUM(RELOC_MIPS::R_MIPS_JUMP_SLOT))
    1045  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_26_S1))
    1046  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HI16))
    1047  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_LO16))
    1048  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GPREL16))
    1049  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_LITERAL))
    1050  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT16))
    1051  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC7_S1))
    1052  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC10_S1))
    1053  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC16_S1))
    1054  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL16))
    1055  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_DISP))
    1056  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_PAGE))
    1057  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_OFST))
    1058  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_HI16))
    1059  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GOT_LO16))
    1060  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_SUB))
    1061  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HIGHER))
    1062  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HIGHEST))
    1063  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL_HI16))
    1064  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_CALL_LO16))
    1065  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_SCN_DISP))
    1066  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_JALR))
    1067  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_HI0_LO16))
    1068  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_GD))
    1069  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_LDM))
    1070  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_DTPREL_HI16))
    1071  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_DTPREL_LO16))
    1072  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_GOTTPREL))
    1073  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_TPREL_HI16))
    1074  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_TLS_TPREL_LO16))
    1075  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_GPREL7_S2))
    1076  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC23_S2))
    1077  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC21_S2))
    1078  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC26_S2))
    1079  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC18_S3))
    1080  - .value(PY_ENUM(RELOC_MIPS::R_MICROMIPS_PC19_S2));
    1081  - 
    1082  - enum_<RELOC_LOONGARCH>(m, "RELOCATION_LOONGARCH")
    1083  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_NONE))
    1084  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_32))
    1085  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_64))
    1086  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_RELATIVE))
    1087  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_COPY))
    1088  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_JUMP_SLOT))
    1089  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_DTPMOD32))
    1090  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_DTPMOD64))
    1091  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_DTPREL32))
    1092  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_DTPREL64))
    1093  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_TPREL32))
    1094  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_TPREL64))
    1095  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_IRELATIVE))
    1096  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_MARK_LA))
    1097  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_MARK_PCREL))
    1098  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_PCREL))
    1099  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_ABSOLUTE))
    1100  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_DUP))
    1101  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_GPREL))
    1102  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_TLS_TPREL))
    1103  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_TLS_GOT))
    1104  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_TLS_GD))
    1105  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_PUSH_PLT_PCREL))
    1106  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_ASSERT))
    1107  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_NOT))
    1108  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_SUB))
    1109  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_SL))
    1110  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_SR))
    1111  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_ADD))
    1112  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_AND))
    1113  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_IF_ELSE))
    1114  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_10_5))
    1115  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_U_10_12))
    1116  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_10_12))
    1117  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_10_16))
    1118  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_10_16_S2))
    1119  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_5_20))
    1120  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_0_5_10_16_S2))
    1121  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_S_0_10_10_16_S2))
    1122  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SOP_POP_32_U))
    1123  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ADD8))
    1124  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ADD16))
    1125  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ADD24))
    1126  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ADD32))
    1127  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ADD64))
    1128  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SUB8))
    1129  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SUB16))
    1130  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SUB24))
    1131  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SUB32))
    1132  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_SUB64))
    1133  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GNU_VTINHERIT))
    1134  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GNU_VTENTRY))
    1135  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_B16))
    1136  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_B21))
    1137  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_B26))
    1138  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ABS_HI20))
    1139  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ABS_LO12))
    1140  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ABS64_LO20))
    1141  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_ABS64_HI12))
    1142  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_PCALA_HI20))
    1143  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_PCALA_LO12))
    1144  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_PCALA64_LO20))
    1145  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_PCALA64_HI12))
    1146  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT_PC_HI20))
    1147  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT_PC_LO12))
    1148  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT64_PC_LO20))
    1149  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT64_PC_HI12))
    1150  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT_HI20))
    1151  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT_LO12))
    1152  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT64_LO20))
    1153  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_GOT64_HI12))
    1154  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LE_HI20))
    1155  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LE_LO12))
    1156  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LE64_LO20))
    1157  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LE64_HI12))
    1158  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE_PC_HI20))
    1159  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE_PC_LO12))
    1160  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE64_PC_LO20))
    1161  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE64_PC_HI12))
    1162  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE_HI20))
    1163  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE_LO12))
    1164  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE64_LO20))
    1165  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_IE64_HI12))
    1166  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LD_PC_HI20))
    1167  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_LD_HI20))
    1168  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_GD_PC_HI20))
    1169  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_TLS_GD_HI20))
    1170  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_32_PCREL))
    1171  - .value(PY_ENUM(RELOC_LOONGARCH::R_LARCH_RELAX));
    1172  - 
    1173  - enum_<DYNSYM_COUNT_METHODS>(m, "DYNSYM_COUNT_METHODS")
    1174  - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_AUTO))
    1175  - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_SECTION))
    1176  - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_HASH))
    1177  - .value(PY_ENUM(DYNSYM_COUNT_METHODS::COUNT_RELOCATIONS));
    1178  - 
    1179  - 
    1180  - enum_<RELOCATION_PURPOSES>(m, "RELOCATION_PURPOSES")
    1181  - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_NONE))
    1182  - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_PLTGOT))
    1183  - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_DYNAMIC))
    1184  - .value(PY_ENUM(RELOCATION_PURPOSES::RELOC_PURPOSE_OBJECT));
    1185  - 
    1186  - 
    1187  - enum_<ARM_EFLAGS>(m, "ARM_EFLAGS", nb::is_arithmetic())
    1188  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_SOFT_FLOAT))
    1189  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_VFP_FLOAT))
    1190  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_UNKNOWN))
    1191  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER1))
    1192  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER2))
    1193  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER3))
    1194  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER4))
    1195  - .value(PY_ENUM(ARM_EFLAGS::EF_ARM_EABI_VER5));
    1196  - 
    1197  - 
    1198  - enum_<PPC64_EFLAGS>(m, "PPC64_EFLAGS", nb::is_arithmetic())
    1199  - .value(PY_ENUM(PPC64_EFLAGS::EF_PPC64_ABI));
    1200  - 
    1201  - enum_<MIPS_EFLAGS>(m, "MIPS_EFLAGS", nb::is_arithmetic())
    1202  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_NOREORDER))
    1203  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_PIC))
    1204  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_CPIC))
    1205  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI2))
    1206  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_32BITMODE))
    1207  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_FP64))
    1208  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_NAN2008))
    1209  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_O32))
    1210  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_O64))
    1211  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_EABI32))
    1212  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ABI_EABI64))
    1213  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_3900))
    1214  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4010))
    1215  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4100))
    1216  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4650))
    1217  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4120))
    1218  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_4111))
    1219  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_SB1))
    1220  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON))
    1221  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_XLR))
    1222  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON2))
    1223  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_OCTEON3))
    1224  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5400))
    1225  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5900))
    1226  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_5500))
    1227  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_9000))
    1228  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS2E))
    1229  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS2F))
    1230  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MACH_LS3A))
    1231  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_MICROMIPS))
    1232  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_ASE_M16))
    1233  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_ASE_MDMX))
    1234  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_1))
    1235  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_2))
    1236  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_3))
    1237  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_4))
    1238  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_5))
    1239  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32))
    1240  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64))
    1241  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32R2))
    1242  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64R2))
    1243  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_32R6))
    1244  - .value(PY_ENUM(MIPS_EFLAGS::EF_MIPS_ARCH_64R6));
    1245  - 
    1246  - enum_<HEXAGON_EFLAGS>(m, "HEXAGON_EFLAGS", nb::is_arithmetic())
    1247  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V2))
    1248  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V3))
    1249  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V4))
    1250  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_MACH_V5))
    1251  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_MACH))
    1252  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V2))
    1253  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V3))
    1254  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V4))
    1255  - .value(PY_ENUM(HEXAGON_EFLAGS::EF_HEXAGON_ISA_V5));
    1256  - 
    1257  - enum_<LOONGARCH_EFLAGS>(m, "LOONGARCH_EFLAGS", nb::is_arithmetic())
    1258  - .value(PY_ENUM(LOONGARCH_EFLAGS::EF_LOONGARCH_ABI_SOFT_FLOAT))
    1259  - .value(PY_ENUM(LOONGARCH_EFLAGS::EF_LOONGARCH_ABI_SINGLE_FLOAT))
    1260  - .value(PY_ENUM(LOONGARCH_EFLAGS::EF_LOONGARCH_ABI_DOUBLE_FLOAT));
    1261  - 
    1262  - enum_<IDENTITY>(m, "IDENTITY")
    1263  - .value(PY_ENUM(IDENTITY::EI_MAG0))
    1264  - .value(PY_ENUM(IDENTITY::EI_MAG1))
    1265  - .value(PY_ENUM(IDENTITY::EI_MAG2))
    1266  - .value(PY_ENUM(IDENTITY::EI_MAG3))
    1267  - .value(PY_ENUM(IDENTITY::EI_CLASS))
    1268  - .value(PY_ENUM(IDENTITY::EI_DATA))
    1269  - .value(PY_ENUM(IDENTITY::EI_VERSION))
    1270  - .value(PY_ENUM(IDENTITY::EI_OSABI))
    1271  - .value(PY_ENUM(IDENTITY::EI_ABIVERSION))
    1272  - .value(PY_ENUM(IDENTITY::EI_PAD))
    1273  - .value(PY_ENUM(IDENTITY::EI_NIDENT));
    1274  - 
    1275  - 
    1276  - enum_<SYMBOL_SECTION_INDEX>(m, "SYMBOL_SECTION_INDEX")
    1277  - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_UNDEF))
    1278  - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_ABS))
    1279  - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_COMMON))
    1280  - .value(PY_ENUM(SYMBOL_SECTION_INDEX::SHN_HIRESERVE));
    1281  - 
    1282  - 
    1283  - enum_<DYNAMIC_FLAGS>(m, "DYNAMIC_FLAGS", nb::is_arithmetic())
    1284  - .value(PY_ENUM(DYNAMIC_FLAGS::DF_ORIGIN))
    1285  - .value(PY_ENUM(DYNAMIC_FLAGS::DF_SYMBOLIC))
    1286  - .value(PY_ENUM(DYNAMIC_FLAGS::DF_TEXTREL))
    1287  - .value(PY_ENUM(DYNAMIC_FLAGS::DF_BIND_NOW))
    1288  - .value(PY_ENUM(DYNAMIC_FLAGS::DF_STATIC_TLS));
    1289  - 
    1290  - enum_<DYNAMIC_FLAGS_1>(m, "DYNAMIC_FLAGS_1", nb::is_arithmetic())
    1291  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOW))
    1292  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GLOBAL))
    1293  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GROUP))
    1294  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODELETE))
    1295  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_LOADFLTR))
    1296  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_INITFIRST))
    1297  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOOPEN))
    1298  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_ORIGIN))
    1299  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DIRECT))
    1300  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_TRANS))
    1301  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_INTERPOSE))
    1302  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODEFLIB))
    1303  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODUMP))
    1304  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_CONFALT))
    1305  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_ENDFILTEE))
    1306  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DISPRELDNE))
    1307  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_DISPRELPND))
    1308  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NODIRECT))
    1309  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_IGNMULDEF))
    1310  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOKSYMS))
    1311  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NOHDR))
    1312  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_EDITED))
    1313  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_NORELOC))
    1314  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_SYMINTPOSE))
    1315  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_GLOBAUDIT))
    1316  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_SINGLETON))
    1317  - .value(PY_ENUM(DYNAMIC_FLAGS_1::DF_1_PIE));
    1318  - 
    1319  - enum_<ELF_SYMBOL_VISIBILITY>(m, "SYMBOL_VISIBILITY")
    1320  - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_DEFAULT))
    1321  - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_HIDDEN))
    1322  - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_INTERNAL))
    1323  - .value(PY_ENUM(ELF_SYMBOL_VISIBILITY::STV_PROTECTED));
    1324  - 
     25 + ENTRY(NONE)
     26 + ENTRY(M32)
     27 + ENTRY(SPARC)
     28 + ENTRY(I386)
     29 + ENTRY(M68K)
     30 + ENTRY(M88K)
     31 + ENTRY(IAMCU)
     32 + ENTRY(I860)
     33 + ENTRY(MIPS)
     34 + ENTRY(S370)
     35 + ENTRY(MIPS_RS3_LE)
     36 + ENTRY(PARISC)
     37 + ENTRY(VPP500)
     38 + ENTRY(SPARC32PLUS)
     39 + ENTRY(I60)
     40 + ENTRY(PPC)
     41 + ENTRY(PPC64)
     42 + ENTRY(S390)
     43 + ENTRY(SPU)
     44 + ENTRY(V800)
     45 + ENTRY(FR20)
     46 + ENTRY(RH32)
     47 + ENTRY(RCE)
     48 + ENTRY(ARM)
     49 + ENTRY(ALPHA)
     50 + ENTRY(SH)
     51 + ENTRY(SPARCV9)
     52 + ENTRY(TRICORE)
     53 + ENTRY(ARC)
     54 + ENTRY(H8_300)
     55 + ENTRY(H8_300H)
     56 + ENTRY(H8S)
     57 + ENTRY(H8_500)
     58 + ENTRY(IA_64)
     59 + ENTRY(MIPS_X)
     60 + ENTRY(COLDFIRE)
     61 + ENTRY(M68HC12)
     62 + ENTRY(MMA)
     63 + ENTRY(PCP)
     64 + ENTRY(NCPU)
     65 + ENTRY(NDR1)
     66 + ENTRY(STARCORE)
     67 + ENTRY(ME16)
     68 + ENTRY(ST100)
     69 + ENTRY(TINYJ)
     70 + ENTRY(X86_64)
     71 + ENTRY(PDSP)
     72 + ENTRY(PDP10)
     73 + ENTRY(PDP11)
     74 + ENTRY(FX66)
     75 + ENTRY(ST9PLUS)
     76 + ENTRY(ST7)
     77 + ENTRY(M68HC16)
     78 + ENTRY(M68HC11)
     79 + ENTRY(M68HC08)
     80 + ENTRY(M68HC05)
     81 + ENTRY(SVX)
     82 + ENTRY(ST19)
     83 + ENTRY(VAX)
     84 + ENTRY(CRIS)
     85 + ENTRY(JAVELIN)
     86 + ENTRY(FIREPATH)
     87 + ENTRY(ZSP)
     88 + ENTRY(MMIX)
     89 + ENTRY(HUANY)
     90 + ENTRY(PRISM)
     91 + ENTRY(AVR)
     92 + ENTRY(FR30)
     93 + ENTRY(D10V)
     94 + ENTRY(D30V)
     95 + ENTRY(V850)
     96 + ENTRY(M32R)
     97 + ENTRY(MN10300)
     98 + ENTRY(MN10200)
     99 + ENTRY(PJ)
     100 + ENTRY(OPENRISC)
     101 + ENTRY(ARC_COMPACT)
     102 + ENTRY(XTENSA)
     103 + ENTRY(VIDEOCORE)
     104 + ENTRY(TMM_GPP)
     105 + ENTRY(NS32K)
     106 + ENTRY(TPC)
     107 + ENTRY(SNP1K)
     108 + ENTRY(ST200)
     109 + ENTRY(IP2K)
     110 + ENTRY(MAX)
     111 + ENTRY(CR)
     112 + ENTRY(F2MC16)
     113 + ENTRY(MSP430)
     114 + ENTRY(BLACKFIN)
     115 + ENTRY(SE_C33)
     116 + ENTRY(SEP)
     117 + ENTRY(ARCA)
     118 + ENTRY(UNICORE)
     119 + ENTRY(EXCESS)
     120 + ENTRY(DXP)
     121 + ENTRY(ALTERA_NIOS2)
     122 + ENTRY(CRX)
     123 + ENTRY(XGATE)
     124 + ENTRY(C166)
     125 + ENTRY(M16C)
     126 + ENTRY(DSPIC30F)
     127 + ENTRY(CE)
     128 + ENTRY(M32C)
     129 + ENTRY(TSK3000)
     130 + ENTRY(RS08)
     131 + ENTRY(SHARC)
     132 + ENTRY(ECOG2)
     133 + ENTRY(SCORE7)
     134 + ENTRY(DSP24)
     135 + ENTRY(VIDEOCORE3)
     136 + ENTRY(LATTICEMICO32)
     137 + ENTRY(SE_C17)
     138 + ENTRY(TI_C6000)
     139 + ENTRY(TI_C2000)
     140 + ENTRY(TI_C5500)
     141 + ENTRY(MMDSP_PLUS)
     142 + ENTRY(CYPRESS_M8C)
     143 + ENTRY(R32C)
     144 + ENTRY(TRIMEDIA)
     145 + ENTRY(HEXAGON)
     146 + ENTRY(M8051)
     147 + ENTRY(STXP7X)
     148 + ENTRY(NDS32)
     149 + ENTRY(ECOG1)
     150 + ENTRY(ECOG1X)
     151 + ENTRY(MAXQ30)
     152 + ENTRY(XIMO16)
     153 + ENTRY(MANIK)
     154 + ENTRY(CRAYNV2)
     155 + ENTRY(RX)
     156 + ENTRY(METAG)
     157 + ENTRY(MCST_ELBRUS)
     158 + ENTRY(ECOG16)
     159 + ENTRY(CR16)
     160 + ENTRY(ETPU)
     161 + ENTRY(SLE9X)
     162 + ENTRY(L10M)
     163 + ENTRY(K10M)
     164 + ENTRY(AARCH64)
     165 + ENTRY(AVR32)
     166 + ENTRY(STM8)
     167 + ENTRY(TILE64)
     168 + ENTRY(TILEPRO)
     169 + ENTRY(CUDA)
     170 + ENTRY(TILEGX)
     171 + ENTRY(CLOUDSHIELD)
     172 + ENTRY(COREA_1ST)
     173 + ENTRY(COREA_2ND)
     174 + ENTRY(ARC_COMPACT2)
     175 + ENTRY(OPEN8)
     176 + ENTRY(RL78)
     177 + ENTRY(VIDEOCORE5)
     178 + ENTRY(M78KOR)
     179 + ENTRY(M56800EX)
     180 + ENTRY(BA1)
     181 + ENTRY(BA2)
     182 + ENTRY(XCORE)
     183 + ENTRY(MCHP_PIC)
     184 + ENTRY(INTEL205)
     185 + ENTRY(INTEL206)
     186 + ENTRY(INTEL207)
     187 + ENTRY(INTEL208)
     188 + ENTRY(INTEL209)
     189 + ENTRY(KM32)
     190 + ENTRY(KMX32)
     191 + ENTRY(KMX16)
     192 + ENTRY(KMX8)
     193 + ENTRY(KVARC)
     194 + ENTRY(CDP)
     195 + ENTRY(COGE)
     196 + ENTRY(COOL)
     197 + ENTRY(NORC)
     198 + ENTRY(CSR_KALIMBA)
     199 + ENTRY(AMDGPU)
     200 + ENTRY(RISCV)
     201 + ENTRY(BPF)
     202 + ENTRY(LOONGARCH)
     203 + ;
     204 + #undef ENTRY
    1325 205  }
    1326 206  }
    1327 207   
  • ■ ■ ■ ■ ■
    api/python/src/ELF/init.cpp
    skipped 72 lines
    73 73   CREATE(Parser, m);
    74 74   CREATE(SymbolVersion, m);
    75 75   CREATE(Binary, m);
     76 + CREATE(PROCESSOR_FLAGS, m);
    76 77   CREATE(Header, m);
    77 78   CREATE(Section, m);
    78 79   CREATE(Segment, m);
    skipped 40 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/CMakeLists.txt
    skipped 13 lines
    14 14   pyParserConfig.cpp
    15 15   pyNote.cpp
    16 16   pyRelocation.cpp
     17 + pyRelocationTypes.cpp
    17 18   pySection.cpp
    18 19   pySegment.cpp
    19 20   pySymbol.cpp
    skipped 10 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyBinary.cpp
    skipped 40 lines
    41 41  #include "LIEF/ELF/SymbolVersion.hpp"
    42 42  #include "LIEF/ELF/SymbolVersionDefinition.hpp"
    43 43  #include "LIEF/ELF/SymbolVersionRequirement.hpp"
     44 +#include "LIEF/ELF/SymbolVersionAuxRequirement.hpp"
    44 45  #include "LIEF/ELF/SysvHash.hpp"
    45 46   
    46 47  #include "pyIterator.hpp"
    skipped 275 lines
    322 323   nb::rv_policy::reference_internal)
    323 324   
    324 325   .def("get",
    325  - nb::overload_cast<DYNAMIC_TAGS>(&Binary::get),
     326 + nb::overload_cast<DynamicEntry::TAG>(&Binary::get),
    326 327   R"delim(
    327 328   Return the first binary's :class:`~lief.ELF.DynamicEntry` from the given
    328  - :class:`~lief.ELF.DYNAMIC_TAGS`.
     329 + :class:`~lief.ELF.DynamicEntry.TAG`.
    329 330   
    330 331   It returns None if the dynamic entry can't be found.
    331 332   )delim"_doc,
    skipped 1 lines
    333 334   nb::rv_policy::reference_internal)
    334 335   
    335 336   .def("get",
    336  - nb::overload_cast<SEGMENT_TYPES>(&Binary::get),
     337 + nb::overload_cast<Segment::TYPE>(&Binary::get),
    337 338   R"delim(
    338 339   Return the first binary's :class:`~lief.ELF.Segment` from the given
    339 340   :class:`~lief.ELF.SEGMENT_TYPES`
    skipped 15 lines
    355 356   nb::rv_policy::reference_internal)
    356 357   
    357 358   .def("get",
    358  - nb::overload_cast<ELF_SECTION_TYPES>(&Binary::get),
     359 + nb::overload_cast<Section::TYPE>(&Binary::get),
    359 360   R"delim(
    360 361   Return the first binary's :class:`~lief.ELF.Section` from the given
    361 362   :class:`~lief.ELF.ELF_SECTION_TYPES`
    skipped 4 lines
    366 367   nb::rv_policy::reference_internal)
    367 368   
    368 369   .def("has",
    369  - nb::overload_cast<DYNAMIC_TAGS>(&Binary::has, nb::const_),
     370 + nb::overload_cast<DynamicEntry::TAG>(&Binary::has, nb::const_),
    370 371   R"delim(
    371 372   Check if it exists a :class:`~lief.ELF.DynamicEntry` with the given
    372  - :class:`~lief.ELF.DYNAMIC_TAGS`
     373 + :class:`~lief.ELF.DynamicEntry.TAG`
    373 374   )delim"_doc,
    374 375   "tag"_a)
    375 376   
    376 377   .def("has",
    377  - nb::overload_cast<SEGMENT_TYPES>(&Binary::has, nb::const_),
     378 + nb::overload_cast<Segment::TYPE>(&Binary::has, nb::const_),
    378 379   "Check if a " RST_CLASS_REF(lief.ELF.Segment) " of *type* (" RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) ") exists"_doc,
    379 380   "type"_a)
    380 381   
    skipped 3 lines
    384 385   "type"_a)
    385 386   
    386 387   .def("has",
    387  - nb::overload_cast<ELF_SECTION_TYPES>(&Binary::has, nb::const_),
     388 + nb::overload_cast<Section::TYPE>(&Binary::has, nb::const_),
    388 389   "Check if a " RST_CLASS_REF(lief.ELF.Section) " of *type* (" RST_CLASS_REF(lief.ELF.SECTION_TYPES) ") exists"_doc,
    389 390   "type"_a)
    390 391   
    skipped 109 lines
    500 501   "dynamic_entry"_a)
    501 502   
    502 503   .def("remove",
    503  - nb::overload_cast<DYNAMIC_TAGS>(&Binary::remove),
    504  - "Remove **all** the " RST_CLASS_REF(lief.ELF.DynamicEntry) " with the given " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) ""_doc,
     504 + nb::overload_cast<DynamicEntry::TAG>(&Binary::remove),
     505 + "Remove **all** the " RST_CLASS_REF(lief.ELF.DynamicEntry) " with the given " RST_CLASS_REF(lief.ELF.DynamicEntry.TAG) ""_doc,
    505 506   "tag"_a)
    506 507   
    507 508   .def("remove",
    skipped 225 lines
    733 734   return &self;
    734 735   }, nb::rv_policy::reference_internal)
    735 736   .def(nb::self -= DynamicEntry(), nb::rv_policy::reference_internal)
    736  - .def(nb::self -= DYNAMIC_TAGS(), nb::rv_policy::reference_internal)
     737 + .def(nb::self -= DynamicEntry::TAG(), nb::rv_policy::reference_internal)
    737 738   .def("__isub__", [] (Binary& self, const Note& note) {
    738 739   self -= note;
    739 740   return &self;
    skipped 1 lines
    741 742   .def(nb::self -= Note::TYPE(), nb::rv_policy::reference_internal)
    742 743   
    743 744   .def("__getitem__",
    744  - nb::overload_cast<SEGMENT_TYPES>(&Binary::operator[]),
     745 + nb::overload_cast<Segment::TYPE>(&Binary::operator[]),
    745 746   nb::rv_policy::reference_internal)
    746 747   
    747 748   .def("__getitem__",
    skipped 1 lines
    749 750   nb::rv_policy::reference_internal)
    750 751   
    751 752   .def("__getitem__",
    752  - nb::overload_cast<DYNAMIC_TAGS>(&Binary::operator[]),
     753 + nb::overload_cast<DynamicEntry::TAG>(&Binary::operator[]),
    753 754   nb::rv_policy::reference_internal)
    754 755   
    755 756   .def("__getitem__",
    756  - nb::overload_cast<ELF_SECTION_TYPES>(&Binary::operator[]),
     757 + nb::overload_cast<Section::TYPE>(&Binary::operator[]),
    757 758   nb::rv_policy::reference_internal)
    758 759   
    759 760   .def("__contains__",
    760  - nb::overload_cast<SEGMENT_TYPES>(&Binary::has, nb::const_),
     761 + nb::overload_cast<Segment::TYPE>(&Binary::has, nb::const_),
    761 762   "Check if a " RST_CLASS_REF(lief.ELF.Segment) " of *type* (" RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) ") exists"_doc)
    762 763   
    763 764   .def("__contains__",
    764  - nb::overload_cast<DYNAMIC_TAGS>(&Binary::has, nb::const_),
    765  - "Check if the " RST_CLASS_REF(lief.ELF.DynamicEntry) " associated with the given " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " exists"_doc)
     765 + nb::overload_cast<DynamicEntry::TAG>(&Binary::has, nb::const_),
     766 + "Check if the " RST_CLASS_REF(lief.ELF.DynamicEntry) " associated with the given " RST_CLASS_REF(lief.ELF.DynamicEntry.TAG) " exists"_doc)
    766 767   
    767 768   .def("__contains__",
    768 769   nb::overload_cast<Note::TYPE>(&Binary::has, nb::const_),
    769 770   "Check if the " RST_CLASS_REF(lief.ELF.Note) " associated with the given " RST_CLASS_REF(lief.ELF.Note.TYPE) " exists"_doc)
    770 771   
    771 772   .def("__contains__",
    772  - nb::overload_cast<ELF_SECTION_TYPES>(&Binary::has, nb::const_),
     773 + nb::overload_cast<Section::TYPE>(&Binary::has, nb::const_),
    773 774   "Check if the " RST_CLASS_REF(lief.ELF.Section) " associated with the given " RST_CLASS_REF(lief.ELF.SECTION_TYPES) " exists"_doc)
    774 775   
    775 776   LIEF_DEFAULT_STR(Binary);
    skipped 4 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyBuilder.cpp
    skipped 36 lines
    37 37   .def_rw("force_relocate", &Builder::config_t::force_relocate,
    38 38   "Force to relocate all the ELF structures that can be relocated (mostly for testing)"_doc)
    39 39   
    40  - .def_rw("dt_hash", &Builder::config_t::dt_hash, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.HASH`"_doc)
    41  - .def_rw("dyn_str", &Builder::config_t::dyn_str, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.STRTAB`"_doc)
     40 + .def_rw("dt_hash", &Builder::config_t::dt_hash, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.HASH`"_doc)
     41 + .def_rw("dyn_str", &Builder::config_t::dyn_str, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.STRTAB`"_doc)
    42 42   .def_rw("dynamic_section", &Builder::config_t::dynamic_section, "Rebuild the `PT_DYNAMIC` segment"_doc)
    43  - .def_rw("fini_array", &Builder::config_t::fini_array, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.FINI_ARRAY`"_doc)
    44  - .def_rw("init_array", &Builder::config_t::init_array, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.INIT_ARRAY`"_doc)
     43 + .def_rw("fini_array", &Builder::config_t::fini_array, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.FINI_ARRAY`"_doc)
     44 + .def_rw("init_array", &Builder::config_t::init_array, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.INIT_ARRAY`"_doc)
    45 45   .def_rw("interpreter", &Builder::config_t::interpreter, "Rebuild the `PT_INTERP` segment"_doc)
    46  - .def_rw("jmprel", &Builder::config_t::jmprel, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.JMPREL`"_doc)
     46 + .def_rw("jmprel", &Builder::config_t::jmprel, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.JMPREL`"_doc)
    47 47   .def_rw("notes", &Builder::config_t::notes, "Rebuild `PT_NOTES` segment(s)"_doc)
    48  - .def_rw("preinit_array", &Builder::config_t::preinit_array, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.PREINIT_ARRAY`"_doc)
    49  - .def_rw("rela", &Builder::config_t::rela, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.RELA`"_doc)
     48 + .def_rw("preinit_array", &Builder::config_t::preinit_array, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.PREINIT_ARRAY`"_doc)
     49 + .def_rw("rela", &Builder::config_t::rela, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.RELA`"_doc)
    50 50   .def_rw("static_symtab", &Builder::config_t::static_symtab, "Rebuild `.symtab` section"_doc)
    51  - .def_rw("sym_verdef", &Builder::config_t::sym_verdef, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.VERDEF`"_doc)
    52  - .def_rw("sym_verneed", &Builder::config_t::sym_verneed, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.VERNEED`"_doc)
    53  - .def_rw("sym_versym", &Builder::config_t::sym_versym, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.VERSYM`"_doc)
    54  - .def_rw("symtab", &Builder::config_t::symtab, "Rebuild :attr:`~lief.ELF.DYNAMIC_TAGS.SYMTAB`"_doc);
     51 + .def_rw("sym_verdef", &Builder::config_t::sym_verdef, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.VERDEF`"_doc)
     52 + .def_rw("sym_verneed", &Builder::config_t::sym_verneed, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.VERNEED`"_doc)
     53 + .def_rw("sym_versym", &Builder::config_t::sym_versym, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.VERSYM`"_doc)
     54 + .def_rw("symtab", &Builder::config_t::symtab, "Rebuild :attr:`~lief.ELF.DynamicEntry.TAG.SYMTAB`"_doc);
    55 55   
    56 56   builder
    57 57   .def(nb::init<Binary&>(),
    skipped 27 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntry.cpp
    skipped 17 lines
    18 18  #include <nanobind/stl/string.h>
    19 19   
    20 20  #include "ELF/pyELF.hpp"
     21 +#include "enums_wrapper.hpp"
    21 22   
    22 23  #include "LIEF/ELF/DynamicEntry.hpp"
    23 24   
    skipped 1 lines
    25 26   
    26 27  template<>
    27 28  void create<DynamicEntry>(nb::module_& m) {
    28  - nb::class_<DynamicEntry, LIEF::Object>(m, "DynamicEntry",
     29 + nb::class_<DynamicEntry, LIEF::Object> entry(m, "DynamicEntry",
    29 30   R"delim(
    30 31   Class which represents an entry in the dynamic table
    31 32   These entries are located in the ``.dynamic`` section or the ``PT_DYNAMIC`` segment
    32  - )delim"_doc)
     33 + )delim"_doc);
     34 + 
     35 + #define ENTRY(X) .value(to_string(DynamicEntry::TAG::X), DynamicEntry::TAG::X)
     36 + enum_<DynamicEntry::TAG>(entry, "TAG")
     37 + ENTRY(UNKNOWN)
     38 + .value("NULL", DynamicEntry::TAG::DT_NULL)
     39 + ENTRY(NEEDED)
     40 + ENTRY(PLTRELSZ)
     41 + ENTRY(PLTGOT)
     42 + ENTRY(HASH)
     43 + ENTRY(STRTAB)
     44 + ENTRY(SYMTAB)
     45 + ENTRY(RELA)
     46 + ENTRY(RELASZ)
     47 + ENTRY(RELAENT)
     48 + ENTRY(STRSZ)
     49 + ENTRY(SYMENT)
     50 + ENTRY(INIT)
     51 + ENTRY(FINI)
     52 + ENTRY(SONAME)
     53 + ENTRY(RPATH)
     54 + ENTRY(SYMBOLIC)
     55 + ENTRY(REL)
     56 + ENTRY(RELSZ)
     57 + ENTRY(RELENT)
     58 + ENTRY(PLTREL)
     59 + ENTRY(DEBUG)
     60 + ENTRY(TEXTREL)
     61 + ENTRY(JMPREL)
     62 + ENTRY(BIND_NOW)
     63 + ENTRY(INIT_ARRAY)
     64 + ENTRY(FINI_ARRAY)
     65 + ENTRY(INIT_ARRAYSZ)
     66 + ENTRY(FINI_ARRAYSZ)
     67 + ENTRY(RUNPATH)
     68 + ENTRY(FLAGS)
     69 + ENTRY(PREINIT_ARRAY)
     70 + ENTRY(PREINIT_ARRAYSZ)
     71 + ENTRY(SYMTAB_SHNDX)
     72 + ENTRY(RELRSZ)
     73 + ENTRY(RELR)
     74 + ENTRY(RELRENT)
     75 + ENTRY(GNU_HASH)
     76 + ENTRY(RELACOUNT)
     77 + ENTRY(RELCOUNT)
     78 + ENTRY(FLAGS_1)
     79 + ENTRY(VERSYM)
     80 + ENTRY(VERDEF)
     81 + ENTRY(VERDEFNUM)
     82 + ENTRY(VERNEED)
     83 + ENTRY(VERNEEDNUM)
     84 + ENTRY(ANDROID_REL_OFFSET)
     85 + ENTRY(ANDROID_REL_SIZE)
     86 + ENTRY(ANDROID_REL)
     87 + ENTRY(ANDROID_RELSZ)
     88 + ENTRY(ANDROID_RELA)
     89 + ENTRY(ANDROID_RELASZ)
     90 + ENTRY(ANDROID_RELR)
     91 + ENTRY(ANDROID_RELRSZ)
     92 + ENTRY(ANDROID_RELRENT)
     93 + ENTRY(ANDROID_RELRCOUNT)
     94 + ENTRY(MIPS_RLD_VERSION)
     95 + ENTRY(MIPS_TIME_STAMP)
     96 + ENTRY(MIPS_ICHECKSUM)
     97 + ENTRY(MIPS_IVERSION)
     98 + ENTRY(MIPS_FLAGS)
     99 + ENTRY(MIPS_BASE_ADDRESS)
     100 + ENTRY(MIPS_MSYM)
     101 + ENTRY(MIPS_CONFLICT)
     102 + ENTRY(MIPS_LIBLIST)
     103 + ENTRY(MIPS_LOCAL_GOTNO)
     104 + ENTRY(MIPS_CONFLICTNO)
     105 + ENTRY(MIPS_LIBLISTNO)
     106 + ENTRY(MIPS_SYMTABNO)
     107 + ENTRY(MIPS_UNREFEXTNO)
     108 + ENTRY(MIPS_GOTSYM)
     109 + ENTRY(MIPS_HIPAGENO)
     110 + ENTRY(MIPS_RLD_MAP)
     111 + ENTRY(MIPS_DELTA_CLASS)
     112 + ENTRY(MIPS_DELTA_CLASS_NO)
     113 + ENTRY(MIPS_DELTA_INSTANCE)
     114 + ENTRY(MIPS_DELTA_INSTANCE_NO)
     115 + ENTRY(MIPS_DELTA_RELOC)
     116 + ENTRY(MIPS_DELTA_RELOC_NO)
     117 + ENTRY(MIPS_DELTA_SYM)
     118 + ENTRY(MIPS_DELTA_SYM_NO)
     119 + ENTRY(MIPS_DELTA_CLASSSYM)
     120 + ENTRY(MIPS_DELTA_CLASSSYM_NO)
     121 + ENTRY(MIPS_CXX_FLAGS)
     122 + ENTRY(MIPS_PIXIE_INIT)
     123 + ENTRY(MIPS_SYMBOL_LIB)
     124 + ENTRY(MIPS_LOCALPAGE_GOTIDX)
     125 + ENTRY(MIPS_LOCAL_GOTIDX)
     126 + ENTRY(MIPS_HIDDEN_GOTIDX)
     127 + ENTRY(MIPS_PROTECTED_GOTIDX)
     128 + ENTRY(MIPS_OPTIONS)
     129 + ENTRY(MIPS_INTERFACE)
     130 + ENTRY(MIPS_DYNSTR_ALIGN)
     131 + ENTRY(MIPS_INTERFACE_SIZE)
     132 + ENTRY(MIPS_RLD_TEXT_RESOLVE_ADDR)
     133 + ENTRY(MIPS_PERF_SUFFIX)
     134 + ENTRY(MIPS_COMPACT_SIZE)
     135 + ENTRY(MIPS_GP_VALUE)
     136 + ENTRY(MIPS_AUX_DYNAMIC)
     137 + ENTRY(MIPS_PLTGOT)
     138 + ENTRY(MIPS_RWPLT)
     139 + ENTRY(MIPS_RLD_MAP_REL)
     140 + ENTRY(MIPS_XHASH)
     141 + 
     142 + ENTRY(AARCH64_BTI_PLT)
     143 + ENTRY(AARCH64_PAC_PLT)
     144 + ENTRY(AARCH64_VARIANT_PCS)
     145 + ENTRY(AARCH64_MEMTAG_MODE)
     146 + ENTRY(AARCH64_MEMTAG_HEAP)
     147 + ENTRY(AARCH64_MEMTAG_STACK)
     148 + ENTRY(AARCH64_MEMTAG_GLOBALS)
     149 + ENTRY(AARCH64_MEMTAG_GLOBALSSZ)
     150 + 
     151 + ENTRY(HEXAGON_SYMSZ)
     152 + ENTRY(HEXAGON_VER)
     153 + ENTRY(HEXAGON_PLT)
     154 + 
     155 + ENTRY(PPC_GOT)
     156 + ENTRY(PPC_OPT)
     157 + 
     158 + ENTRY(PPC64_GLINK)
     159 + ENTRY(PPC64_OPT)
     160 + 
     161 + ENTRY(RISCV_VARIANT_CC)
     162 + ;
     163 + #undef ENTRY
     164 + 
     165 + entry
    33 166   .def(nb::init<>(),
    34 167   "Default constructor"_doc)
    35 168   
    36  - .def(nb::init<DYNAMIC_TAGS, uint64_t>(),
    37  - "Constructor from a " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value"_doc,
     169 + .def(nb::init<DynamicEntry::TAG, uint64_t>(),
     170 + "Constructor from a " RST_CLASS_REF(lief.ELF.DynamicEntry.TAG) " and value"_doc,
    38 171   "tag"_a, "value"_a)
    39 172   
    40 173   .def_prop_rw("tag",
    41 174   nb::overload_cast<>(&DynamicEntry::tag, nb::const_),
    42  - nb::overload_cast<DYNAMIC_TAGS>(&DynamicEntry::tag),
    43  - "Return the entry's " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " which represent the entry type"_doc)
     175 + nb::overload_cast<DynamicEntry::TAG>(&DynamicEntry::tag),
     176 + "Return the entry's " RST_CLASS_REF(lief.ELF.DynamicEntry.TAG) " which represent the entry type"_doc)
    44 177   
    45 178   .def_prop_rw("value",
    46 179   nb::overload_cast<>(&DynamicEntry::value, nb::const_),
    skipped 13 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntryArray.cpp
    skipped 39 lines
    40 40   The underlying values are 64-bits integers to cover both:
    41 41   ELF32 and ELF64 binaries.
    42 42   )delim"_doc)
    43  - .def(nb::init<>())
    44 43   
    45  - .def(nb::init<DYNAMIC_TAGS, uint64_t>(),
    46  - "Constructor with " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value"_doc,
    47  - "tag"_a, "value"_a)
     44 + .def(nb::init<DynamicEntry::TAG, DynamicEntryArray::array_t>(),
     45 + "tag"_a, "array"_a)
    48 46   
    49 47   .def_prop_rw("array",
    50 48   nb::overload_cast<>(&DynamicEntryArray::array, nb::const_),
    skipped 18 lines
    69 67   "Remove the given ``function`` "_doc,
    70 68   "function"_a,
    71 69   nb::rv_policy::reference_internal)
    72  - 
    73 70   
    74 71   .def(nb::self += uint64_t())
    75 72   .def(nb::self -= uint64_t())
    skipped 13 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntryFlags.cpp
    skipped 17 lines
    18 18   
    19 19  #include <nanobind/operators.h>
    20 20  #include <nanobind/stl/string.h>
    21  -#include <nanobind/stl/set.h>
     21 +#include <nanobind/stl/vector.h>
    22 22   
    23 23  #include "ELF/pyELF.hpp"
     24 +#include "enums_wrapper.hpp"
    24 25   
    25 26  #include "LIEF/ELF/DynamicEntryFlags.hpp"
    26 27  #include "LIEF/ELF/DynamicEntry.hpp"
    skipped 2 lines
    29 30   
    30 31  template<>
    31 32  void create<DynamicEntryFlags>(nb::module_& m) {
    32  - nb::class_<DynamicEntryFlags, DynamicEntry>(m, "DynamicEntryFlags")
    33  - .def(nb::init<>())
     33 + nb::class_<DynamicEntryFlags, DynamicEntry> entry(m, "DynamicEntryFlags");
    34 34   
    35  - .def(nb::init<DYNAMIC_TAGS, uint64_t>(),
    36  - "Constructor with " RST_CLASS_REF(lief.ELF.DYNAMIC_TAGS) " and value"_doc,
    37  - "tag"_a, "value"_a)
     35 + #define ENTRY(X) .value(to_string(DynamicEntryFlags::FLAG::X), DynamicEntryFlags::FLAG::X)
     36 + enum_<DynamicEntryFlags::FLAG>(entry, "FLAG")
     37 + ENTRY(ORIGIN)
     38 + ENTRY(SYMBOLIC)
     39 + ENTRY(TEXTREL)
     40 + ENTRY(BIND_NOW)
     41 + ENTRY(STATIC_TLS)
     42 + ENTRY(NOW)
     43 + ENTRY(GLOBAL)
     44 + ENTRY(GROUP)
     45 + ENTRY(NODELETE)
     46 + ENTRY(LOADFLTR)
     47 + ENTRY(INITFIRST)
     48 + ENTRY(NOOPEN)
     49 + ENTRY(HANDLE_ORIGIN)
     50 + ENTRY(DIRECT)
     51 + ENTRY(TRANS)
     52 + ENTRY(INTERPOSE)
     53 + ENTRY(NODEFLIB)
     54 + ENTRY(NODUMP)
     55 + ENTRY(CONFALT)
     56 + ENTRY(ENDFILTEE)
     57 + ENTRY(DISPRELDNE)
     58 + ENTRY(DISPRELPND)
     59 + ENTRY(NODIRECT)
     60 + ENTRY(IGNMULDEF)
     61 + ENTRY(NOKSYMS)
     62 + ENTRY(NOHDR)
     63 + ENTRY(EDITED)
     64 + ENTRY(NORELOC)
     65 + ENTRY(SYMINTPOSE)
     66 + ENTRY(GLOBAUDIT)
     67 + ENTRY(SINGLETON)
     68 + ENTRY(PIE)
     69 + ENTRY(KMOD)
     70 + ENTRY(WEAKFILTER)
     71 + ENTRY(NOCOMMON)
     72 + ;
     73 + #undef ENTRY
    38 74   
     75 + entry
    39 76   .def_prop_ro("flags",
    40 77   &DynamicEntryFlags::flags,
    41  - "Return list of " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) " or " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) " (integer)"_doc,
     78 + "Return list of :class:`~.FLAG`"_doc,
    42 79   nb::rv_policy::move)
    43 80   
    44 81   .def("has",
    45  - nb::overload_cast<DYNAMIC_FLAGS>(&DynamicEntryFlags::has, nb::const_),
    46  - "Check if this entry contains the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) ""_doc,
     82 + nb::overload_cast<DynamicEntryFlags::FLAG>(&DynamicEntryFlags::has, nb::const_),
     83 + "Check if this entry contains the given :class:`~.FLAG`"_doc,
    47 84   "flag"_a)
    48 85   
    49  - .def("has",
    50  - nb::overload_cast<DYNAMIC_FLAGS_1>(&DynamicEntryFlags::has, nb::const_),
    51  - "Check if this entry contains the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) ""_doc,
    52  - "flag"_a)
    53 86   
    54 87   .def("add",
    55  - nb::overload_cast<DYNAMIC_FLAGS>(&DynamicEntryFlags::add),
    56  - "Add the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) ""_doc,
    57  - "flag"_a)
    58  - 
    59  - .def("add",
    60  - nb::overload_cast<DYNAMIC_FLAGS_1>(&DynamicEntryFlags::add),
    61  - "Add the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) ""_doc,
    62  - "flag"_a)
    63  - 
    64  - .def("remove",
    65  - nb::overload_cast<DYNAMIC_FLAGS>(&DynamicEntryFlags::remove),
    66  - "Remove the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) ""_doc,
     88 + nb::overload_cast<DynamicEntryFlags::FLAG>(&DynamicEntryFlags::add),
     89 + "Add the given :class:`~.FLAG`"_doc,
    67 90   "flag"_a)
    68 91   
    69 92   .def("remove",
    70  - nb::overload_cast<DYNAMIC_FLAGS_1>(&DynamicEntryFlags::remove),
    71  - "Remove the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) ""_doc,
     93 + nb::overload_cast<DynamicEntryFlags::FLAG>(&DynamicEntryFlags::remove),
     94 + "Remove the given :class:`~.FLAG`"_doc,
    72 95   "flag"_a)
    73 96   
    74  - .def(nb::self += DYNAMIC_FLAGS())
    75  - .def(nb::self += DYNAMIC_FLAGS_1())
    76  - 
    77  - .def(nb::self -= DYNAMIC_FLAGS())
    78  - .def(nb::self -= DYNAMIC_FLAGS_1())
     97 + .def(nb::self += DynamicEntryFlags::FLAG())
     98 + .def(nb::self -= DynamicEntryFlags::FLAG())
    79 99   
    80 100   .def("__contains__",
    81  - nb::overload_cast<DYNAMIC_FLAGS>(&DynamicEntryFlags::has, nb::const_),
    82  - "Check if the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS) " is present"_doc)
    83  - 
    84  - .def("__contains__",
    85  - nb::overload_cast<DYNAMIC_FLAGS_1>(&DynamicEntryFlags::has, nb::const_),
    86  - "Check if the given " RST_CLASS_REF(lief.ELF.DYNAMIC_FLAGS_1) " is present"_doc)
     101 + nb::overload_cast<DynamicEntryFlags::FLAG>(&DynamicEntryFlags::has, nb::const_),
     102 + "Check if the given :class:`~.FLAG` is present"_doc)
    87 103   
    88 104   LIEF_DEFAULT_STR(DynamicEntryFlags);
    89 105  }
    skipped 3 lines
  • ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntryLibrary.cpp
    skipped 41 lines
    42 42   [] (const DynamicEntryLibrary& obj) {
    43 43   return LIEF::py::safe_string(obj.name());
    44 44   },
    45  - nb::overload_cast<const std::string&>(&DynamicEntryLibrary::name),
     45 + nb::overload_cast<std::string>(&DynamicEntryLibrary::name),
    46 46   "Library associated with this entry (e.g. ``libc.so.6``)"_doc)
    47 47   
    48 48   LIEF_DEFAULT_STR(DynamicEntryLibrary);
    skipped 4 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntryRpath.cpp
    skipped 43 lines
    44 44   "Constructor from a list of paths"_doc,
    45 45   "paths"_a)
    46 46   
    47  - .def_prop_rw("name",
    48  - [] (const DynamicEntryRpath& obj) {
    49  - return LIEF::py::safe_string(obj.name());
    50  - },
    51  - nb::overload_cast<const std::string&>(&DynamicEntryRpath::name),
    52  - "The actual rpath as a string"_doc)
    53  - 
    54 47   .def_prop_rw("rpath",
    55 48   [] (const DynamicEntryRpath& obj) {
    56 49   return LIEF::py::safe_string(obj.rpath());
    skipped 6 lines
    63 56   nb::overload_cast<const std::vector<std::string>&>(&DynamicEntryRpath::paths),
    64 57   "Paths as a list"_doc)
    65 58   
    66  - .def("insert",
    67  - &DynamicEntryRpath::insert,
     59 + .def("insert", &DynamicEntryRpath::insert,
    68 60   "Insert a ``path`` at the given ``position``"_doc,
    69 61   "position"_a, "path"_a,
    70 62   nb::rv_policy::reference_internal)
    71 63   
    72  - .def("append",
    73  - &DynamicEntryRpath::append,
     64 + .def("append", &DynamicEntryRpath::append,
    74 65   "Append the given ``path`` "_doc,
    75 66   "path"_a,
    76 67   nb::rv_policy::reference_internal)
    77 68   
    78  - .def("remove",
    79  - &DynamicEntryRpath::remove,
     69 + .def("remove", &DynamicEntryRpath::remove,
    80 70   "Remove the given ``path`` "_doc,
    81 71   "path"_a,
    82 72   nb::rv_policy::reference_internal)
    skipped 9 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicEntryRunPath.cpp
    skipped 43 lines
    44 44   "Constructor from a list of paths"_doc,
    45 45   "paths"_a)
    46 46   
    47  - .def_prop_rw("name",
    48  - [] (const DynamicEntryRunPath& obj) {
    49  - return LIEF::py::safe_string(obj.name());
    50  - },
    51  - nb::overload_cast<const std::string&>(&DynamicEntryRunPath::name),
    52  - "Runpath raw value"_doc)
    53  - 
    54 47   .def_prop_rw("runpath",
    55 48   [] (const DynamicEntryRunPath& obj) {
    56 49   return LIEF::py::safe_string(obj.runpath());
    57 50   },
    58  - nb::overload_cast<const std::string&>(&DynamicEntryRunPath::runpath),
     51 + nb::overload_cast<std::string>(&DynamicEntryRunPath::runpath),
    59 52   "Runpath raw value"_doc)
    60 53   
    61 54   .def_prop_rw("paths",
    skipped 1 lines
    63 56   nb::overload_cast<const std::vector<std::string>&>(&DynamicEntryRunPath::paths),
    64 57   "Paths as a list"_doc)
    65 58   
    66  - .def("insert",
    67  - &DynamicEntryRunPath::insert,
     59 + .def("insert", &DynamicEntryRunPath::insert,
    68 60   "Insert a ``path`` at the given ``position``"_doc,
    69 61   "position"_a, "path"_a,
    70 62   nb::rv_policy::reference_internal)
    71 63   
    72  - .def("append",
    73  - &DynamicEntryRunPath::append,
     64 + .def("append", &DynamicEntryRunPath::append,
    74 65   "Append the given ``path`` "_doc,
    75 66   "path"_a, nb::rv_policy::reference_internal)
    76 67   
    77  - 
    78  - .def("remove",
    79  - &DynamicEntryRunPath::remove,
     68 + .def("remove", &DynamicEntryRunPath::remove,
    80 69   "Remove the given ``path`` ",
    81 70   "path"_a,
    82 71   nb::rv_policy::reference_internal)
    skipped 9 lines
  • ■ ■ ■ ■
    api/python/src/ELF/objects/pyDynamicSharedObject.cpp
    skipped 42 lines
    43 43   [] (const DynamicSharedObject& obj) {
    44 44   return LIEF::py::safe_string(obj.name());
    45 45   },
    46  - nb::overload_cast<const std::string&>(&DynamicSharedObject::name),
     46 + nb::overload_cast<std::string>(&DynamicSharedObject::name),
    47 47   "Return the library name"_doc)
    48 48   
    49 49   LIEF_DEFAULT_STR(DynamicSharedObject);
    skipped 4 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyHeader.cpp
    skipped 17 lines
    18 18   
    19 19  #include <nanobind/stl/string.h>
    20 20  #include <nanobind/stl/set.h>
     21 +#include <nanobind/stl/vector.h>
    21 22  #include <nanobind/stl/array.h>
    22 23   
    23 24  #include "ELF/pyELF.hpp"
     25 +#include "enums_wrapper.hpp"
    24 26   
    25 27  #include "LIEF/ELF/Header.hpp"
    26 28   
    skipped 2 lines
    29 31  template<>
    30 32  void create<Header>(nb::module_& m) {
    31 33   
    32  - nb::class_<Header, LIEF::Object>(m, "Header",
     34 + nb::class_<Header, LIEF::Object> header(m, "Header",
    33 35   R"delim(
    34  - Class which represents the ELF's header. This is the ELF structure
    35  - that starts an ELF file.
    36  - )delim"_doc)
     36 + Class which represents the ELF's header. This class mirrors the raw ELF
     37 + ``Elfxx_Ehdr`` structure.
     38 + )delim"_doc);
     39 + 
     40 + #define ENTRY(X, D) .value(to_string(Header::FILE_TYPE::X), Header::FILE_TYPE::X, D)
     41 + enum_<Header::FILE_TYPE>(header, "FILE_TYPE",
     42 + R"delim(
     43 + The type of the underlying ELF file. This enum matches the semantic of
     44 + ``ET_NONE``, ``ET_REL``, ...
     45 + )delim"_doc
     46 + )
     47 + ENTRY(NONE, "Can't be determined/Invalid"_doc)
     48 + ENTRY(REL, "Relocatable file (or object file)"_doc)
     49 + ENTRY(EXEC, "non-pie executable"_doc)
     50 + ENTRY(DYN, "Shared library **or** a pie-executable"_doc)
     51 + ENTRY(CORE, "Core dump file"_doc)
     52 + ;
     53 + #undef ENTRY
     54 + 
     55 + #define ENTRY(X, D) .value(to_string(Header::VERSION::X), Header::VERSION::X, D)
     56 + enum_<Header::VERSION>(header, "VERSION",
     57 + R"delim(
     58 + Match the result of ``Elfxx_Ehdr.e_version``
     59 + )delim"_doc
     60 + )
     61 + ENTRY(NONE, "Invalid ELF version"_doc)
     62 + ENTRY(CURRENT, "Current version (default)"_doc)
     63 + ;
     64 + #undef ENTRY
     65 + 
     66 + #define ENTRY(X, D) .value(to_string(Header::CLASS::X), Header::CLASS::X, D)
     67 + enum_<Header::CLASS>(header, "CLASS",
     68 + R"delim(
     69 + Match the result of ``Elfxx_Ehdr.e_ident[EI_CLASS]``
     70 + )delim"_doc
     71 + )
     72 + ENTRY(NONE, "Invalid class"_doc)
     73 + ENTRY(ELF32, "32-bit objects"_doc)
     74 + ENTRY(ELF64, "64-bit objects"_doc)
     75 + ;
     76 + #undef ENTRY
     77 + 
     78 + #define ENTRY(X) .value(to_string(Header::OS_ABI::X), Header::OS_ABI::X)
     79 + enum_<Header::OS_ABI>(header, "OS_ABI")
     80 + ENTRY(SYSTEMV)
     81 + ENTRY(HPUX)
     82 + ENTRY(NETBSD)
     83 + ENTRY(GNU)
     84 + ENTRY(LINUX)
     85 + ENTRY(HURD)
     86 + ENTRY(SOLARIS)
     87 + ENTRY(AIX)
     88 + ENTRY(IRIX)
     89 + ENTRY(FREEBSD)
     90 + ENTRY(TRU64)
     91 + ENTRY(MODESTO)
     92 + ENTRY(OPENBSD)
     93 + ENTRY(OPENVMS)
     94 + ENTRY(NSK)
     95 + ENTRY(AROS)
     96 + ENTRY(FENIXOS)
     97 + ENTRY(CLOUDABI)
     98 + ENTRY(C6000_ELFABI)
     99 + ENTRY(AMDGPU_HSA)
     100 + ENTRY(C6000_LINUX)
     101 + ENTRY(ARM)
     102 + ENTRY(STANDALONE)
     103 + ;
     104 + #undef ENTRY
     105 + 
     106 + #define ENTRY(X, D) .value(to_string(Header::ELF_DATA::X), Header::ELF_DATA::X, D)
     107 + enum_<Header::ELF_DATA>(header, "ELF_DATA",
     108 + R"delim(
     109 + Match the result ``Elfxx_Ehdr.e_ident[EI_DATA]``
     110 + )delim"_doc
     111 + )
     112 + ENTRY(NONE, "Invalid data encoding"_doc)
     113 + ENTRY(LSB, "2's complement, little endian"_doc)
     114 + ENTRY(MSB, "2's complement, big endian"_doc)
     115 + ;
     116 + #undef ENTRY
     117 + 
     118 + header
    37 119   .def(nb::init<>())
    38 120   
    39 121   .def_prop_rw("identity_class",
    40 122   nb::overload_cast<>(&Header::identity_class, nb::const_),
    41  - nb::overload_cast<ELF_CLASS>(&Header::identity_class),
    42  - "Header's " RST_CLASS_REF(lief.ELF.ELF_CLASS) "."_doc)
     123 + nb::overload_cast<Header::CLASS>(&Header::identity_class),
     124 + "Header's class."_doc)
    43 125   
    44 126   .def_prop_rw("identity_data",
    45 127   nb::overload_cast<>(&Header::identity_data, nb::const_),
    46  - nb::overload_cast<ELF_DATA>(&Header::identity_data),
    47  - "Specify the data encoding (" RST_CLASS_REF(lief.ELF.ELF_DATA) ")"_doc)
     128 + nb::overload_cast<Header::ELF_DATA>(&Header::identity_data),
     129 + "Specify the data encoding"_doc)
    48 130   
    49 131   .def_prop_rw("identity_version",
    50 132   nb::overload_cast<>(&Header::identity_version, nb::const_),
    51  - nb::overload_cast<VERSION>(&Header::identity_version),
    52  - "Return header's " RST_CLASS_REF(lief.ELF.VERSION) "."_doc)
     133 + nb::overload_cast<Header::VERSION>(&Header::identity_version))
    53 134   
    54 135   .def_prop_rw("identity_os_abi",
    55 136   nb::overload_cast<>(&Header::identity_os_abi, nb::const_),
    56  - nb::overload_cast<OS_ABI>(&Header::identity_os_abi),
    57  - "Identifies the version of the ABI for which the object is prepared (" RST_CLASS_REF(lief.ELF.OS_ABI) ")."_doc)
     137 + nb::overload_cast<Header::OS_ABI>(&Header::identity_os_abi),
     138 + "Identifies the version of the ABI for which the object is prepared."_doc)
    58 139   
    59 140   .def_prop_rw("identity_abi_version",
    60 141   nb::overload_cast<>(&Header::identity_abi_version, nb::const_),
    61  - nb::overload_cast<uint32_t>(&Header::identity_abi_version),
     142 + nb::overload_cast<uint8_t>(&Header::identity_abi_version),
    62 143   "Return the ABI version (integer)."_doc)
    63 144   
    64 145   .def_prop_rw("identity",
    skipped 24 lines
    89 170   
    90 171   .def_prop_rw("file_type",
    91 172   nb::overload_cast<>(&Header::file_type, nb::const_),
    92  - nb::overload_cast<E_TYPE>(&Header::file_type),
    93  - "Return binary's " RST_CLASS_REF(lief.ELF.E_TYPE) ". This field determines if the binary \
    94  - is a executable, a library..."_doc)
     173 + nb::overload_cast<Header::FILE_TYPE>(&Header::file_type),
     174 + "Return binary's type. This field determines if the binary is a "
     175 + "executable, a library..."_doc)
    95 176   
    96 177   .def_prop_rw("machine_type",
    97 178   nb::overload_cast<>(&Header::machine_type, nb::const_),
    98 179   nb::overload_cast<ARCH>(&Header::machine_type),
    99  - "Return the target architecture (" RST_CLASS_REF(lief.ELF.ARCH) ")"_doc)
     180 + "Return the target architecture"_doc)
    100 181   
    101 182   .def_prop_rw("object_file_version",
    102 183   nb::overload_cast<>(&Header::object_file_version, nb::const_),
    103  - nb::overload_cast<VERSION>(&Header::object_file_version),
    104  - "Return the " RST_CLASS_REF(lief.ELF.VERSION) ""_doc)
     184 + nb::overload_cast<Header::VERSION>(&Header::object_file_version),
     185 + "Return the version"_doc)
    105 186   
    106 187   .def_prop_rw("entrypoint",
    107 188   nb::overload_cast<>(&Header::entrypoint, nb::const_),
    skipped 15 lines
    123 204   nb::overload_cast<uint32_t>(&Header::processor_flag),
    124 205   "Processor-specific flags"_doc)
    125 206   
    126  - .def_prop_ro("arm_flags_list",
    127  - &Header::arm_flags_list,
    128  - "Return a list of " RST_CLASS_REF(lief.ELF.ARM_EFLAGS) " present in "
    129  - ":attr:`~lief.ELF.Header.processor_flag`"_doc,
    130  - nb::rv_policy::reference_internal)
    131  - 
    132  - .def_prop_ro("mips_flags_list",
    133  - &Header::mips_flags_list,
    134  - "Return a list of " RST_CLASS_REF(lief.ELF.MIPS_EFLAGS) " present in "
    135  - ":attr:`~lief.ELF.Header.processor_flag`"_doc,
    136  - nb::rv_policy::reference_internal)
    137  - 
    138  - .def_prop_ro("ppc64_flags_list",
    139  - &Header::ppc64_flags_list,
    140  - "Return a list of " RST_CLASS_REF(lief.ELF.PPC64_EFLAGS) " present in "
    141  - ":attr:`~lief.ELF.Header.processor_flag`"_doc,
    142  - nb::rv_policy::reference_internal)
    143  - 
    144  - .def_prop_ro("hexagon_flags_list",
    145  - &Header::hexagon_flags_list,
    146  - "Return a list of " RST_CLASS_REF(lief.ELF.HEXAGON_EFLAGS) " present in "
    147  - ":attr:`~lief.ELF.Header.processor_flag`"_doc,
    148  - nb::rv_policy::reference_internal)
     207 + .def("has", &Header::has,
     208 + "Check if the given processor flag is present"_doc)
    149 209   
    150  - .def_prop_ro("loongarch_flags_list",
    151  - &Header::loongarch_flags_list,
    152  - "Return a list of " RST_CLASS_REF(lief.ELF.LOONGARCH_EFLAGS) " present in "
    153  - ":attr:`~lief.ELF.Header.processor_flag`"_doc,
    154  - nb::rv_policy::reference_internal)
     210 + .def_prop_ro("flags_list", &Header::flags_list,
     211 + "Processor flags as a list"_doc)
    155 212   
    156 213   .def_prop_rw("header_size",
    157 214   nb::overload_cast<>(&Header::header_size, nb::const_),
    158 215   nb::overload_cast<uint32_t>(&Header::header_size),
    159 216   R"delim(
    160 217   Return the size of the ELF header
    161  - 
    162 218   This size should be 64 for an ``ELF64`` binary and 52 for an ``ELF32``.
    163 219   )delim"_doc)
    164 220   
    skipped 1 lines
    166 222   nb::overload_cast<>(&Header::program_header_size, nb::const_),
    167 223   nb::overload_cast<uint32_t>(&Header::program_header_size),
    168 224   R"delim(
    169  - Return the size of a Segment header (:class:`lief.ELF.Segment`)
    170  - 
    171  - This size should be 56 for a ``ELF64`` binary and 32 for an ``ELF32``.
     225 + Return the size of the raw ``Elfxx_Phdr`` structure (see :class:`lief.ELF.Segment`)
     226 + This size should be 56 for an ``ELF64`` binary and 32 for an ``ELF32``.
    172 227   )delim"_doc)
    173 228   
    174 229   .def_prop_rw("numberof_segments",
    skipped 5 lines
    180 235   nb::overload_cast<>(&Header::section_header_size, nb::const_),
    181 236   nb::overload_cast<uint32_t>(&Header::section_header_size),
    182 237   R"delim(
    183  - Return the size of a Section header (:class:`lief.ELF.Section`)
     238 + Return the size of the raw ``Elfxx_Shdr`` (:class:`lief.ELF.Section`)
    184 239   
    185  - This size should be 64 for a ``ELF64`` binary and 40 for an ``ELF32``.
     240 + This size should be 64 for an ``ELF64`` binary and 40 for an ``ELF32``.
    186 241   )delim"_doc)
    187 242   
    188 243   .def_prop_rw("numberof_sections",
    skipped 5 lines
    194 249   nb::overload_cast<>(&Header::section_name_table_idx, nb::const_),
    195 250   nb::overload_cast<uint32_t>(&Header::section_name_table_idx),
    196 251   "Return the section index which contains sections' names"_doc)
    197  - 
    198  - .def("__contains__",
    199  - nb::overload_cast<ARM_EFLAGS>(&Header::has, nb::const_),
    200  - "Check if the given " RST_CLASS_REF(lief.ELF.ARM_EFLAGS) " is present in "
    201  - ":attr:`~lief.ELF.Header.processor_flag`"_doc)
    202  - 
    203  - 
    204  - .def("__contains__",
    205  - nb::overload_cast<MIPS_EFLAGS>(&Header::has, nb::const_),
    206  - "Check if the given " RST_CLASS_REF(lief.ELF.MIPS_EFLAGS) " is present in "
    207  - ":attr:`~lief.ELF.Header.processor_flag`"_doc)
    208  - 
    209  - 
    210  - .def("__contains__",
    211  - nb::overload_cast<PPC64_EFLAGS>(&Header::has, nb::const_),
    212  - "Check if the given " RST_CLASS_REF(lief.ELF.PPC64_EFLAGS) " is present in "
    213  - ":attr:`~lief.ELF.Header.processor_flag`"_doc)
    214  - 
    215  - 
    216  - .def("__contains__",
    217  - nb::overload_cast<HEXAGON_EFLAGS>(&Header::has, nb::const_),
    218  - "Check if the given " RST_CLASS_REF(lief.ELF.HEXAGON_EFLAGS) " is present in "
    219  - ":attr:`~lief.ELF.Header.processor_flag`"_doc)
    220  - 
    221  - .def("__contains__",
    222  - nb::overload_cast<LOONGARCH_EFLAGS>(&Header::has, nb::const_),
    223  - "Check if the given " RST_CLASS_REF(lief.ELF.LOONGARCH_EFLAGS) " is present in "
    224  - ":attr:`~lief.ELF.Header.processor_flag`"_doc)
    225 252   
    226 253   LIEF_DEFAULT_STR(Header);
    227 254  }
    skipped 3 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyNote.cpp
    skipped 86 lines
    87 87   ;
    88 88   #undef ENTRY
    89 89   
    90  - const auto create_overload_0 = nb::overload_cast<const std::string&, uint32_t, Note::description_t, E_TYPE, ARCH, ELF_CLASS>(&Note::create);
    91  - const auto create_overload_1 = nb::overload_cast<const std::string&, Note::TYPE, Note::description_t, ARCH, ELF_CLASS>(&Note::create);
     90 + const auto create_overload_0 = nb::overload_cast<const std::string&, uint32_t, Note::description_t, Header::FILE_TYPE, ARCH, Header::CLASS>(&Note::create);
     91 + const auto create_overload_1 = nb::overload_cast<const std::string&, Note::TYPE, Note::description_t, ARCH, Header::CLASS>(&Note::create);
    92 92   note
    93 93   .def_static("create", create_overload_0,
    94 94   R"doc(
    skipped 3 lines
    98 98   Depending on the note, the filetype, the architecture and the ELF class might be needed.
    99 99   )doc"_doc,
    100 100   "name"_a, "original_type"_a, "description"_a,
    101  - "file_type"_a = E_TYPE::ET_NONE, "arch"_a = ARCH::EM_NONE, "cls"_a = ELF_CLASS::ELFCLASSNONE)
     101 + "file_type"_a = Header::FILE_TYPE::NONE, "arch"_a = ARCH::NONE, "cls"_a = Header::CLASS::NONE)
    102 102   
    103 103   .def_static("create",
    104  - [] (nb::bytes bytes, E_TYPE ftype, ARCH arch, ELF_CLASS cls) -> std::unique_ptr<Note> {
     104 + [] (nb::bytes bytes, Header::FILE_TYPE ftype, ARCH arch, Header::CLASS cls) -> std::unique_ptr<Note> {
    105 105   std::unique_ptr<LIEF::SpanStream> stream = to_stream(bytes);
    106 106   if (!stream) {
    107 107   return nullptr;
    skipped 7 lines
    115 115   be needed.
    116 116   )doc"_doc,
    117 117   "raw"_a,
    118  - "file_type"_a = E_TYPE::ET_NONE, "arch"_a = ARCH::EM_NONE,
    119  - "cls"_a = ELF_CLASS::ELFCLASSNONE)
     118 + "file_type"_a = Header::FILE_TYPE::NONE, "arch"_a = ARCH::NONE,
     119 + "cls"_a = Header::CLASS::NONE)
    120 120   
    121 121   .def_static("create", create_overload_1,
    122 122   R"doc(
    skipped 3 lines
    126 126   be needed.
    127 127   )doc"_doc,
    128 128   "name"_a, "type"_a, "description"_a,
    129  - "arch"_a = ARCH::EM_NONE, "cls"_a = ELF_CLASS::ELFCLASSNONE)
     129 + "arch"_a = ARCH::NONE, "cls"_a = Header::CLASS::NONE)
    130 130   
    131 131   .def_prop_rw("name",
    132 132   nb::overload_cast<>(&Note::name, nb::const_),
    skipped 34 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyParserConfig.cpp
    skipped 15 lines
    16 16  #include "ELF/pyELF.hpp"
    17 17  #include "LIEF/ELF/ParserConfig.hpp"
    18 18   
     19 +#include "enums_wrapper.hpp"
     20 + 
    19 21  namespace LIEF::ELF::py {
    20 22   
    21 23  template<>
    22 24  void create<ParserConfig>(nb::module_& m) {
    23 25   
    24  - nb::class_<ParserConfig>(m, "ParserConfig",
     26 + nb::class_<ParserConfig> pconfig(m, "ParserConfig",
    25 27   R"delim(
    26 28   This class is used to tweak the ELF Parser
    27  - )delim"_doc)
     29 + )delim"_doc);
     30 + 
     31 + enum_<ParserConfig::DYNSYM_COUNT>(pconfig, "DYNSYM_COUNT")
     32 + .value("AUTO", ParserConfig::DYNSYM_COUNT::AUTO)
     33 + .value("SECTION", ParserConfig::DYNSYM_COUNT::SECTION)
     34 + .value("HASH", ParserConfig::DYNSYM_COUNT::HASH)
     35 + .value("RELOCATIONS", ParserConfig::DYNSYM_COUNT::RELOCATIONS);
    28 36   
     37 + pconfig
    29 38   .def(nb::init<>())
    30 39   .def_rw("parse_relocations", &ParserConfig::parse_relocations,
    31 40   "Whether relocations (including plt-like relocations) should be parsed."_doc)
    skipped 29 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyRelocation.cpp
    skipped 17 lines
    18 18  #include <nanobind/stl/string.h>
    19 19   
    20 20  #include "ELF/pyELF.hpp"
     21 +#include "enums_wrapper.hpp"
    21 22   
    22 23  #include "LIEF/ELF/Relocation.hpp"
    23 24  #include "LIEF/ELF/Symbol.hpp"
    skipped 1 lines
    25 26   
    26 27  namespace LIEF::ELF::py {
    27 28   
     29 +void init_relocation_types(nb::class_<Relocation, LIEF::Relocation>& m);
     30 + 
    28 31  template<>
    29 32  void create<Relocation>(nb::module_& m) {
    30  - 
    31  - // Relocation object
    32  - nb::class_<Relocation, LIEF::Relocation>(m, "Relocation",
     33 + nb::class_<Relocation, LIEF::Relocation> reloc(m, "Relocation",
    33 34   R"delim(
    34 35   Class that represents an ELF relocation.
    35  - )delim"_doc)
     36 + )delim"_doc);
    36 37   
     38 + init_relocation_types(reloc);
     39 + 
     40 + enum_<Relocation::PURPOSE>(reloc, "PURPOSE")
     41 + .value("NONE", Relocation::PURPOSE::NONE)
     42 + .value("PLTGOT", Relocation::PURPOSE::PLTGOT)
     43 + .value("DYNAMIC", Relocation::PURPOSE::DYNAMIC)
     44 + .value("OBJECT", Relocation::PURPOSE::OBJECT);
     45 + 
     46 + reloc
    37 47   .def(nb::init<>())
    38 48   .def(nb::init<ARCH>(), "arch"_a)
    39  - .def(nb::init<uint64_t, uint32_t, int64_t, bool>(),
    40  - "address"_a, "type"_a = 0, "addend"_a = 0, "is_rela"_a = false)
     49 + .def(nb::init<uint64_t, Relocation::TYPE, bool>(),
     50 + "address"_a, "type"_a = Relocation::TYPE::UNKNOWN, "is_rela"_a = false)
    41 51   
    42 52   .def_prop_rw("addend",
    43 53   nb::overload_cast<>(&Relocation::addend, nb::const_),
    skipped 7 lines
    51 61   
    52 62   .def_prop_rw("purpose",
    53 63   nb::overload_cast<>(&Relocation::purpose, nb::const_),
    54  - nb::overload_cast<RELOCATION_PURPOSES>(&Relocation::purpose),
     64 + nb::overload_cast<Relocation::PURPOSE>(&Relocation::purpose),
    55 65   R"delim(
    56  - Purpose of the relocation (:class:`~lief.ELF.RELOCATION_PURPOSES`).
    57  - 
     66 + Purpose of the relocation.
    58 67   This value provides the information about how the relocation is used (PLT/GOT resolution, ``.o`` file, ...)
    59 68   )delim"_doc)
    60 69   
    61 70   .def_prop_rw("type",
    62 71   nb::overload_cast<>(&Relocation::type, nb::const_),
    63  - nb::overload_cast<uint32_t>(&Relocation::type),
    64  - R"delim(
    65  - Relocation type. This value depends on the underlying architecture.
    66  - 
    67  - See:
    68  - * :class:`~lief.ELF.RELOCATION_X86_64`
    69  - * :class:`~lief.ELF.RELOCATION_i386`
    70  - * :class:`~lief.ELF.RELOCATION_AARCH64`
    71  - * :class:`~lief.ELF.RELOCATION_ARM`
    72  - )delim"_doc)
     72 + nb::overload_cast<Relocation::TYPE>(&Relocation::type),
     73 + R"delim(Relocation type.)delim"_doc)
    73 74   
    74 75   .def_prop_ro("has_symbol",
    75 76   &Relocation::has_symbol,
    skipped 46 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pyRelocationTypes.cpp
     1 +/* Copyright 2017 - 2023 R. Thomas
     2 + * Copyright 2017 - 2023 Quarkslab
     3 + *
     4 + * Licensed under the Apache License, Version 2.0 (the "License");
     5 + * you may not use this file except in compliance with the License.
     6 + * You may obtain a copy of the License at
     7 + *
     8 + * http://www.apache.org/licenses/LICENSE-2.0
     9 + *
     10 + * Unless required by applicable law or agreed to in writing, software
     11 + * distributed under the License is distributed on an "AS IS" BASIS,
     12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 + * See the License for the specific language governing permissions and
     14 + * limitations under the License.
     15 + */
     16 +#include <string>
     17 +#include <sstream>
     18 +#include <nanobind/stl/string.h>
     19 + 
     20 +#include "ELF/pyELF.hpp"
     21 +#include "enums_wrapper.hpp"
     22 + 
     23 +#include "LIEF/ELF/Relocation.hpp"
     24 + 
     25 +namespace LIEF::ELF::py {
     26 + 
     27 +void init_relocation_types(nb::class_<Relocation, LIEF::Relocation>& m) {
     28 + 
     29 + #define ELF_RELOC(X, _) .value(to_string(Relocation::TYPE::X), Relocation::TYPE::X)
     30 + enum_<Relocation::TYPE>(m, "TYPE")
     31 + #include "LIEF/ELF/Relocations/x86_64.def"
     32 + #include "LIEF/ELF/Relocations/AArch64.def"
     33 + #include "LIEF/ELF/Relocations/ARM.def"
     34 + #include "LIEF/ELF/Relocations/Hexagon.def"
     35 + #include "LIEF/ELF/Relocations/i386.def"
     36 + #include "LIEF/ELF/Relocations/LoongArch.def"
     37 + #include "LIEF/ELF/Relocations/Mips.def"
     38 + #include "LIEF/ELF/Relocations/PowerPC.def"
     39 + #include "LIEF/ELF/Relocations/PowerPC64.def"
     40 + #include "LIEF/ELF/Relocations/Sparc.def"
     41 + #include "LIEF/ELF/Relocations/SystemZ.def"
     42 + ;
     43 + #undef ELF_RELOC
     44 +}
     45 + 
     46 +}
     47 + 
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pySection.cpp
    skipped 14 lines
    15 15   */
    16 16  #include "ELF/pyELF.hpp"
    17 17  #include "pyIterator.hpp"
     18 +#include "enums_wrapper.hpp"
    18 19   
    19 20  #include <nanobind/operators.h>
    20 21  #include <nanobind/stl/string.h>
    skipped 14 lines
    35 36   using namespace LIEF::py;
    36 37   
    37 38   nb::class_<Section, LIEF::Section> sec(m, "Section",
    38  - R"delim(
    39  - Class which represents an ELF section.
    40  - )delim"_doc);
     39 + R"delim(
     40 + Class which represents an ELF section.
     41 + )delim"_doc
     42 + );
    41 43   
    42 44   init_ref_iterator<Section::it_segments>(sec, "it_segments");
    43 45   
     46 + #define ENTRY(X) .value(to_string(Section::FLAGS::X), Section::FLAGS::X)
     47 + enum_<Section::FLAGS>(sec, "FLAGS", nb::is_arithmetic())
     48 + ENTRY(NONE)
     49 + ENTRY(WRITE)
     50 + ENTRY(ALLOC)
     51 + ENTRY(EXECINSTR)
     52 + ENTRY(MERGE)
     53 + ENTRY(STRINGS)
     54 + ENTRY(INFO_LINK)
     55 + ENTRY(LINK_ORDER)
     56 + ENTRY(OS_NONCONFORMING)
     57 + ENTRY(GROUP)
     58 + ENTRY(TLS)
     59 + ENTRY(COMPRESSED)
     60 + ENTRY(GNU_RETAIN)
     61 + ENTRY(EXCLUDE)
     62 + ENTRY(XCORE_SHF_DP_SECTION)
     63 + ENTRY(XCORE_SHF_CP_SECTION)
     64 + ENTRY(X86_64_LARGE)
     65 + ENTRY(HEX_GPREL)
     66 + 
     67 + ENTRY(MIPS_NODUPES)
     68 + ENTRY(MIPS_NAMES)
     69 + ENTRY(MIPS_LOCAL)
     70 + ENTRY(MIPS_NOSTRIP)
     71 + ENTRY(MIPS_GPREL)
     72 + ENTRY(MIPS_MERGE)
     73 + ENTRY(MIPS_ADDR)
     74 + ENTRY(MIPS_STRING)
     75 + ENTRY(ARM_PURECODE)
     76 + ;
     77 + #undef ENTRY
     78 + 
     79 + #define ENTRY(X) .value(to_string(Section::TYPE::X), Section::TYPE::X)
     80 + enum_<Section::TYPE>(sec, "TYPE")
     81 + ENTRY(SHT_NULL)
     82 + ENTRY(PROGBITS)
     83 + ENTRY(SYMTAB)
     84 + ENTRY(STRTAB)
     85 + ENTRY(RELA)
     86 + ENTRY(HASH)
     87 + ENTRY(DYNAMIC)
     88 + ENTRY(NOTE)
     89 + ENTRY(NOBITS)
     90 + ENTRY(REL)
     91 + ENTRY(SHLIB)
     92 + ENTRY(DYNSYM)
     93 + ENTRY(INIT_ARRAY)
     94 + ENTRY(FINI_ARRAY)
     95 + ENTRY(PREINIT_ARRAY)
     96 + ENTRY(GROUP)
     97 + ENTRY(SYMTAB_SHNDX)
     98 + ENTRY(RELR)
     99 + 
     100 + ENTRY(ANDROID_REL)
     101 + ENTRY(ANDROID_RELA)
     102 + ENTRY(LLVM_ADDRSIG)
     103 + ENTRY(ANDROID_RELR)
     104 + ENTRY(GNU_ATTRIBUTES)
     105 + ENTRY(GNU_HASH)
     106 + ENTRY(GNU_VERDEF)
     107 + ENTRY(GNU_VERNEED)
     108 + ENTRY(GNU_VERSYM)
     109 + 
     110 + ENTRY(ARM_EXIDX)
     111 + ENTRY(ARM_PREEMPTMAP)
     112 + ENTRY(ARM_ATTRIBUTES)
     113 + ENTRY(ARM_DEBUGOVERLAY)
     114 + ENTRY(ARM_OVERLAYSECTION)
     115 + ENTRY(HEX_ORDERED)
     116 + ENTRY(X86_64_UNWIND)
     117 + ENTRY(MIPS_REGINFO)
     118 + ENTRY(MIPS_OPTIONS)
     119 + ENTRY(MIPS_ABIFLAGS)
     120 + ;
     121 + #undef ENTRY
     122 + 
    44 123   sec
    45 124   .def(nb::init<>(),
    46 125   "Default constructor"_doc)
    skipped 5 lines
    52 131   .def_prop_ro("is_frame",
    53 132   &Section::is_frame)
    54 133   
    55  - .def(nb::init<const std::string&, ELF_SECTION_TYPES>(),
     134 + .def(nb::init<const std::string&, Section::TYPE>(),
    56 135   "Constructor from a name and a section type"_doc,
    57  - "name"_a, "type"_a = ELF_SECTION_TYPES::SHT_PROGBITS)
    58  - 
    59  - //.def(nb::init([] (Section& section, std::vector<uint8_t>& content, ELF_CLASS type) {
    60  - // return new Section(content.data(), type);
    61  - // }))
     136 + "name"_a, "type"_a = Section::TYPE::PROGBITS)
    62 137   
    63 138   .def_prop_rw("type",
    64 139   nb::overload_cast<>(&Section::type, nb::const_),
    65  - nb::overload_cast<ELF_SECTION_TYPES>(&Section::type),
    66  - "Return the " RST_CLASS_REF(lief.ELF.SECTION_TYPES) ""_doc)
     140 + nb::overload_cast<Section::TYPE>(&Section::type),
     141 + "Return the type of the section"_doc)
    67 142   
    68 143   .def_prop_rw("flags",
    69 144   nb::overload_cast<>(&Section::flags, nb::const_),
    70 145   nb::overload_cast<uint64_t>(&Section::flags),
    71 146   "Return the section's flags as an integer"_doc)
    72 147   
    73  - .def_prop_ro("flags_list",
    74  - &Section::flags_list,
    75  - "Return section's flags as a list of " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) ""_doc)
     148 + .def_prop_ro("flags_list", &Section::flags_list,
     149 + "Return section's flags as a list"_doc)
    76 150   
    77 151   .def_prop_rw("file_offset",
    78 152   nb::overload_cast<>(&Section::file_offset, nb::const_),
    skipped 49 lines
    128 202   "value"_a = 0,
    129 203   nb::rv_policy::reference_internal)
    130 204   
    131  - .def("add",
    132  - &Section::add,
    133  - "Add the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " to the list of "
    134  - ":attr:`~lief.ELF.Section.flags`"_doc,
     205 + .def("add", &Section::add,
     206 + "Add the given flag to the list of :attr:`~lief.ELF.Section.flags`"_doc,
    135 207   "flag"_a)
    136 208   
    137  - .def("remove",
    138  - &Section::remove,
    139  - "Remove the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " from the list of "
    140  - ":attr:`~lief.ELF.Section.flags`"_doc,
     209 + .def("remove", &Section::remove,
     210 + "Remove the given flag from the list of " ":attr:`~lief.ELF.Section.flags`"_doc,
    141 211   "flag"_a)
    142 212   
    143 213   .def("has",
    144  - nb::overload_cast<ELF_SECTION_FLAGS>(&Section::has, nb::const_),
    145  - "Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present"_doc,
     214 + nb::overload_cast<Section::FLAGS>(&Section::has, nb::const_),
     215 + "Check if the given flag is present"_doc,
    146 216   "flag"_a)
    147 217   
    148 218   .def("has",
    skipped 2 lines
    151 221   "in :attr:`~lief.ELF.Section.segments`"_doc,
    152 222   "segment"_a)
    153 223   
    154  - .def(nb::self += ELF_SECTION_FLAGS())
    155  - .def(nb::self -= ELF_SECTION_FLAGS())
     224 + .def(nb::self += Section::FLAGS())
     225 + .def(nb::self -= Section::FLAGS())
    156 226   
    157 227   .def("__contains__",
    158  - nb::overload_cast<ELF_SECTION_FLAGS>(&Section::has, nb::const_),
    159  - "Check if the given " RST_CLASS_REF(lief.ELF.SECTION_FLAGS) " is present"_doc)
     228 + nb::overload_cast<Section::FLAGS>(&Section::has, nb::const_),
     229 + "Check if the given flag is present"_doc)
    160 230   
    161 231   
    162 232   .def("__contains__",
    skipped 10 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pySegment.cpp
    1  -/* Copyright 2017 - 2023 R. Thomas
     1 +/* opyright 2017 - 2023 R. Thomas
    2 2   * Copyright 2017 - 2023 Quarkslab
    3 3   *
    4 4   * Licensed under the Apache License, Version 2.0 (the "License");
    skipped 24 lines
    29 29  #include "pyIterator.hpp"
    30 30  #include "nanobind/extra/memoryview.hpp"
    31 31   
     32 +#include "enums_wrapper.hpp"
     33 + 
    32 34  namespace LIEF::ELF::py {
    33 35   
    34 36  template<>
    skipped 1 lines
    36 38   using namespace LIEF::py;
    37 39   
    38 40   nb::class_<Segment, LIEF::Object> seg(m, "Segment",
    39  - R"delim(
    40  - Class which represents the ELF segments
    41  - )delim"_doc);
     41 + R"delim(
     42 + Class which represents the ELF segments
     43 + )delim"_doc
     44 + );
    42 45   
    43 46   init_ref_iterator<Segment::it_sections>(seg, "it_sections");
    44 47   
     48 + #define ENTRY(X) .value(to_string(Segment::TYPE::X), Segment::TYPE::X)
     49 + enum_<Segment::TYPE>(seg, "TYPE")
     50 + ENTRY(PT_NULL)
     51 + ENTRY(LOAD)
     52 + ENTRY(DYNAMIC)
     53 + ENTRY(INTERP)
     54 + ENTRY(NOTE)
     55 + ENTRY(SHLIB)
     56 + ENTRY(PHDR)
     57 + ENTRY(TLS)
     58 + ENTRY(GNU_EH_FRAME)
     59 + ENTRY(GNU_STACK)
     60 + ENTRY(GNU_PROPERTY)
     61 + ENTRY(GNU_RELRO)
     62 + ENTRY(ARM_ARCHEXT)
     63 + ENTRY(ARM_EXIDX)
     64 + ENTRY(ARM_UNWIND)
     65 + ENTRY(AARCH64_MEMTAG_MTE)
     66 + ENTRY(MIPS_REGINFO)
     67 + ENTRY(MIPS_RTPROC)
     68 + ENTRY(MIPS_OPTIONS)
     69 + ENTRY(MIPS_ABIFLAGS)
     70 + ENTRY(RISCV_ATTRIBUTES)
     71 + ;
     72 + #undef ENTRY
     73 + 
     74 + #define ENTRY(X) .value(to_string(Segment::FLAGS::X), Segment::FLAGS::X)
     75 + enum_<Segment::FLAGS>(seg, "FLAGS", nb::is_arithmetic())
     76 + ENTRY(R)
     77 + ENTRY(W)
     78 + ENTRY(X)
     79 + ENTRY(NONE)
     80 + ;
     81 + #undef ENTRY
     82 + 
    45 83   seg
    46 84   .def(nb::init<>())
    47 85   .def_static("from_raw",
    skipped 5 lines
    53 91   
    54 92   .def_prop_rw("type",
    55 93   nb::overload_cast<>(&Segment::type, nb::const_),
    56  - nb::overload_cast<SEGMENT_TYPES>(&Segment::type),
    57  - "Segment's type: " RST_CLASS_REF(lief.ELF.SEGMENT_TYPES) ""_doc)
     94 + nb::overload_cast<Segment::TYPE>(&Segment::type),
     95 + "Segment's type"_doc)
    58 96   
    59 97   .def_prop_rw("flags",
    60 98   nb::overload_cast<>(&Segment::flags, nb::const_),
    61  - nb::overload_cast<ELF_SEGMENT_FLAGS>(&Segment::flags),
     99 + nb::overload_cast<Segment::FLAGS>(&Segment::flags),
    62 100   "The flag permissions associated with this segment"_doc)
    63 101   
    64 102   .def_prop_rw("file_offset",
    skipped 19 lines
    84 122   nb::overload_cast<>(&Segment::physical_address, nb::const_),
    85 123   nb::overload_cast<uint64_t>(&Segment::physical_address),
    86 124   R"delim(
    87  - The physical address of the segment.
    88  - This value is not really relevant on systems like Linux or Android. On the other hand,
    89  - Qualcomm trustlets might use this value.
     125 + The physical address of the segment. This value is not really relevant
     126 + on systems like Linux or Android. On the other hand, Qualcomm trustlets
     127 + might use this value.
    90 128   
    91 129   Usually this value matches :attr:`~lief.ELF.Segment.virtual_address`
    92 130   )delim"_doc)
    skipped 26 lines
    119 157   nb::overload_cast<std::vector<uint8_t>>(&Segment::content),
    120 158   "The raw data associated with this segment."_doc)
    121 159   
    122  - .def("add",
    123  - &Segment::add,
    124  - "Add the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " to the list of "
    125  - ":attr:`~lief.ELF.Segment.flags`"_doc,
     160 + .def("add", &Segment::add,
     161 + "Add the given flag to the list of :attr:`~lief.ELF.Segment.flags`"_doc,
    126 162   "flag"_a)
    127 163   
    128  - .def("remove",
    129  - &Segment::remove,
    130  - "Remove the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " from the list of "
    131  - ":attr:`~lief.ELF.Segment.flags`"_doc,
     164 + .def("remove", &Segment::remove,
     165 + "Remove the given flag from the list of :attr:`~lief.ELF.Segment.flags`"_doc,
    132 166   "flag"_a)
    133 167   
    134 168   .def("has",
    135  - nb::overload_cast<ELF_SEGMENT_FLAGS>(&Segment::has, nb::const_),
    136  - "Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present"_doc,
     169 + nb::overload_cast<Segment::FLAGS>(&Segment::has, nb::const_),
     170 + "Check if the given flag is present"_doc,
    137 171   "flag"_a)
    138 172   
    139 173   .def("has",
    skipped 13 lines
    153 187   "Iterator over the " RST_CLASS_REF(lief.ELF.Section) " wrapped by this segment"_doc,
    154 188   nb::keep_alive<0, 1>())
    155 189   
    156  - .def(nb::self += ELF_SEGMENT_FLAGS())
    157  - .def(nb::self -= ELF_SEGMENT_FLAGS())
     190 + .def(nb::self += Segment::FLAGS())
     191 + .def(nb::self -= Segment::FLAGS())
    158 192   
    159 193   .def("__contains__",
    160  - nb::overload_cast<ELF_SEGMENT_FLAGS>(&Segment::has, nb::const_),
    161  - "Check if the given " RST_CLASS_REF(lief.ELF.SEGMENT_FLAGS) " is present"_doc)
     194 + nb::overload_cast<Segment::FLAGS>(&Segment::has, nb::const_),
     195 + "Check if the given flag is present"_doc)
    162 196   
    163 197   .def("__contains__",
    164 198   nb::overload_cast<const Section&>(&Segment::has, nb::const_),
    skipped 14 lines
  • ■ ■ ■ ■ ■
    api/python/src/ELF/objects/pySymbol.cpp
    skipped 14 lines
    15 15   */
    16 16  #include "ELF/pyELF.hpp"
    17 17  #include "pyIterator.hpp"
     18 +#include "enums_wrapper.hpp"
    18 19   
    19 20  #include "LIEF/ELF/Symbol.hpp"
    20 21  #include "LIEF/ELF/SymbolVersion.hpp"
    skipped 8 lines
    29 30  template<>
    30 31  void create<Symbol>(nb::module_& m) {
    31 32   
    32  - nb::class_<Symbol, LIEF::Symbol>(m, "Symbol",
     33 + nb::class_<Symbol, LIEF::Symbol> sym(m, "Symbol",
    33 34   R"delim(
    34  - "Class which represents an ELF symbol"
    35  - )delim")
     35 + Class which represents an ELF symbol
     36 + )delim"_doc);
     37 + 
     38 + #define ENTRY(X) .value(to_string(Symbol::BINDING::X), Symbol::BINDING::X)
     39 + enum_<Symbol::BINDING>(sym, "BINDING")
     40 + ENTRY(LOCAL)
     41 + ENTRY(GLOBAL)
     42 + ENTRY(WEAK)
     43 + ENTRY(GNU_UNIQUE)
     44 + ;
     45 + #undef ENTRY
     46 + 
     47 + #define ENTRY(X) .value(to_string(Symbol::TYPE::X), Symbol::TYPE::X)
     48 + enum_<Symbol::TYPE>(sym, "TYPE")
     49 + ENTRY(NOTYPE)
     50 + ENTRY(OBJECT)
     51 + ENTRY(FUNC)
     52 + ENTRY(SECTION)
     53 + ENTRY(FILE)
     54 + ENTRY(COMMON)
     55 + ENTRY(TLS)
     56 + ENTRY(GNU_IFUNC)
     57 + ;
     58 + #undef ENTRY
     59 + 
     60 + #define ENTRY(X) .value(to_string(Symbol::VISIBILITY::X), Symbol::VISIBILITY::X)
     61 + enum_<Symbol::VISIBILITY>(sym, "VISIBILITY")
     62 + ENTRY(DEFAULT)
     63 + ENTRY(INTERNAL)
     64 + ENTRY(HIDDEN)
     65 + ENTRY(PROTECTED)
     66 + ;
     67 + #undef ENTRY
     68 + 
     69 + sym
    36 70   .def(nb::init<>())
    37 71   .def_prop_ro("demangled_name",
    38 72   &Symbol::demangled_name,
    skipped 1 lines
    40 74   
    41 75   .def_prop_rw("type",
    42 76   nb::overload_cast<>(&Symbol::type, nb::const_),
    43  - nb::overload_cast<ELF_SYMBOL_TYPES>(&Symbol::type),
    44  - "The symbol's type provides a general classification for the associated entity. "
    45  - "See: " RST_CLASS_REF(lief.ELF.SYMBOL_TYPES) ""_doc)
     77 + nb::overload_cast<Symbol::TYPE>(&Symbol::type),
     78 + "The symbol's type provides a general classification for the associated entity."_doc)
    46 79   
    47 80   .def_prop_rw("binding",
    48 81   nb::overload_cast<>(&Symbol::binding, nb::const_),
    49  - nb::overload_cast<SYMBOL_BINDINGS>(&Symbol::binding),
    50  - "A symbol's binding determines the linkage visibility and behavior. "
    51  - "See " RST_CLASS_REF(lief.ELF.SYMBOL_BINDINGS) ""_doc)
     82 + nb::overload_cast<Symbol::BINDING>(&Symbol::binding),
     83 + "A symbol's binding determines the linkage visibility and behavior."_doc)
    52 84   
    53 85   .def_prop_rw("information",
    54 86   nb::overload_cast<>(&Symbol::information, nb::const_),
    skipped 7 lines
    62 94   
    63 95   .def_prop_rw("visibility",
    64 96   nb::overload_cast<>(&Symbol::visibility, nb::const_),
    65  - nb::overload_cast<ELF_SYMBOL_VISIBILITY>(&Symbol::visibility),
     97 + nb::overload_cast<Symbol::VISIBILITY>(&Symbol::visibility),
    66 98   R"delim(
    67  - Symbol :class:`~lief.ELF.SYMBOL_VISIBILITY`.
    68  - It's basically an alias on :attr:`~lief.ELF.Symbol.other`
     99 + Symbol visibility. It's basically an alias on :attr:`~.Symbol.other`
    69 100   )delim"_doc)
    70 101   
    71 102   .def_prop_rw("value", // Even though it is already defined in the base class (Abstract/Symbol)
    skipped 71 lines
  • ■ ■ ■ ■
    api/python/src/ELF/objects/pySymbolVersionAux.cpp
    skipped 32 lines
    33 33   [] (const SymbolVersionAux& obj) {
    34 34   return LIEF::py::safe_string(obj.name());
    35 35   },
    36  - nb::overload_cast<const std::string&>(&SymbolVersionAux::name),
     36 + nb::overload_cast<std::string>(&SymbolVersionAux::name),
    37 37   "Symbol's name (e.g. ``GLIBC_2.2.5``)"_doc)
    38 38   
    39 39   LIEF_DEFAULT_STR(SymbolVersionAux);
    skipped 3 lines
  • ■ ■ ■ ■ ■ ■
    api/python/src/ELF/pyProcessorFlags.cpp
     1 +/* Copyright 2017 - 2023 R. Thomas
     2 + * Copyright 2017 - 2023 Quarkslab
     3 + *
     4 + * Licensed under the Apache License, Version 2.0 (the "License");
     5 + * you may not use this file except in compliance with the License.
     6 + * You may obtain a copy of the License at
     7 + *
     8 + * http://www.apache.org/licenses/LICENSE-2.0
     9 + *
     10 + * Unless required by applicable law or agreed to in writing, software
     11 + * distributed under the License is distributed on an "AS IS" BASIS,
     12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 + * See the License for the specific language governing permissions and
     14 + * limitations under the License.
     15 + */
     16 +#include <string>
     17 + 
     18 +#include "ELF/pyELF.hpp"
     19 +#include "enums_wrapper.hpp"
     20 + 
     21 +#include "LIEF/ELF/ProcessorFlags.hpp"
     22 + 
     23 +namespace LIEF::ELF::py {
     24 + 
     25 +template<>
     26 +void create<PROCESSOR_FLAGS>(nb::module_& m) {
     27 + #define ENTRY(X) .value(to_string(PROCESSOR_FLAGS::X), PROCESSOR_FLAGS::X)
     28 + enum_<PROCESSOR_FLAGS>(m, "PROCESSOR_FLAGS")
     29 + ENTRY(ARM_EABI_UNKNOWN)
     30 + ENTRY(ARM_SOFT_FLOAT)
     31 + ENTRY(ARM_VFP_FLOAT)
     32 + ENTRY(ARM_EABI_VER1)
     33 + ENTRY(ARM_EABI_VER2)
     34 + ENTRY(ARM_EABI_VER3)
     35 + ENTRY(ARM_EABI_VER4)
     36 + ENTRY(ARM_EABI_VER5)
     37 + ENTRY(HEXAGON_MACH_V2)
     38 + ENTRY(HEXAGON_MACH_V3)
     39 + ENTRY(HEXAGON_MACH_V4)
     40 + ENTRY(HEXAGON_MACH_V5)
     41 + ENTRY(HEXAGON_ISA_V2)
     42 + ENTRY(HEXAGON_ISA_V3)
     43 + ENTRY(HEXAGON_ISA_V4)
     44 + ENTRY(HEXAGON_ISA_V5)
     45 + ENTRY(LOONGARCH_ABI_SOFT_FLOAT)
     46 + ENTRY(LOONGARCH_ABI_SINGLE_FLOAT)
     47 + ENTRY(LOONGARCH_ABI_DOUBLE_FLOAT)
     48 + ENTRY(MIPS_NOREORDER)
     49 + ENTRY(MIPS_PIC)
     50 + ENTRY(MIPS_CPIC)
     51 + ENTRY(MIPS_ABI2)
     52 + ENTRY(MIPS_32BITMODE)
     53 + ENTRY(MIPS_FP64)
     54 + ENTRY(MIPS_NAN2008)
     55 + ENTRY(MIPS_ABI_O32)
     56 + ENTRY(MIPS_ABI_O64)
     57 + ENTRY(MIPS_ABI_EABI32)
     58 + ENTRY(MIPS_ABI_EABI64)
     59 + ENTRY(MIPS_MACH_3900)
     60 + ENTRY(MIPS_MACH_4010)
     61 + ENTRY(MIPS_MACH_4100)
     62 + ENTRY(MIPS_MACH_4650)
     63 + ENTRY(MIPS_MACH_4120)
     64 + ENTRY(MIPS_MACH_4111)
     65 + ENTRY(MIPS_MACH_SB1)
     66 + ENTRY(MIPS_MACH_OCTEON)
     67 + ENTRY(MIPS_MACH_XLR)
     68 + ENTRY(MIPS_MACH_OCTEON2)
     69 + ENTRY(MIPS_MACH_OCTEON3)
     70 + ENTRY(MIPS_MACH_5400)
     71 + ENTRY(MIPS_MACH_5900)
     72 + ENTRY(MIPS_MACH_5500)
     73 + ENTRY(MIPS_MACH_9000)
     74 + ENTRY(MIPS_MACH_LS2E)
     75 + ENTRY(MIPS_MACH_LS2F)
     76 + ENTRY(MIPS_MACH_LS3A)
     77 + ENTRY(MIPS_MICROMIPS)
     78 + ENTRY(MIPS_ARCH_ASE_M16)
     79 + ENTRY(MIPS_ARCH_ASE_MDMX)
     80 + ENTRY(MIPS_ARCH_1)
     81 + ENTRY(MIPS_ARCH_2)
     82 + ENTRY(MIPS_ARCH_3)
     83 + ENTRY(MIPS_ARCH_4)
     84 + ENTRY(MIPS_ARCH_5)
     85 + ENTRY(MIPS_ARCH_32)
     86 + ENTRY(MIPS_ARCH_64)
     87 + ENTRY(MIPS_ARCH_32R2)
     88 + ENTRY(MIPS_ARCH_64R2)
     89 + ENTRY(MIPS_ARCH_32R6)
     90 + ENTRY(MIPS_ARCH_64R6)
     91 + ;
     92 + #undef ENTRY
     93 + 
     94 +}
     95 + 
     96 +}
     97 + 
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/api/c/elf.rst
    skipped 21 lines
    22 22  .. autodoxygenfile:: LIEF/ELF/enums.h
    23 23   :project: lief
    24 24   
    25  -.. autodoxygenfile:: LIEF/ELF/EnumToString.h
    26  - :project: lief
    27  - 
    28 25  .. autodoxygenfile:: LIEF/ELF/utils.h
    29 26   :project: lief
    30 27   
  • ■ ■ ■ ■ ■
    doc/sphinx/api/cpp/elf.rst
    skipped 275 lines
    276 276   
    277 277  ----------
    278 278   
    279  - 
    280  - 
    281 279  Enums
    282 280  *****
    283 281   
    skipped 2 lines
    286 284   
    287 285  .. doxygenenum:: LIEF::ELF::ARCH
    288 286   
    289  -----------
    290  - 
    291  -Identity
    292  -~~~~~~~~
    293  - 
    294  -.. doxygenenum:: LIEF::ELF::IDENTITY
    295  - 
    296  -----------
    297  - 
    298  -Binary types
    299  -~~~~~~~~~~~~
    300  - 
    301  -.. doxygenenum:: LIEF::ELF::E_TYPE
    302  - 
    303  -----------
    304  - 
    305  -Version
    306  -~~~~~~~
    307  - 
    308  -.. doxygenenum:: LIEF::ELF::VERSION
    309  - 
    310  -----------
    311  - 
    312  -ELF Class
    313  -~~~~~~~~~
    314  - 
    315  -.. doxygenenum:: LIEF::ELF::ELF_CLASS
    316  - 
    317  -----------
    318  - 
    319  -ELF Data
    320  -~~~~~~~~
    321  - 
    322  -.. doxygenenum:: LIEF::ELF::ELF_DATA
    323  - 
    324  -----------
    325  - 
    326  -ELF OS/ABI
    327  -~~~~~~~~~~
    328  - 
    329  -.. doxygenenum:: LIEF::ELF::OS_ABI
    330  - 
    331  -----------
    332  - 
    333  -Symbol section index
    334  -~~~~~~~~~~~~~~~~~~~~
    335  - 
    336  -.. doxygenenum:: LIEF::ELF::SYMBOL_SECTION_INDEX
    337  - 
    338  -----------
    339  - 
    340  -Section types
    341  -~~~~~~~~~~~~~
    342  - 
    343  -.. doxygenenum:: LIEF::ELF::ELF_SECTION_TYPES
    344  - 
    345  -----------
    346  - 
    347  -Section flags
    348  -~~~~~~~~~~~~~
    349  - 
    350  -.. doxygenenum:: LIEF::ELF::ELF_SECTION_FLAGS
    351  - 
    352  -----------
    353  - 
    354  -Symbol bindings
     287 +Processor Flags
    355 288  ~~~~~~~~~~~~~~~
    356 289   
    357  -.. doxygenenum:: LIEF::ELF::SYMBOL_BINDINGS
    358  - 
    359  -----------
    360  - 
    361  -Symbol visibility
    362  -~~~~~~~~~~~~~~~~~
    363  - 
    364  -.. doxygenenum:: LIEF::ELF::ELF_SYMBOL_VISIBILITY
    365  - 
    366  -----------
    367  - 
    368  -Symbol types
    369  -~~~~~~~~~~~~
    370  - 
    371  -.. doxygenenum:: LIEF::ELF::ELF_SYMBOL_TYPES
    372  - 
    373  -----------
    374  - 
    375  - 
    376  -Segment types
    377  -~~~~~~~~~~~~~
    378  - 
    379  -.. doxygenenum:: LIEF::ELF::SEGMENT_TYPES
    380  - 
    381  -----------
    382  - 
    383  -Segment flags
    384  -~~~~~~~~~~~~~
    385  - 
    386  -.. doxygenenum:: LIEF::ELF::ELF_SEGMENT_FLAGS
    387  - 
    388  -----------
    389  - 
    390  -Dynamic tags
    391  -~~~~~~~~~~~~
    392  - 
    393  -.. doxygenenum:: LIEF::ELF::DYNAMIC_TAGS
    394  - 
    395  -----------
    396  - 
    397  -Dynamic flags
    398  -~~~~~~~~~~~~~
    399  -.. doxygenenum:: LIEF::ELF::DYNAMIC_FLAGS
    400  - 
    401  -----------
    402  - 
    403  -Dynamic flags 1
    404  -~~~~~~~~~~~~~~~
    405  -.. doxygenenum:: LIEF::ELF::DYNAMIC_FLAGS_1
    406  - 
    407  -----------
    408  - 
    409  -Dynamic symbols counting
    410  -~~~~~~~~~~~~~~~~~~~~~~~~
    411  - 
    412  -.. doxygenenum:: LIEF::ELF::DYNSYM_COUNT_METHODS
    413  - 
    414  -----------
    415  - 
    416  - 
    417  -Relocation purpose
    418  -~~~~~~~~~~~~~~~~~~
    419  - 
    420  -.. doxygenenum:: LIEF::ELF::RELOCATION_PURPOSES
    421  - 
    422  -----------
    423  - 
    424  -Relocations x86-64
    425  -~~~~~~~~~~~~~~~~~~
    426  - 
    427  -.. doxygenenum:: LIEF::ELF::RELOC_x86_64
    428  - 
    429  -----------
    430  - 
    431  - 
    432  -Relocations x86 (i386)
    433  -~~~~~~~~~~~~~~~~~~~~~~
    434  - 
    435  -.. doxygenenum:: LIEF::ELF::RELOC_i386
    436  - 
    437  -----------
    438  - 
    439  -Relocations ARM
    440  -~~~~~~~~~~~~~~~
    441  - 
    442  -.. doxygenenum:: LIEF::ELF::RELOC_ARM
    443  - 
    444  -----------
    445  - 
    446  -Relocations AARCH64
    447  -~~~~~~~~~~~~~~~~~~~
    448  - 
    449  -.. doxygenenum:: LIEF::ELF::RELOC_AARCH64
    450  - 
    451  - 
    452  -Relocations MIPS
    453  -~~~~~~~~~~~~~~~~
    454  - 
    455  -.. doxygenenum:: LIEF::ELF::RELOC_MIPS
    456  - 
    457  - 
    458  -Relocations PPC
    459  -~~~~~~~~~~~~~~~~
    460  - 
    461  -.. doxygenenum:: LIEF::ELF::RELOC_POWERPC32
    462  - 
    463  - 
    464  -Relocations PPC64
    465  -~~~~~~~~~~~~~~~~~
    466  - 
    467  -.. doxygenenum:: LIEF::ELF::RELOC_POWERPC64
     290 +.. doxygenenum:: LIEF::ELF::PROCESSOR_FLAGS
    468 291   
    469 292   
  • ■ ■ ■ ■ ■
    doc/sphinx/api/python/elf.rst
    skipped 263 lines
    264 264  Enums
    265 265  *****
    266 266   
    267  -Identity
    268  -~~~~~~~~
    269  - 
    270  -.. autoclass:: lief.ELF.IDENTITY
    271  - 
    272  -----------
    273  - 
    274  -ELF Class
    275  -~~~~~~~~~
    276  - 
    277  -.. autoclass:: lief.ELF.ELF_CLASS
    278  - 
    279  -----------
    280  - 
    281  -ELF Data
    282  -~~~~~~~~
    283  - 
    284  -.. autoclass:: lief.ELF.ELF_DATA
    285  - 
    286  -----------
    287  - 
    288  -ELF OS/ABI
    289  -~~~~~~~~~~
    290  - 
    291  -.. autoclass:: lief.ELF.OS_ABI
    292  - 
    293  -----------
    294  - 
    295  -Symbol section index
    296  -~~~~~~~~~~~~~~~~~~~~
    297  - 
    298  -.. autoclass:: lief.ELF.SYMBOL_SECTION_INDEX
    299  - 
    300  -----------
    301  - 
    302  -Binary types
    303  -~~~~~~~~~~~~
    304  - 
    305  -.. autoclass:: lief.ELF.E_TYPE
    306  - 
    307  -----------
    308  - 
    309  -Section types
    310  -~~~~~~~~~~~~~
    311  - 
    312  -.. autoclass:: lief.ELF.SECTION_TYPES
    313  - 
    314  -----------
    315  - 
    316  -Section flags
    317  -~~~~~~~~~~~~~
    318  - 
    319  -.. autoclass:: lief.ELF.SECTION_FLAGS
    320  - 
    321  -----------
    322  - 
    323  - 
    324  -Segment types
    325  -~~~~~~~~~~~~~
    326  - 
    327  -.. autoclass:: lief.ELF.SEGMENT_TYPES
    328  - 
    329  -----------
    330  - 
    331  -Segment flags
    332  -~~~~~~~~~~~~~
    333  - 
    334  -.. autoclass:: lief.ELF.SEGMENT_FLAGS
    335  - 
    336  -----------
    337  - 
    338  - 
    339 267  Architectures
    340 268  ~~~~~~~~~~~~~
    341 269   
    342 270  .. autoclass:: lief.ELF.ARCH
    343 271   
    344  -----------
    345  - 
    346  -Version
    347  -~~~~~~~
    348  - 
    349  -.. autoclass:: lief.ELF.VERSION
    350  - 
    351  -----------
    352  - 
    353  -Dynamic tags
    354  -~~~~~~~~~~~~
    355  - 
    356  -.. autoclass:: lief.ELF.DYNAMIC_TAGS
    357  - 
    358  -----------
    359  - 
    360  -Dynamic flags
    361  -~~~~~~~~~~~~~
    362  - 
    363  -.. autoclass:: lief.ELF.DYNAMIC_FLAGS
    364  - 
    365  -----------
    366  - 
    367  - 
    368  -Dynamic flags 1
    369  -~~~~~~~~~~~~~~~
    370  - 
    371  -.. autoclass:: lief.ELF.DYNAMIC_FLAGS_1
    372  - 
    373  -----------
    374  - 
    375  - 
    376  -Symbol types
    377  -~~~~~~~~~~~~
    378  - 
    379  -.. autoclass:: lief.ELF.SYMBOL_TYPES
    380  - 
    381  -----------
    382 272   
    383  -Symbol bindings
    384  -~~~~~~~~~~~~~~~
    385  - 
    386  -.. autoclass:: lief.ELF.SYMBOL_BINDINGS
    387  - 
    388  -----------
    389  - 
    390  - 
    391  -Symbol Visibility
    392  -~~~~~~~~~~~~~~~~~
    393  - 
    394  -.. autoclass:: lief.ELF.SYMBOL_VISIBILITY
    395  - 
    396  -----------
    397  - 
    398  -Relocations x86-64
    399  -~~~~~~~~~~~~~~~~~~
    400  - 
    401  -.. autoclass:: lief.ELF.RELOCATION_X86_64
    402  - 
    403  -----------
    404  - 
    405  - 
    406  -Relocations x86 (i386)
    407  -~~~~~~~~~~~~~~~~~~~~~~
    408  - 
    409  -.. autoclass:: lief.ELF.RELOCATION_i386
    410  - 
    411  -----------
    412  - 
    413  -Relocations ARM
    414  -~~~~~~~~~~~~~~~
    415  - 
    416  -.. autoclass:: lief.ELF.RELOCATION_ARM
    417  - 
    418  -----------
    419  - 
    420  - 
    421  -Relocations AARCH64
    422  -~~~~~~~~~~~~~~~~~~~
    423  - 
    424  -.. autoclass:: lief.ELF.RELOCATION_AARCH64
    425  - 
    426  -----------
    427  - 
    428  -Relocations MIPS
    429  -~~~~~~~~~~~~~~~~
    430  - 
    431  -.. autoclass:: lief.ELF.RELOCATION_MIPS
    432  - 
    433  -----------
    434  - 
    435  - 
    436  -Relocations PPC
     273 +Processor Flags
    437 274  ~~~~~~~~~~~~~~~
    438 275   
    439  -.. autoclass:: lief.ELF.RELOCATION_PPC
    440  - 
    441  -----------
    442  - 
    443  - 
    444  -Relocations PPC64
    445  -~~~~~~~~~~~~~~~~~
    446  - 
    447  -.. autoclass:: lief.ELF.RELOCATION_PPC64
    448  - 
    449  -----------
    450  - 
    451  - 
    452  -Dynamic symbols counting
    453  -~~~~~~~~~~~~~~~~~~~~~~~~
    454  - 
    455  -.. autoclass:: lief.ELF.DYNSYM_COUNT_METHODS
    456  - 
    457  -----------
    458  - 
    459  -Relocation purpose
    460  -~~~~~~~~~~~~~~~~~~
    461  - 
    462  -.. autoclass:: lief.ELF.RELOCATION_PURPOSES
    463  - 
    464  -----------
    465  - 
    466  - 
    467  -ARM Processor flags
    468  -~~~~~~~~~~~~~~~~~~~
    469  - 
    470  -.. autoclass:: lief.ELF.ARM_EFLAGS
    471  - 
    472  -----------
    473  - 
    474  -MIPS Processor flags
    475  -~~~~~~~~~~~~~~~~~~~~
    476  - 
    477  -.. autoclass:: lief.ELF.MIPS_EFLAGS
    478  - 
    479  -----------
    480  - 
    481  -PPC64 Processor flags
    482  -~~~~~~~~~~~~~~~~~~~~~
    483  - 
    484  -.. autoclass:: lief.ELF.PPC64_EFLAGS
    485  - 
    486  -----------
    487  - 
    488  -Hexagon Processor flags
    489  -~~~~~~~~~~~~~~~~~~~~~~~
    490  - 
    491  -.. autoclass:: lief.ELF.HEXAGON_EFLAGS
    492  - 
     276 +.. autoclass:: lief.ELF.PROCESSOR_FLAGS
    493 277   
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/changelog.rst
    skipped 3 lines
    4 4  0.15.0 - Not Released Yet
    5 5  -------------------------
    6 6   
     7 +:ELF:
     8 + * Re-scope ``DYNAMIC_TAGS`` into :class:`lief.ELF.DynamicEntry.TAG`
     9 + * Re-scope ``E_TYPE`` into :class:`lief.ELF.Header.FILE_TYPE`
     10 + * Re-scope ``VERSION`` into :class:`lief.ELF.Header.VERSION`
     11 + * Re-scope ``ELF_CLASS`` into :class:`lief.ELF.Header.CLASS`
     12 + * Re-scope ``ELF_DATA`` into :class:`lief.ELF.Header.ELF_DATA`
     13 + * Re-scope ``OS_ABI`` into :class:`lief.ELF.Header.OS_ABI`
     14 + * Re-scope ``ELF_SECTION_TYPES`` into :class:`lief.ELF.Section.TYPE`
     15 + * Re-scope ``ELF_SECTION_FLAGS`` into :class:`lief.ELF.Section.FLAGS`
     16 + * Re-scope ``SYMBOL_BINDINGS`` into :class:`lief.ELF.Symbol.BINDING`
     17 + * Re-scope ``ELF_SYMBOL_TYPES`` into :class:`lief.ELF.Symbol.TYPE`
     18 + * Re-scope ``ELF_SYMBOL_VISIBILITY`` into :class:`lief.ELF.Symbol.VISIBILITY`
     19 + * Re-scope ``SEGMENT_TYPES`` into :class:`lief.ELF.Segment.TYPE`
     20 + * Re-scope ``ELF_SEGMENT_FLAGS`` into :class:`lief.ELF.Segment.FLAG`
     21 + * Re-scope ``DYNAMIC_FLAGS_1`` into :class:`lief.ELF.DynamicEntryFlags.FLAG`
     22 + * Re-scope ``DYNAMIC_FLAGS`` into :class:`lief.ELF.DynamicEntryFlags.FLAG`
     23 + * Re-scope ``DYNSYM_COUNT_METHODS`` into :class:`lief.ELF.ParserConfig.DYNSYM_COUNT`
     24 + * Re-scope ``RELOCATION_PURPOSES`` into :class:`lief.ELF.Relocation.PURPOSE`
     25 + * ``RELOC_x86_64``, ``RELOC_i386``, ... have been re-scoped **and merged**
     26 + into :class:`lief.ELF.Relocation.TYPE`
     27 + 
    7 28  :CMake:
    8 29   
    9 30   * ``LIEFConfig.cmake`` is now installed in ``<prefix>/lib/cmake/LIEF/``
    skipped 26 lines
    36 57   
    37 58   
    38 59   * Refactoring of the ELF note processing
    39  - * Fix relocation issue when using `-Wl,--emit-relocs` (c.f. :issue:`897` / :pr:`898` by :github_user:`adamjseitz`)
     60 + * Fix relocation issue when using ``-Wl,--emit-relocs`` (c.f. :issue:`897` / :pr:`898` by :github_user:`adamjseitz`)
    40 61   * Improve the computation of the dynamic symbols thanks to :github_user:`adamjseitz` (c.f. :issue:`922`)
    41 62   * Add support for the LoongArch architecture thanks to :github_user:`loongson-zn` (c.f. :pr:`921`)
    42 63   
    skipped 1325 lines
  • ■ ■ ■ ■ ■
    doc/sphinx/compilation.rst
    skipped 127 lines
    128 128   
    129 129   .. code-block:: console
    130 130   
    131  - $ PYLIEF_CONF=~/lief-debug.toml python ./setup build develop --user
     131 + $ PYLIEF_CONF=~/lief-debug.toml pip install [-e] api/python
    132 132   
    133 133   With `lief-debug.toml` set to:
    134 134   
    skipped 6 lines
    141 141   [lief.logging]
    142 142   enabled = true
    143 143   debug = true
    144  - 
    145  - Compared to the ``install`` command, ``develop`` creates a ``.egg-link``
    146  - that links to the native LIEF library currently presents in your build directory.
    147  - 
    148  - The ``--user`` flag is used to avoid creating the ``.egg-link`` system-wide (i.e. ``/usr/lib/python3.9/site-packages``).
    149  - Instead, it links the ``.egg-link`` in the user's local dir (e.g. ``~/.local/lib/python3.9/site-packages``)
    150  - 
    151 144   
    152 145  .. _lief_third_party:
    153 146   
    skipped 110 lines
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/tutorials/03_elf_change_symbols.rst
    skipped 15 lines
    16 16  In addition, the functions imported from this library are referenced in the dynamic symbols table with the following attributes:
    17 17   
    18 18  * :attr:`~lief.ELF.Symbol.value` set to ``0``
    19  -* :attr:`~lief.ELF.Symbol.type` set to :attr:`~lief.ELF.SYMBOL_TYPES.FUNC`
     19 +* :attr:`~lief.ELF.Symbol.type` set to :attr:`~lief.ELF.Symbol.TYPE.FUNC`
    20 20   
    21 21  Similarly, when a library exports functions the exported functions
    22 22  are registered in the dynamic symbols table with the following attributes:
    23 23   
    24 24  * :attr:`~lief.ELF.Symbol.value` set to the address of the function in the library
    25  -* :attr:`~lief.ELF.Symbol.type` set to :attr:`~lief.ELF.SYMBOL_TYPES.FUNC`
     25 +* :attr:`~lief.ELF.Symbol.type` set to :attr:`~lief.ELF.Symbol.TYPE.FUNC`
    26 26   
    27 27  Imported and exported functions are abstracted in LIEF and one can iterate over these elements through
    28 28  the properties: :attr:`~lief.Binary.exported_functions` and :attr:`~lief.Binary.imported_functions`
    skipped 136 lines
  • ■ ■ ■ ■
    doc/sphinx/tutorials/04_elf_hooking.rst
    skipped 66 lines
    67 67   
    68 68   new_address = segment_added.virtual_address + hook_symbol.value - code_segment.virtual_address
    69 69   exp_symbol.value = new_address
    70  - exp_symbol.type = lief.ELF.SYMBOL_TYPES.FUNC # it might have been GNU_IFUNC
     70 + exp_symbol.type = lief.ELF.Symbol.TYPE.FUNC # it might have been GNU_IFUNC
    71 71   
    72 72  Note that we have to update symbol's type to be regular `FUNC` because on many
    73 73  distributions `libm.so` is built with automatic hardware detection and exposes
    skipped 24 lines
  • ■ ■ ■ ■
    doc/sphinx/tutorials/05_elf_infect_plt_got.rst
    skipped 122 lines
    123 123   
    124 124   segment_added = crackme.add(hook.segments[0])
    125 125   
    126  -All assembly code of the hook stands in the first :attr:`~lief.ELF.SEGMENT_TYPES.LOAD` segment of ``hook``.
     126 +All assembly code of the hook stands in the first :attr:`~lief.ELF.Segment.TYPE.LOAD` segment of ``hook``.
    127 127   
    128 128  Once the hook added, its virtual address is :attr:`~lief.ELF.Segment.virtual_address` of ``segment_added`` and we can processed to the ``got`` patching.
    129 129   
    skipped 55 lines
  • ■ ■ ■ ■
    doc/sphinx/tutorials/08_elf_bin2lib.rst
    skipped 239 lines
    240 240   import sys
    241 241   path = sys.argv[1]
    242 242   bin_ = lief.parse(path)
    243  - bin_[lief.ELF.DYNAMIC_TAGS.FLAGS_1].remove(lief.ELF.DYNAMIC_FLAGS_1.PIE)
     243 + bin_[lief.ELF.DynamicEntry.TAG.FLAGS_1].remove(lief.ELF.DynamicEntryFlags.FLAG.PIE)
    244 244   bin_.write(path + ".patched")
    245 245   
    246 246   
    skipped 30 lines
  • ■ ■ ■ ■ ■ ■
    doc/sphinx/tutorials/09_frida_lief.rst
    skipped 275 lines
    276 276   
    277 277  .. rubric:: Notes
    278 278   
    279  -.. [1] Note that LIEF **does not** modify the :attr:`~lief.ELF.DYNAMIC_TAGS.DEBUG` entry ...
     279 +.. [1] Note that LIEF **does not** modify the :attr:`~lief.ELF.DynamicEntry.TAG.DEBUG` entry ...
    280 280   
    281 281  .. [2] Modification of the ELF Dynamic section is not as easy as the API looks like.
    282 282   
    283  -.. [3] In the ELF format they are located in the :attr:`~lief.ELF.DYNAMIC_TAGS.INIT_ARRAY` or :attr:`~lief.ELF.DYNAMIC_TAGS.INIT` entries
     283 +.. [3] In the ELF format they are located in the :attr:`~lief.ELF.DynamicEntry.TAG.INIT_ARRAY` or :attr:`~lief.ELF.DynamicEntry.TAG.INIT` entries
    284 284   
    285 285  .. [4] For those who are interested, checks are done in the ``framework_base/core/jni/com_android_internal_content_NativeLibraryHelper.cpp`` file.
    286 286   Actually these checks on the prefix and suffix are only done if the application is not *debuggable*.
    skipped 17 lines
  • ■ ■ ■ ■ ■ ■
    examples/c/elf_reader.c
    skipped 26 lines
    27 27   fprintf(stdout, "Header\n");
    28 28   fprintf(stdout, "======\n");
    29 29   fprintf(stdout, "Magic: %x %x %x %x\n", identity[0], identity[1], identity[2], identity[3]);
    30  - fprintf(stdout, "Class: %s\n", ELF_CLASS_to_string(identity[LIEF_ELF_EI_CLASS]));
    31  - fprintf(stdout, "Endianness: %s\n", ELF_DATA_to_string(identity[LIEF_ELF_EI_DATA]));
    32  - fprintf(stdout, "Version: %s\n", VERSION_to_string(identity[LIEF_ELF_EI_VERSION]));
    33  - fprintf(stdout, "OS/ABI: %s\n", OS_ABI_to_string(identity[LIEF_ELF_EI_OSABI]));
    34  - fprintf(stdout, "File type: %s\n", E_TYPE_to_string(header.file_type));
    35  - fprintf(stdout, "Architecture: %s\n", ARCH_to_string(header.machine_type));
    36  - fprintf(stdout, "Version: %s\n", VERSION_to_string(header.object_file_version));
     30 + fprintf(stdout, "Class: %d\n", identity[LIEF_EI_CLASS]);
     31 + fprintf(stdout, "Endianness: %d\n", identity[LIEF_EI_DATA]);
     32 + fprintf(stdout, "Version: %d\n", identity[LIEF_EI_VERSION]);
     33 + fprintf(stdout, "OS/ABI: %d\n", identity[LIEF_EI_OSABI]);
     34 + fprintf(stdout, "File type: %d\n", header.file_type);
     35 + fprintf(stdout, "Architecture: %d\n", header.machine_type);
     36 + fprintf(stdout, "Version: %d\n", header.object_file_version);
    37 37   fprintf(stdout, "Segments offset: 0x%" PRIx64 "\n", header.program_headers_offset);
    38 38   fprintf(stdout, "Sections offset: 0x%" PRIx64 "\n", header.section_headers_offset);
    39 39   fprintf(stdout, "Processor flags: %x\n", header.processor_flags);
    skipped 9 lines
    49 49   Elf_Section_t* section = sections[i];
    50 50   fprintf(stdout, ""
    51 51   "%-20s "
    52  - "%-10s "
     52 + "%d "
    53 53   "0x%010" PRIx64 " "
    54 54   "0x%010" PRIx64 " "
    55 55   "0x%010" PRIx64 " "
    skipped 3 lines
    59 59   "%.6f "
    60 60   "\n",
    61 61   section->name,
    62  - ELF_SECTION_TYPES_to_string(section->type),
     62 + section->type,
    63 63   section->virtual_address,
    64 64   section->size,
    65 65   section->offset,
    skipped 25 lines
    91 91   
    92 92   fprintf(stdout, ""
    93 93   "%-20s "
    94  - "%-10s "
    95  - "%-10s "
     94 + "%d "
     95 + "%d "
    96 96   "0x%02x "
    97 97   "0x%02x"
    98 98   "0x%010" PRIx64 " "
    skipped 1 lines
    100 100   "%-3s "
    101 101   "\n",
    102 102   symbol->name,
    103  - ELF_SYMBOL_TYPES_to_string(symbol->type),
    104  - SYMBOL_BINDINGS_to_string(symbol->binding),
     103 + symbol->type,
     104 + symbol->binding,
    105 105   symbol->other,
    106 106   symbol->shndx,
    107 107   symbol->value,
    skipped 20 lines
    128 128   
    129 129   fprintf(stdout, ""
    130 130   "%-20s "
    131  - "%-10s "
    132  - "%-10s "
     131 + "%d "
     132 + "%d "
    133 133   "0x%02x "
    134 134   "0x%02x"
    135 135   "0x%010" PRIx64 " "
    skipped 1 lines
    137 137   "%-3s "
    138 138   "\n",
    139 139   symbol->name,
    140  - ELF_SYMBOL_TYPES_to_string(symbol->type),
    141  - SYMBOL_BINDINGS_to_string(symbol->binding),
     140 + symbol->type,
     141 + symbol->binding,
    142 142   symbol->other,
    143 143   symbol->shndx,
    144 144   symbol->value,
    skipped 8 lines
    153 153   for (i = 0; segments[i] != NULL; ++i) {
    154 154   Elf_Segment_t* segment = segments[i];
    155 155   fprintf(stdout, ""
    156  - "%-20s "
     156 + "%d "
    157 157   "0x%06" PRIx32 " "
    158 158   "0x%010" PRIx64 " "
    159 159   "0x%06" PRIx64 " "
    skipped 1 lines
    161 161   "0x%06" PRIx64 " "
    162 162   "0x%06" PRIx64 " "
    163 163   "\n",
    164  - SEGMENT_TYPES_to_string(segment->type),
     164 + segment->type,
    165 165   segment->flags,
    166 166   segment->virtual_address,
    167 167   segment->virtual_size,
    skipped 11 lines
    179 179   for (i = 0; dynamic_entries[i] != NULL; ++i) {
    180 180   Elf_DynamicEntry_t* entry = dynamic_entries[i];
    181 181   switch(entry->tag) {
    182  - case LIEF_ELF_DT_NEEDED:
     182 + case LIEF_DT_NEEDED:
    183 183   {
    184 184   Elf_DynamicEntry_Library_t* e = (Elf_DynamicEntry_Library_t*)entry;
    185 185   fprintf(stdout, ""
    186  - "%-20s "
     186 + "0x%010" PRIx64 " "
    187 187   "0x%010" PRIx64 " "
    188 188   "%-20s "
    189 189   "\n",
    190  - DYNAMIC_TAGS_to_string(e->tag),
     190 + e->tag,
    191 191   e->value,
    192 192   e->name
    193 193   );
    194 194   break;
    195 195   }
    196  - case LIEF_ELF_DT_SONAME:
     196 + case LIEF_DT_SONAME:
    197 197   {
    198 198   Elf_DynamicEntry_SharedObject_t* e = (Elf_DynamicEntry_SharedObject_t*)entry;
    199 199   fprintf(stdout, ""
    200  - "%-20s "
     200 + "0x%010" PRIx64 " "
    201 201   "0x%010" PRIx64 " "
    202 202   "%-20s "
    203 203   "\n",
    204  - DYNAMIC_TAGS_to_string(e->tag),
     204 + e->tag,
    205 205   e->value,
    206 206   e->name
    207 207   );
    208 208   break;
    209 209   }
    210 210   
    211  - case LIEF_ELF_DT_RPATH:
     211 + case LIEF_DT_RPATH:
    212 212   {
    213 213   Elf_DynamicEntry_Rpath_t* e = (Elf_DynamicEntry_Rpath_t*)entry;
    214 214   fprintf(stdout, ""
    215  - "%-20s "
     215 + "0x%010" PRIx64 " "
    216 216   "0x%010" PRIx64 " "
    217 217   "%-20s "
    218 218   "\n",
    219  - DYNAMIC_TAGS_to_string(e->tag),
     219 + e->tag,
    220 220   e->value,
    221 221   e->rpath
    222 222   );
    223 223   break;
    224 224   }
    225 225   
    226  - case LIEF_ELF_DT_RUNPATH:
     226 + case LIEF_DT_RUNPATH:
    227 227   {
    228 228   Elf_DynamicEntry_RunPath_t* e = (Elf_DynamicEntry_RunPath_t*)entry;
    229 229   fprintf(stdout, ""
    230  - "%-20s "
     230 + "0x%010" PRIx64 " "
    231 231   "0x%010" PRIx64 " "
    232 232   "%-20s "
    233 233   "\n",
    234  - DYNAMIC_TAGS_to_string(e->tag),
     234 + e->tag,
    235 235   e->value,
    236 236   e->runpath
    237 237   );
    238 238   break;
    239 239   }
    240 240   
    241  - case LIEF_ELF_DT_FLAGS:
     241 + case LIEF_DT_FLAGS:
    242 242   {
    243 243   Elf_DynamicEntry_Flags_t* e = (Elf_DynamicEntry_Flags_t*)entry;
    244 244   fprintf(stdout, ""
    245  - "%-20s "
     245 + "0x%010" PRIx64 " "
    246 246   "0x%010" PRIx64 " ",
    247  - DYNAMIC_TAGS_to_string(e->tag),
     247 + e->tag,
    248 248   e->value);
    249 249   
    250  - enum LIEF_ELF_DYNAMIC_FLAGS* flags = e->flags;
    251  - for (j = 0; flags[j] != 0; ++j) {
    252  - fprintf(stdout, "%s ", DYNAMIC_FLAGS_to_string(flags[j]));
    253  - }
    254  - 
    255 250   fprintf(stdout, "\n");
    256 251   break;
    257 252   }
    258 253   
    259  - case LIEF_ELF_DT_FLAGS_1:
     254 + case LIEF_DT_FLAGS_1:
    260 255   {
    261 256   Elf_DynamicEntry_Flags_t* e = (Elf_DynamicEntry_Flags_t*)entry;
    262 257   fprintf(stdout, ""
    263  - "%-20s "
     258 + "0x%010" PRIx64 " "
    264 259   "0x%010" PRIx64 " ",
    265  - DYNAMIC_TAGS_to_string(e->tag),
     260 + e->tag,
    266 261   e->value);
    267  - 
    268  - enum LIEF_ELF_DYNAMIC_FLAGS_1* flags = e->flags_1;
    269  - for (j = 0; flags[j] != 0; ++j) {
    270  - fprintf(stdout, "%s ", DYNAMIC_FLAGS_1_to_string(flags[j]));
    271  - }
    272  - 
    273 262   fprintf(stdout, "\n");
    274 263   break;
    275 264   }
    276 265   
    277 266   
    278  - case LIEF_ELF_DT_INIT_ARRAY:
    279  - case LIEF_ELF_DT_FINI_ARRAY:
    280  - case LIEF_ELF_DT_PREINIT_ARRAY:
     267 + case LIEF_DT_INIT_ARRAY:
     268 + case LIEF_DT_FINI_ARRAY:
     269 + case LIEF_DT_PREINIT_ARRAY:
    281 270   {
    282 271   Elf_DynamicEntry_Array_t* e = (Elf_DynamicEntry_Array_t*)entry;
    283 272   fprintf(stdout, ""
    284  - "%-20s "
     273 + "0x%010" PRIx64 " "
    285 274   "0x%010" PRIx64 " ",
    286  - DYNAMIC_TAGS_to_string(e->tag),
     275 + e->tag,
    287 276   e->value
    288 277   );
    289 278   uint64_t* array = e->array;
    skipped 8 lines
    298 287   default:
    299 288   {
    300 289   fprintf(stdout, ""
    301  - "%-20s "
     290 + "0x%010" PRIx64 " "
    302 291   "0x%010" PRIx64 " "
    303 292   "\n",
    304  - DYNAMIC_TAGS_to_string(entry->tag),
     293 + entry->tag,
    305 294   entry->value
    306 295   );
    307 296   break;
    308 297   }
    309 298   }
    310 299   }
    311  - 
    312  - 
    313 300   
    314 301   elf_binary_destroy(elf_binary);
    315 302   
    skipped 3 lines
  • ■ ■ ■ ■
    examples/cpp/elf_builder.cpp
    skipped 30 lines
    31 31   
    32 32   std::unique_ptr<LIEF::ELF::Binary> binary = LIEF::ELF::Parser::parse(argv[1]);
    33 33   LIEF::ELF::Segment seg;
    34  - seg.type(LIEF::ELF::SEGMENT_TYPES::PT_LOAD);
     34 + seg.type(LIEF::ELF::Segment::TYPE::LOAD);
    35 35   //seg.content(std::vector<uint8_t>(0x100));
    36 36   //binary->add(seg);
    37 37   LIEF::logging::set_level(LIEF::logging::LOGGING_LEVEL::LOG_DEBUG);
    skipped 15 lines
  • ■ ■ ■ ■
    include/LIEF/Abstract/Header.hpp
    skipped 47 lines
    48 48   bool is_64() const;
    49 49   
    50 50   //! @brief Method so that the ``visitor`` can visit us
    51  - void accept(Visitor& visitor) const override;
     51 + void accept(Visitor& visitor) const override;
    52 52   
    53 53   void architecture(ARCHITECTURES arch);
    54 54   void modes(const std::set<MODES>& m);
    skipped 19 lines
  • ■ ■ ■ ■ ■
    include/LIEF/ELF/Binary.hpp
    skipped 25 lines
    26 26  #include "LIEF/Abstract/Binary.hpp"
    27 27   
    28 28  #include "LIEF/ELF/Note.hpp"
     29 +#include "LIEF/ELF/DynamicEntry.hpp"
    29 30  #include "LIEF/ELF/Header.hpp"
     31 +#include "LIEF/ELF/Section.hpp"
     32 +#include "LIEF/ELF/Segment.hpp"
    30 33  #include "LIEF/ELF/Builder.hpp"
    31 34   
    32 35  namespace LIEF {
    skipped 3 lines
    36 39  class Handler;
    37 40  }
    38 41   
    39  -class DynamicEntry;
    40 42  class ExeLayout;
    41 43  class GnuHash;
    42 44  class Layout;
    skipped 183 lines
    226 228   Binary(const Binary& copy) = delete;
    227 229   
    228 230   //! Return binary's class (ELF32 or ELF64)
    229  - ELF_CLASS type() const;
     231 + Header::CLASS type() const {
     232 + return type_;
     233 + }
    230 234   
    231 235   //! Return @link ELF::Header Elf header @endlink
    232  - Header& header();
    233  - const Header& header() const;
     236 + Header& header() {
     237 + return header_;
     238 + }
     239 + 
     240 + const Header& header() const {
     241 + return header_;
     242 + }
    234 243   
    235 244   //! Return the last offset used in binary
    236 245   //! according to sections table
    skipped 7 lines
    244 253   uint64_t next_virtual_address() const;
    245 254   
    246 255   //! Return an iterator over the binary's sections
    247  - it_sections sections();
    248  - it_const_sections sections() const;
     256 + it_sections sections() {
     257 + return sections_;
     258 + }
     259 + 
     260 + it_const_sections sections() const {
     261 + return sections_;
     262 + }
    249 263   
    250 264   //! Return the binary's entrypoint
    251  - uint64_t entrypoint() const override;
     265 + uint64_t entrypoint() const override {
     266 + return header_.entrypoint();
     267 + }
    252 268   
    253 269   //! Return binary's segments
    254  - it_segments segments();
    255  - it_const_segments segments() const;
     270 + it_segments segments() {
     271 + return segments_;
     272 + }
     273 + 
     274 + it_const_segments segments() const {
     275 + return segments_;
     276 + }
    256 277   
    257 278   //! Return binary's dynamic entries
    258  - it_dynamic_entries dynamic_entries();
    259  - it_const_dynamic_entries dynamic_entries() const;
     279 + it_dynamic_entries dynamic_entries() {
     280 + return dynamic_entries_;
     281 + }
     282 + 
     283 + it_const_dynamic_entries dynamic_entries() const {
     284 + return dynamic_entries_;
     285 + }
    260 286   
    261 287   //! Add the given dynamic entry and return the new entry
    262 288   DynamicEntry& add(const DynamicEntry& entry);
    skipped 5 lines
    268 294   void remove(const DynamicEntry& entry);
    269 295   
    270 296   //! Remove **all** dynamic entries with the given tag
    271  - void remove(DYNAMIC_TAGS tag);
     297 + void remove(DynamicEntry::TAG tag);
    272 298   
    273 299   //! Remove the given section. The ``clear`` parameter
    274 300   //! can be used to zeroize the original content beforehand
    skipped 13 lines
    288 314   
    289 315   //! Return an iterator over the binary's dynamic symbols
    290 316   //! The dynamic symbols are those located in the ``.dynsym`` section
    291  - it_dynamic_symbols dynamic_symbols();
    292  - it_const_dynamic_symbols dynamic_symbols() const;
     317 + it_dynamic_symbols dynamic_symbols() {
     318 + return dynamic_symbols_;
     319 + }
     320 + it_const_dynamic_symbols dynamic_symbols() const {
     321 + return dynamic_symbols_;
     322 + }
    293 323   
    294 324   //! Return symbols which are exported by the binary
    295 325   it_exported_symbols exported_symbols();
    skipped 4 lines
    300 330   it_const_imported_symbols imported_symbols() const;
    301 331   
    302 332   //! Return statics symbols.
    303  - it_static_symbols static_symbols();
    304  - it_const_static_symbols static_symbols() const;
     333 + it_static_symbols static_symbols() {
     334 + return static_symbols_;
     335 + }
     336 + 
     337 + it_const_static_symbols static_symbols() const {
     338 + return static_symbols_;
     339 + }
    305 340   
    306 341   //! Return the symbol versions
    307  - it_symbols_version symbols_version();
    308  - it_const_symbols_version symbols_version() const;
     342 + it_symbols_version symbols_version() {
     343 + return symbol_version_table_;
     344 + }
     345 + it_const_symbols_version symbols_version() const {
     346 + return symbol_version_table_;
     347 + }
    309 348   
    310 349   //! Return symbols version definition
    311  - it_symbols_version_definition symbols_version_definition();
    312  - it_const_symbols_version_definition symbols_version_definition() const;
     350 + it_symbols_version_definition symbols_version_definition() {
     351 + return symbol_version_definition_;
     352 + }
     353 + 
     354 + it_const_symbols_version_definition symbols_version_definition() const {
     355 + return symbol_version_definition_;
     356 + }
    313 357   
    314 358   //! Return Symbol version requirement
    315  - it_symbols_version_requirement symbols_version_requirement();
    316  - it_const_symbols_version_requirement symbols_version_requirement() const;
     359 + it_symbols_version_requirement symbols_version_requirement() {
     360 + return symbol_version_requirements_;
     361 + }
     362 + 
     363 + it_const_symbols_version_requirement symbols_version_requirement() const {
     364 + return symbol_version_requirements_;
     365 + }
    317 366   
    318 367   //! Return dynamic relocations
    319 368   it_dynamic_relocations dynamic_relocations();
    skipped 30 lines
    350 399   it_const_object_relocations object_relocations() const;
    351 400   
    352 401   //! Return **all** relocations present in the binary
    353  - it_relocations relocations();
    354  - it_const_relocations relocations() const;
     402 + it_relocations relocations() {
     403 + return relocations_;
     404 + }
     405 + 
     406 + it_const_relocations relocations() const {
     407 + return relocations_;
     408 + }
    355 409   
    356 410   //! Return relocation associated with the given address.
    357 411   //! It returns a ``nullptr`` if it is not found
    skipped 13 lines
    371 425   //! ``true`` if GNU hash is used
    372 426   //!
    373 427   //! @see gnu_hash and use_sysv_hash
    374  - bool use_gnu_hash() const;
     428 + bool use_gnu_hash() const {
     429 + return gnu_hash_ != nullptr && has(DynamicEntry::TAG::GNU_HASH);
     430 + }
    375 431   
    376 432   //! Return the GnuHash object in **readonly**
    377 433   //! If the ELF binary does not use the GNU hash table, return a nullptr
    378  - const GnuHash* gnu_hash() const;
     434 + const GnuHash* gnu_hash() const {
     435 + return use_gnu_hash() ? gnu_hash_.get() : nullptr;
     436 + }
    379 437   
    380 438   //! ``true`` if SYSV hash is used
    381 439   //!
    382 440   //! @see sysv_hash and use_gnu_hash
    383  - bool use_sysv_hash() const;
     441 + bool use_sysv_hash() const {
     442 + return sysv_hash_ != nullptr && has(DynamicEntry::TAG::HASH);
     443 + }
    384 444   
    385 445   //! Return the SysvHash object as a **read-only** object
    386 446   //! If the ELF binary does not use the legacy sysv hash table, return a nullptr
    387  - const SysvHash* sysv_hash() const;
     447 + const SysvHash* sysv_hash() const {
     448 + return use_sysv_hash() ? sysv_hash_.get() : nullptr;
     449 + }
    388 450   
    389 451   //! Check if a section with the given name exists in the binary
    390 452   bool has_section(const std::string& name) const;
    skipped 11 lines
    402 464   
    403 465   //! Return the `.text` section. If the section
    404 466   //! can't be found, it returns a nullptr
    405  - Section* text_section();
     467 + Section* text_section() {
     468 + return get_section(".text");
     469 + }
    406 470   
    407 471   //! Return the `.dynamic` section. If the section
    408 472   //! can't be found, it returns a nullptr
    skipped 30 lines
    439 503   void interpreter(const std::string& interpreter);
    440 504   
    441 505   //! Return an iterator on both static and dynamic symbols
    442  - it_symbols symbols();
    443  - it_const_symbols symbols() const;
     506 + it_symbols symbols() {
     507 + return static_dyn_symbols();
     508 + }
     509 + 
     510 + it_const_symbols symbols() const {
     511 + return static_dyn_symbols();
     512 + }
    444 513   
    445 514   //! Export the given symbol and create it if it doesn't exist
    446 515   Symbol& export_symbol(const Symbol& symbol);
    skipped 225 lines
    672 741   Segment* segment_from_virtual_address(uint64_t address);
    673 742   
    674 743   
    675  - const Segment* segment_from_virtual_address(SEGMENT_TYPES type, uint64_t address) const;
    676  - Segment* segment_from_virtual_address(SEGMENT_TYPES type, uint64_t address);
     744 + const Segment* segment_from_virtual_address(Segment::TYPE type, uint64_t address) const;
     745 + Segment* segment_from_virtual_address(Segment::TYPE type, uint64_t address);
    677 746   
    678 747   //! Return the ELF::Segment from the @p offset. Return a nullptr
    679 748   //! if a segment can't be found.
    skipped 2 lines
    682 751   
    683 752   //! Return the **first** ELF::DynamicEntry associated with the given tag
    684 753   //! If the tag can't be found, it returns a nullptr
    685  - const DynamicEntry* get(DYNAMIC_TAGS tag) const;
    686  - DynamicEntry* get(DYNAMIC_TAGS tag);
     754 + const DynamicEntry* get(DynamicEntry::TAG tag) const;
     755 + DynamicEntry* get(DynamicEntry::TAG tag) {
     756 + return const_cast<DynamicEntry*>(static_cast<const Binary*>(this)->get(tag));
     757 + }
    687 758   
    688 759   //! Return the **first** ELF::Segment associated with the given type.
    689 760   //! If a segment can't be found, it returns a nullptr.
    690  - const Segment* get(SEGMENT_TYPES type) const;
    691  - Segment* get(SEGMENT_TYPES type);
     761 + const Segment* get(Segment::TYPE type) const;
     762 + Segment* get(Segment::TYPE type);
    692 763   
    693 764   //! Return the **first** ELF::Note associated with the given type
    694 765   //! If a note can't be found, it returns a nullptr.
    skipped 2 lines
    697 768   
    698 769   //! Return the **first** ELF::Section associated with the given type
    699 770   //! If a section can't be found, it returns a nullptr.
    700  - const Section* get(ELF_SECTION_TYPES type) const;
    701  - Section* get(ELF_SECTION_TYPES type);
     771 + const Section* get(Section::TYPE type) const;
     772 + Section* get(Section::TYPE type);
    702 773   
    703 774   //! Check if an ELF::DynamicEntry associated with the given tag exists.
    704  - bool has(DYNAMIC_TAGS tag) const;
     775 + bool has(DynamicEntry::TAG tag) const {
     776 + return get(tag) != nullptr;
     777 + }
    705 778   
    706 779   //! Check if ELF::Segment associated with the given type exists.
    707  - bool has(SEGMENT_TYPES type) const;
     780 + bool has(Segment::TYPE type) const {
     781 + return get(type) != nullptr;
     782 + }
    708 783   
    709 784   //! Check if a ELF::Note associated with the given type exists.
    710  - bool has(Note::TYPE type) const;
     785 + bool has(Note::TYPE type) const {
     786 + return get(type) != nullptr;
     787 + }
    711 788   
    712 789   //! Check if a ELF::Section associated with the given type exists.
    713  - bool has(ELF_SECTION_TYPES type) const;
     790 + bool has(Section::TYPE type) const {
     791 + return get(type) != nullptr;
     792 + }
    714 793   
    715 794   //! Return the content located at virtual address
    716 795   span<const uint8_t> get_content_from_virtual_address(uint64_t virtual_address, uint64_t size,
    skipped 20 lines
    737 816   //! Return an iterator over the ELF's LIEF::ELF::Note
    738 817   //!
    739 818   //! @see has_note
    740  - it_const_notes notes() const;
     819 + it_const_notes notes() const {
     820 + return notes_;
     821 + }
    741 822   
    742  - it_notes notes();
     823 + it_notes notes() {
     824 + return notes_;
     825 + }
    743 826   
    744 827   //! Return the last offset used by the ELF binary according to both: the sections table
    745 828   //! and the segments table
    skipped 31 lines
    777 860   
    778 861   std::ostream& print(std::ostream& os) const override;
    779 862   
    780  - Binary& operator+=(const DynamicEntry& entry);
    781  - Binary& operator+=(const Section& section);
    782  - Binary& operator+=(const Segment& segment);
    783  - Binary& operator+=(const Note& note);
     863 + Binary& operator+=(const DynamicEntry& entry) {
     864 + add(entry);
     865 + return *this;
     866 + }
     867 + Binary& operator+=(const Section& section) {
     868 + add(section);
     869 + return *this;
     870 + }
    784 871   
    785  - Binary& operator-=(const DynamicEntry& entry);
    786  - Binary& operator-=(DYNAMIC_TAGS tag);
     872 + Binary& operator+=(const Segment& segment) {
     873 + add(segment);
     874 + return *this;
     875 + }
    787 876   
    788  - Binary& operator-=(const Note& note);
    789  - Binary& operator-=(Note::TYPE type);
     877 + Binary& operator+=(const Note& note) {
     878 + add(note);
     879 + return *this;
     880 + }
     881 + 
     882 + Binary& operator-=(const DynamicEntry& entry) {
     883 + remove(entry);
     884 + return *this;
     885 + }
     886 + 
     887 + Binary& operator-=(DynamicEntry::TAG tag) {
     888 + remove(tag);
     889 + return *this;
     890 + }
     891 + 
     892 + Binary& operator-=(const Note& note) {
     893 + remove(note);
     894 + return *this;
     895 + }
     896 + 
     897 + Binary& operator-=(Note::TYPE type) {
     898 + remove(type);
     899 + return *this;
     900 + }
     901 + 
     902 + Segment* operator[](Segment::TYPE type) {
     903 + return get(type);
     904 + }
     905 + 
     906 + const Segment* operator[](Segment::TYPE type) const {
     907 + return get(type);
     908 + }
     909 + 
     910 + DynamicEntry* operator[](DynamicEntry::TAG tag) {
     911 + return get(tag);
     912 + }
    790 913   
    791  - Segment* operator[](SEGMENT_TYPES type);
    792  - const Segment* operator[](SEGMENT_TYPES type) const;
     914 + const DynamicEntry* operator[](DynamicEntry::TAG tag) const {
     915 + return get(tag);
     916 + }
    793 917   
    794  - DynamicEntry* operator[](DYNAMIC_TAGS tag);
    795  - const DynamicEntry* operator[](DYNAMIC_TAGS tag) const;
     918 + Note* operator[](Note::TYPE type) {
     919 + return get(type);
     920 + }
    796 921   
    797  - Note* operator[](Note::TYPE type);
    798  - const Note* operator[](Note::TYPE type) const;
     922 + const Note* operator[](Note::TYPE type) const {
     923 + return get(type);
     924 + }
    799 925   
    800  - Section* operator[](ELF_SECTION_TYPES type);
    801  - const Section* operator[](ELF_SECTION_TYPES type) const;
     926 + Section* operator[](Section::TYPE type) {
     927 + return get(type);
     928 + }
     929 + 
     930 + const Section* operator[](Section::TYPE type) const {
     931 + return get(type);
     932 + }
    802 933   
    803 934   protected:
    804 935   struct phdr_relocation_info_t {
    skipped 35 lines
    840 971   LIEF::Binary::functions_t eh_frame_functions() const;
    841 972   LIEF::Binary::functions_t armexid_functions() const;
    842 973   
    843  - template<E_TYPE OBJECT_TYPE, bool note = false>
     974 + template<Header::FILE_TYPE OBJECT_TYPE, bool note = false>
    844 975   Segment* add_segment(const Segment& segment, uint64_t base);
    845 976   
    846 977   uint64_t relocate_phdr_table_auto();
    skipped 2 lines
    849 980   uint64_t relocate_phdr_table_v2();
    850 981   uint64_t relocate_phdr_table_v3();
    851 982   
    852  - template<SEGMENT_TYPES PT>
     983 + template<Segment::TYPE PT>
    853 984   Segment* extend_segment(const Segment& segment, uint64_t size);
    854 985   
    855 986   template<bool LOADED>
    skipped 3 lines
    859 990   std::string shstrtab_name() const;
    860 991   Section* add_frame_section(const Section& sec);
    861 992   
    862  - LIEF::Binary::functions_t tor_functions(DYNAMIC_TAGS tag) const;
     993 + LIEF::Binary::functions_t tor_functions(DynamicEntry::TAG tag) const;
    863 994   
    864  - ELF_CLASS type_ = ELF_CLASS::ELFCLASSNONE;
     995 + Header::CLASS type_ = Header::CLASS::NONE;
    865 996   Header header_;
    866 997   sections_t sections_;
    867 998   segments_t segments_;
    skipped 22 lines
  • ■ ■ ■ ■ ■
    include/LIEF/ELF/DynamicEntry.hpp
    skipped 16 lines
    17 17  #define LIEF_ELF_DYNAMIC_ENTRY_H
    18 18   
    19 19  #include <string>
    20  -#include <vector>
    21 20  #include <ostream>
     21 +#include <memory>
     22 +#include <cstdint>
    22 23   
    23 24  #include "LIEF/visibility.h"
    24 25  #include "LIEF/Object.hpp"
    25  - 
    26 26  #include "LIEF/ELF/enums.hpp"
    27 27   
    28 28  namespace LIEF {
    skipped 7 lines
    36 36  //! These entries are located in the ``.dynamic`` section or the ``PT_DYNAMIC`` segment
    37 37  class LIEF_API DynamicEntry : public Object {
    38 38   public:
     39 + static constexpr uint64_t MIPS_DISC = 0x100000000;
     40 + static constexpr uint64_t AARCH64_DISC = 0x200000000;
     41 + static constexpr uint64_t HEXAGON_DISC = 0x300000000;
     42 + static constexpr uint64_t PPC_DISC = 0x400000000;
     43 + static constexpr uint64_t PPC64_DISC = 0x500000000;
     44 + static constexpr uint64_t RISCV_DISC = 0x600000000;
     45 + 
     46 + enum class TAG : uint64_t {
     47 + UNKNOWN = uint64_t(-1),
     48 + DT_NULL = 0, /**< Marks end of dynamic array. */
     49 + NEEDED = 1, /**< String table offset of needed library. */
     50 + PLTRELSZ = 2, /**< Size of relocation entries in PLT. */
     51 + PLTGOT = 3, /**< Address associated with linkage table. */
     52 + HASH = 4, /**< Address of symbolic hash table. */
     53 + STRTAB = 5, /**< Address of dynamic string table. */
     54 + SYMTAB = 6, /**< Address of dynamic symbol table. */
     55 + RELA = 7, /**< Address of relocation table (Rela entries). */
     56 + RELASZ = 8, /**< Size of Rela relocation table. */
     57 + RELAENT = 9, /**< Size of a Rela relocation entry. */
     58 + STRSZ = 10,/**< Total size of the string table. */
     59 + SYMENT = 11,/**< Size of a symbol table entry. */
     60 + INIT = 12,/**< Address of initialization function. */
     61 + FINI = 13,/**< Address of termination function. */
     62 + SONAME = 14,/**< String table offset of a shared objects name. */
     63 + RPATH = 15,/**< String table offset of library search path. */
     64 + SYMBOLIC = 16,/**< Changes symbol resolution algorithm. */
     65 + REL = 17,/**< Address of relocation table (Rel entries). */
     66 + RELSZ = 18,/**< Size of Rel relocation table. */
     67 + RELENT = 19,/**< Size of a Rel relocation entry. */
     68 + PLTREL = 20,/**< Type of relocation entry used for linking. */
     69 + DEBUG = 21,/**< Reserved for debugger. */
     70 + TEXTREL = 22,/**< Relocations exist for non-writable segments. */
     71 + JMPREL = 23,/**< Address of relocations associated with PLT. */
     72 + BIND_NOW = 24,/**< Process all relocations before execution. */
     73 + INIT_ARRAY = 25,/**< Pointer to array of initialization functions. */
     74 + FINI_ARRAY = 26,/**< Pointer to array of termination functions. */
     75 + INIT_ARRAYSZ = 27,/**< Size of DT_INIT_ARRAY. */
     76 + FINI_ARRAYSZ = 28,/**< Size of DT_FINI_ARRAY. */
     77 + RUNPATH = 29,/**< String table offset of lib search path. */
     78 + FLAGS = 30,/**< Flags. */
     79 + PREINIT_ARRAY = 32,/**< Pointer to array of preinit functions. */
     80 + PREINIT_ARRAYSZ = 33,/**< Size of the DT_PREINIT_ARRAY array. */
     81 + SYMTAB_SHNDX = 34,/**< Address of SYMTAB_SHNDX section */
     82 + RELRSZ = 35,/**< Total size of RELR relative relocations */
     83 + RELR = 36,/**< Address of RELR relative relocations */
     84 + RELRENT = 37,/**< Size of one RELR relative relocaction */
    39 85   
    40  - DynamicEntry(const details::Elf64_Dyn& header);
    41  - DynamicEntry(const details::Elf32_Dyn& header);
    42  - DynamicEntry();
    43  - DynamicEntry(DYNAMIC_TAGS tag, uint64_t value);
     86 + // GNU Extensions
     87 + GNU_HASH = 0x6FFFFEF5, /**< Reference to the GNU hash table. */
     88 + RELACOUNT = 0x6FFFFFF9, /**< ELF32_Rela count. */
     89 + RELCOUNT = 0x6FFFFFFA, /**< ELF32_Rel count. */
     90 + FLAGS_1 = 0x6FFFFFFB, /**< Flags_1. */
     91 + VERSYM = 0x6FFFFFF0, /**< The address of .gnu.version section. */
     92 + VERDEF = 0x6FFFFFFC, /**< The address of the version definition table. */
     93 + VERDEFNUM = 0x6FFFFFFD, /**< The number of entries in DT_VERDEF. */
     94 + VERNEED = 0x6FFFFFFE, /**< The address of the version Dependency table. */
     95 + VERNEEDNUM = 0x6FFFFFFF, /**< The number of entries in DT_VERNEED. */
    44 96   
    45  - DynamicEntry& operator=(const DynamicEntry&);
    46  - DynamicEntry(const DynamicEntry&);
    47  - ~DynamicEntry() override;
     97 + // Android Extensions
     98 + ANDROID_REL_OFFSET = 0x6000000D, /**< The offset of packed relocation data (older version < M) (Android specific). */
     99 + ANDROID_REL_SIZE = 0x6000000E, /**< The size of packed relocation data in bytes (older version < M) (Android specific). */
     100 + ANDROID_REL = 0x6000000F, /**< The offset of packed relocation data (Android specific). */
     101 + ANDROID_RELSZ = 0x60000010, /**< The size of packed relocation data in bytes (Android specific). */
     102 + ANDROID_RELA = 0x60000011, /**< The offset of packed relocation data (Android specific). */
     103 + ANDROID_RELASZ = 0x60000012, /**< The size of packed relocation data in bytes (Android specific). */
     104 + ANDROID_RELR = 0x6FFFE000, /**< The offset of new relr relocation data (Android specific). */
     105 + ANDROID_RELRSZ = 0x6FFFE001, /**< The size of nre relr relocation data in bytes (Android specific). */
     106 + ANDROID_RELRENT = 0x6FFFE003, /**< The size of a new relr relocation entry (Android specific). */
     107 + ANDROID_RELRCOUNT = 0x6FFFE005, /**< Specifies the relative count of new relr relocation entries (Android specific). */
     108 + 
     109 + /* Mips specific dynamic table entry tags. */
     110 + MIPS_RLD_VERSION = MIPS_DISC + 0x70000001, /**< 32 bit version number for runtime linker interface. */
     111 + MIPS_TIME_STAMP = MIPS_DISC + 0x70000002, /**< Time stamp. */
     112 + MIPS_ICHECKSUM = MIPS_DISC + 0x70000003, /**< Checksum of external strings and common sizes. */
     113 + MIPS_IVERSION = MIPS_DISC + 0x70000004, /**< Index of version string in string table. */
     114 + MIPS_FLAGS = MIPS_DISC + 0x70000005, /**< 32 bits of flags. */
     115 + MIPS_BASE_ADDRESS = MIPS_DISC + 0x70000006, /**< Base address of the segment. */
     116 + MIPS_MSYM = MIPS_DISC + 0x70000007, /**< Address of .msym section. */
     117 + MIPS_CONFLICT = MIPS_DISC + 0x70000008, /**< Address of .conflict section. */
     118 + MIPS_LIBLIST = MIPS_DISC + 0x70000009, /**< Address of .liblist section. */
     119 + MIPS_LOCAL_GOTNO = MIPS_DISC + 0x7000000a, /**< Number of local global offset table entries. */
     120 + MIPS_CONFLICTNO = MIPS_DISC + 0x7000000b, /**< Number of entries in the .conflict section. */
     121 + MIPS_LIBLISTNO = MIPS_DISC + 0x70000010, /**< Number of entries in the .liblist section. */
     122 + MIPS_SYMTABNO = MIPS_DISC + 0x70000011, /**< Number of entries in the .dynsym section. */
     123 + MIPS_UNREFEXTNO = MIPS_DISC + 0x70000012, /**< Index of first external dynamic symbol not referenced locally. */
     124 + MIPS_GOTSYM = MIPS_DISC + 0x70000013, /**< Index of first dynamic symbol in global offset table. */
     125 + MIPS_HIPAGENO = MIPS_DISC + 0x70000014, /**< Number of page table entries in global offset table. */
     126 + MIPS_RLD_MAP = MIPS_DISC + 0x70000016, /**< Address of run time loader map, used for debugging. */
     127 + MIPS_DELTA_CLASS = MIPS_DISC + 0x70000017, /**< Delta C++ class definition. */
     128 + MIPS_DELTA_CLASS_NO = MIPS_DISC + 0x70000018, /**< Number of entries in DT_MIPS_DELTA_CLASS. */
     129 + MIPS_DELTA_INSTANCE = MIPS_DISC + 0x70000019, /**< Delta C++ class instances. */
     130 + MIPS_DELTA_INSTANCE_NO = MIPS_DISC + 0x7000001A, /**< Number of entries in DT_MIPS_DELTA_INSTANCE. */
     131 + MIPS_DELTA_RELOC = MIPS_DISC + 0x7000001B, /**< Delta relocations. */
     132 + MIPS_DELTA_RELOC_NO = MIPS_DISC + 0x7000001C, /**< Number of entries in DT_MIPS_DELTA_RELOC. */
     133 + MIPS_DELTA_SYM = MIPS_DISC + 0x7000001D, /**< Delta symbols that Delta relocations refer to. */
     134 + MIPS_DELTA_SYM_NO = MIPS_DISC + 0x7000001E, /**< Number of entries in DT_MIPS_DELTA_SYM. */
     135 + MIPS_DELTA_CLASSSYM = MIPS_DISC + 0x70000020, /**< Delta symbols that hold class declarations. */
     136 + MIPS_DELTA_CLASSSYM_NO = MIPS_DISC + 0x70000021, /**< Number of entries in DT_MIPS_DELTA_CLASSSYM. */
     137 + MIPS_CXX_FLAGS = MIPS_DISC + 0x70000022, /**< Flags indicating information about C++ flavor. */
     138 + MIPS_PIXIE_INIT = MIPS_DISC + 0x70000023, /**< Pixie information. */
     139 + MIPS_SYMBOL_LIB = MIPS_DISC + 0x70000024, /**< Address of .MIPS.symlib */
     140 + MIPS_LOCALPAGE_GOTIDX = MIPS_DISC + 0x70000025, /**< The GOT index of the first PTE for a segment */
     141 + MIPS_LOCAL_GOTIDX = MIPS_DISC + 0x70000026, /**< The GOT index of the first PTE for a local symbol */
     142 + MIPS_HIDDEN_GOTIDX = MIPS_DISC + 0x70000027, /**< The GOT index of the first PTE for a hidden symbol */
     143 + MIPS_PROTECTED_GOTIDX = MIPS_DISC + 0x70000028, /**< The GOT index of the first PTE for a protected symbol */
     144 + MIPS_OPTIONS = MIPS_DISC + 0x70000029, /**< Address of `.MIPS.options'. */
     145 + MIPS_INTERFACE = MIPS_DISC + 0x7000002A, /**< Address of `.interface'. */
     146 + MIPS_DYNSTR_ALIGN = MIPS_DISC + 0x7000002B, /**< Unknown. */
     147 + MIPS_INTERFACE_SIZE = MIPS_DISC + 0x7000002C, /**< Size of the .interface section. */
     148 + MIPS_RLD_TEXT_RESOLVE_ADDR = MIPS_DISC + 0x7000002D, /**< Size of rld_text_resolve function stored in the GOT. */
     149 + MIPS_PERF_SUFFIX = MIPS_DISC + 0x7000002E, /**< Default suffix of DSO to be added by rld on dlopen() calls. */
     150 + MIPS_COMPACT_SIZE = MIPS_DISC + 0x7000002F, /**< Size of compact relocation section (O32). */
     151 + MIPS_GP_VALUE = MIPS_DISC + 0x70000030, /**< GP value for auxiliary GOTs. */
     152 + MIPS_AUX_DYNAMIC = MIPS_DISC + 0x70000031, /**< Address of auxiliary .dynamic. */
     153 + MIPS_PLTGOT = MIPS_DISC + 0x70000032, /**< Address of the base of the PLTGOT. */
     154 + MIPS_RWPLT = MIPS_DISC + 0x70000034,
     155 + MIPS_RLD_MAP_REL = MIPS_DISC + 0x70000035,
     156 + MIPS_XHASH = MIPS_DISC + 0x70000036,
     157 + 
     158 + AARCH64_BTI_PLT = AARCH64_DISC + 0x70000001,
     159 + AARCH64_PAC_PLT = AARCH64_DISC + 0x70000003,
     160 + AARCH64_VARIANT_PCS = AARCH64_DISC + 0x70000005,
     161 + AARCH64_MEMTAG_MODE = AARCH64_DISC + 0x70000009,
     162 + AARCH64_MEMTAG_HEAP = AARCH64_DISC + 0x7000000b,
     163 + AARCH64_MEMTAG_STACK = AARCH64_DISC + 0x7000000c,
     164 + AARCH64_MEMTAG_GLOBALS = AARCH64_DISC + 0x7000000d,
     165 + AARCH64_MEMTAG_GLOBALSSZ = AARCH64_DISC + 0x7000000f,
     166 + 
     167 + HEXAGON_SYMSZ = HEXAGON_DISC + 0x70000000,
     168 + HEXAGON_VER = HEXAGON_DISC + 0x70000001,
     169 + HEXAGON_PLT = HEXAGON_DISC + 0x70000002,
     170 + 
     171 + PPC_GOT = PPC_DISC + 0x70000000,
     172 + PPC_OPT = PPC_DISC + 0x70000001,
     173 + 
     174 + PPC64_GLINK = PPC64_DISC + 0x70000000,
     175 + PPC64_OPT = PPC64_DISC + 0x70000003,
     176 + 
     177 + RISCV_VARIANT_CC = RISCV_DISC + 0x70000003,
     178 + };
     179 + 
     180 + static TAG from_value(uint64_t value, ARCH arch);
     181 + static uint64_t to_value(TAG tag);
     182 + 
     183 + DynamicEntry() = default;
     184 + DynamicEntry(const details::Elf64_Dyn& header, ARCH arch);
     185 + DynamicEntry(const details::Elf32_Dyn& header, ARCH arch);
     186 + 
     187 + DynamicEntry(TAG tag, uint64_t value) :
     188 + tag_(tag), value_(value)
     189 + {}
     190 + 
     191 + DynamicEntry& operator=(const DynamicEntry&) = default;
     192 + DynamicEntry(const DynamicEntry&) = default;
     193 + ~DynamicEntry() override = default;
     194 + 
     195 + virtual std::unique_ptr<DynamicEntry> clone() const {
     196 + return std::unique_ptr<DynamicEntry>(new DynamicEntry(*this));
     197 + }
    48 198   
    49 199   //! Tag of the current entry. The most common tags are:
    50 200   //! DT_NEEDED, DT_INIT, ...
    51  - DYNAMIC_TAGS tag() const;
     201 + TAG tag() const {
     202 + return tag_;
     203 + }
    52 204   
    53 205   //! Return the entry's value
    54 206   //!
    55 207   //! The meaning of the value strongly depends on the tag.
    56 208   //! It can be an offset, an index, a flag, ...
    57  - uint64_t value() const;
     209 + uint64_t value() const {
     210 + return value_;
     211 + }
    58 212   
    59  - void tag(DYNAMIC_TAGS tag);
    60  - void value(uint64_t value);
     213 + void tag(TAG tag) {
     214 + tag_ = tag;
     215 + }
     216 + 
     217 + void value(uint64_t value) {
     218 + value_ = value;
     219 + }
    61 220   
    62 221   void accept(Visitor& visitor) const override;
    63 222   
    64 223   virtual std::ostream& print(std::ostream& os) const;
    65 224   
    66  - 
    67  - LIEF_API friend std::ostream& operator<<(std::ostream& os, const DynamicEntry& entry);
     225 + LIEF_API friend
     226 + std::ostream& operator<<(std::ostream& os, const DynamicEntry& entry) {
     227 + return entry.print(os);
     228 + }
    68 229   
    69 230   protected:
    70  - DYNAMIC_TAGS tag_;
    71  - uint64_t value_;
     231 + TAG tag_ = TAG::DT_NULL;
     232 + uint64_t value_ = 0;
    72 233  };
     234 + 
     235 +LIEF_API const char* to_string(DynamicEntry::TAG e);
     236 + 
    73 237  }
    74 238  }
    75 239  #endif
    skipped 1 lines
Please wait...
Page is in error, reload to recover