diff options
Diffstat (limited to 'libs/elf')
| -rw-r--r-- | libs/elf/include/elf/section_header.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/elf/include/elf/section_header.hpp b/libs/elf/include/elf/section_header.hpp index 73e2e7b..3afe334 100644 --- a/libs/elf/include/elf/section_header.hpp +++ b/libs/elf/include/elf/section_header.hpp @@ -6,6 +6,7 @@ #include <cstdint> #include <limits> #include <type_traits> +#include <utility> namespace elf { @@ -60,6 +61,24 @@ namespace elf compressed = 0x800, ///< Is compressed }; + //! Check if the section is allocated + [[nodiscard]] constexpr auto allocated() const noexcept -> bool + { + return std::to_underlying(flags) & std::to_underlying(header_flags::allocated); + } + + //! Check if the section is executable + [[nodiscard]] constexpr auto executable() const noexcept -> bool + { + return std::to_underlying(flags) & std::to_underlying(header_flags::executable); + } + + //! Check if the section is writeable + [[nodiscard]] constexpr auto writable() const noexcept -> bool + { + return std::to_underlying(flags) & std::to_underlying(header_flags::writeable); + } + std::uint32_t name_offset; ///< Offset into the section header string table, defining the section name header_type type; ///< Type of this section header_flags flags; ///< Flags of this section @@ -74,6 +93,7 @@ namespace elf static_assert(sizeof(section_header<format::elf32>) == section_header_size<format::elf32>); static_assert(sizeof(section_header<format::elf64>) == section_header_size<format::elf64>); + } // namespace elf #endif
\ No newline at end of file |
