Compare commits

..
326 Commits
Author SHA1 Message Date
Romain Thomas 339a08fa60 Fix typo 2024-07-21 10:11:59 +02:00
Romain Thomas 9f7230eeb0 Update doc 2024-07-21 09:30:22 +02:00
Romain Thomas a3660898af Update changelog 2024-07-21 09:17:22 +02:00
Romain Thomas a9210e5af3 Cleanup 2024-07-20 07:31:26 +02:00
Romain Thomas 16508f9426 Fix version 2024-07-20 07:21:32 +02:00
Romain Thomas fec7d0190f Various updates 2024-07-20 07:20:05 +02:00
Romain Thomas 4c67c5b5de Enable versioning from 'LIEF_VERSION_ENV' 2024-07-20 07:10:00 +02:00
Romain Thomas 27d406be96 Resolve #1026 2024-07-20 07:01:19 +02:00
Romain Thomas 3d44a66cf9 Support more PKCS7 attributes for PE Authenticode 2024-07-20 06:04:31 +02:00
Romain Thomas 469c799e56 Update documentation 2024-07-20 05:10:01 +02:00
Romain Thomas bd138c5f3c Fix missing doc 2024-07-20 05:04:41 +02:00
Romain Thomas 3af17efa70 Fix typo 2024-07-15 06:52:16 +02:00
Romain Thomas c10e90df15 Fix missing operator 2024-07-13 12:43:40 +02:00
Romain Thomas b0e4bdb99d Fix windows build 2024-07-13 08:06:59 +02:00
Romain Thomas 306f34e992 Fix missing <string> 2024-07-13 07:53:52 +02:00
Romain Thomas b2b7fb96ec Add support for extensions. 2024-07-13 07:51:52 +02:00
Romain Thomas f31c8ff58d Remove personal account 2024-07-13 06:47:39 +02:00
Romain Thomas da6ca93e7d Avoid polluting compilation units with static initializer 2024-07-13 06:45:30 +02:00
Romain Thomas 9c7b9aa81c Add helper to provide a relocated view of **array** dynamic entries.
Close #1058, related to #626
2024-07-13 06:36:39 +02:00
Romain Thomas b441c2862d Cleanup 2024-07-13 06:10:34 +02:00
Romain Thomas 402e7a9b02 Add support for re-building Mach-O LC_RPATH commands
Resolve issue #1074
2024-07-13 06:01:54 +02:00
Romain Thomas f7acc24723 Add helper to check if the binary is supporting ARM64 ptr auth 2024-07-13 05:28:36 +02:00
Romain Thomas c23cccb7f9 Add Python 3.13 2024-07-06 07:14:52 +02:00
Romain Thomas 33703bc4d1 Cleanup: simplify interfaces 2024-06-29 06:35:21 +02:00
Romain Thomas e6ec359a3d Fix missing include (close #1071) 2024-06-29 06:11:06 +02:00
Romain Thomas 59332990ac More inlining & use move operator 2024-06-29 06:10:37 +02:00
Romain Thomas 4d5d2a4f0d Avoid parsing too many notes with errors 2024-06-29 06:04:05 +02:00
Romain Thomas f763b51274 Fix binary's original_size 2024-06-29 05:15:32 +02:00
Romain Thomas 525a870011 Add helper to *dyn_cast* a load config 2024-06-29 04:56:17 +02:00
Romain Thomas d2d9839af8 Cleanup enums 2024-06-29 04:50:09 +02:00
Romain Thomas fa57fa69e5 Fix headers 2024-06-29 04:22:55 +02:00
Romain Thomas 2b68ae5383 Cleanup 2024-06-22 10:09:29 +02:00
Romain Thomas 93245d3c7f Fix WARN/WARNING 2024-06-22 07:09:17 +02:00
Romain Thomas 62499ca1ab Add support for QNX Notes (QNT_STACK)
Resolve: #1065
2024-06-22 07:08:28 +02:00
Romain Thomas 2646cf042b Fix typo 2024-06-22 06:12:45 +02:00
Romain Thomas 5f0cec2167 Add trait on the enum when all elements implement this trait 2024-06-22 06:10:13 +02:00
Romain Thomas 2a31841aec Update logging interface 2024-06-22 05:49:59 +02:00
Romain Thomas 35b201bdf0 Cleaup examples 2024-06-22 05:26:42 +02:00
Romain Thomas 393fc9cabb Cleanup CMake 2024-06-22 05:19:20 +02:00
Romain Thomas 9906e2a024 Add sphinx_tabs.tabs 2024-06-16 13:24:56 +02:00
Romain Thomas 221bf8792e Cleanup 2024-06-15 06:32:10 +02:00
Romain Thomas 3f82c9ef82 Resolve #1070 2024-06-15 06:04:13 +02:00
Romain Thomas bca2738a33 Enhance Rust API 2024-06-15 05:40:32 +02:00
Romain Thomas e300b98120 Update changelog 2024-06-09 15:29:59 +02:00
Romain Thomas 69b6d53723 Bump requests version (close #1059) 2024-06-09 15:23:24 +02:00
Romain Thomas 7c3f631948 Fix performance issue (resolve #1069) 2024-06-09 15:16:58 +02:00
Romain Thomas fe10cd9fd7 Relax the condition about export name (resolve #1061) 2024-06-08 17:28:15 +02:00
Romain Thomas 4d2e96a0bf Fix platform 2024-06-08 07:37:26 +02:00
Emmanuel Ferdman a78251c92c Update linux-sdk-x64 reference (#1066)
* Update run_linux_sdk reference

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>

---------

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-06-08 07:21:51 +02:00
Romain Thomas 588ad8e2a6 Fix AArch64 wheel tag 2024-06-08 07:00:37 +02:00
Romain Thomas 839ef18dc0 Fix typo 2024-06-01 05:50:30 +02:00
Romain Thomas 0fd4757351 Fix enum values 2024-06-01 05:49:51 +02:00
Romain Thomas 318aab9690 Fix warnings 2024-06-01 05:33:01 +02:00
Romain Thomas c80b627484 Add range structure 2024-05-25 07:12:43 +02:00
Romain Thomas a0b33d7e7d Cleanup 2024-05-25 06:59:01 +02:00
Romain Thomas 8316dacf0b Add Mach-O UnknownCommand.
This command is a placeholder when LIEF does not a Mach-O load command
2024-05-25 06:45:08 +02:00
Romain Thomas f21b38f0c6 Fix missing UNKNOWN command 2024-05-25 06:33:34 +02:00
Romain Thomas 3f18682c61 Fix 2024-05-25 06:32:16 +02:00
Romain Thomas 3e11bf782b Update doc & cleanup 2024-05-25 06:31:37 +02:00
Romain Thomas b51dc15964 Code cleaning & doc update 2024-05-25 06:11:56 +02:00
Romain Thomas 9d3e02b6db Update doc & cleanup 2024-05-25 05:31:38 +02:00
Romain Thomas 2c54bd6930 Cleanup 2024-05-25 05:19:46 +02:00
Romain Thomas 221ba21f15 MSVC fix 2024-05-19 20:41:00 +02:00
Romain Thomas 122b86199f Cleanup headers 2024-05-19 19:38:20 +02:00
Romain Thomas 7911cddb64 Forward platform to arch 2024-05-18 11:29:05 +02:00
Romain Thomas ac880b2e82 Fix warnings 2024-05-18 11:20:32 +02:00
Romain Thomas a8b5f85917 Update profiling options 2024-05-18 11:02:02 +02:00
Romain Thomas 572d79537e Cleanup 2024-05-18 10:59:34 +02:00
Romain Thomas 93614a089b Move the PE's checksum computing in an dedicated function 2024-05-18 10:33:08 +02:00
Romain Thomas 93bb5926ec Add profiling utils 2024-05-18 08:59:25 +02:00
Romain Thomas bf557275a9 Cleaning 2024-05-18 06:33:59 +02:00
Romain Thomas 022f1636d7 Export functions when building a shared library 2024-05-18 06:30:36 +02:00
Romain Thomas f614400193 Add --skip-compilation option 2024-05-18 05:51:18 +02:00
Romain Thomas 0fb0368ed3 Compile without rtti & exceptions 2024-05-18 05:34:33 +02:00
Romain Thomas c0e988e571 Cleanup 2024-05-12 20:12:35 +02:00
Romain Thomas b88f20e04f Cleanup 2024-05-12 20:12:35 +02:00
Romain Thomas 0b75c6fe7c Remove unused include 2024-05-11 10:41:53 +02:00
Romain Thomas 0b73a52700 Add new targets for Rust bindings
- `aarch64-unknown-linux-gnu`
- `aarch64-apple-ios`
2024-05-10 17:54:15 +02:00
Romain Thomas 235be8ea65 Update tcb-span 2024-05-10 05:06:46 +02:00
Romain Thomas 4c4a82a6f4 Fix missing main 2024-05-09 21:53:37 +02:00
Romain Thomas 1dfa26fa12 More cl.exe fixes 2024-05-09 21:50:33 +02:00
Romain Thomas 3c76f67038 Windows fix 2024-05-09 21:39:31 +02:00
Romain Thomas fc8aa9aadd Disable warning 2024-05-09 21:25:50 +02:00
Romain Thomas c533aeffe3 Remove inline default ctor 2024-05-09 21:25:00 +02:00
Romain Thomas 51cad8a2a4 Disable C++ exceptions by default 2024-05-09 21:18:07 +02:00
Romain Thomas d4faafa481 Code lint 2024-05-09 21:18:03 +02:00
Romain Thomas e46074212d Re-scope Mach-O enums 2024-05-09 06:02:00 +02:00
Romain Thomas 9aec6c0570 Add forward declaration 2024-05-08 06:16:55 +02:00
Romain Thomas b014790b10 noexcept 2024-05-07 18:40:18 +02:00
Romain Thomas 807b257acd Resolve #1055 2024-05-06 16:57:27 +02:00
Romain Thomas 132ac2d971 Add musl config 2024-05-06 16:33:38 +02:00
Leland Jansen ef824c71bc Rename DEBUG enum variants 2024-05-06 16:18:48 +02:00
Romain Thomas b2b56a7107 Replace std::endl with \n 2024-05-05 23:31:23 +02:00
Romain Thomas 2a26324093 Fix const-ness 2024-05-04 09:02:51 +02:00
Romain Thomas be3fc43c72 Add support for extrapoling variables in config 2024-05-04 09:01:17 +02:00
Romain Thomas 465475f5f4 Bump scikit-build-core to v0.9.3
Note:

We are affected by the 0.9.0 update on `wheel.exclude`:

> The meaning of wheel.exclude has been changed to match on the wheel path, rather than the source path

So we had to revert to `sdist.exclude`

[1]: https://github.com/scikit-build/scikit-build-core/releases/tag/v0.9.0
2024-05-04 09:00:10 +02:00
Romain Thomas 6314d2b8f7 Disable exceptions from nlohmann/json 2024-05-04 08:48:50 +02:00
Romain Thomas 7faf45f80c Add support for Mach-O overlay
Resolve: #1028
2024-05-04 08:46:56 +02:00
Romain Thomas 97d96daa09 Inline overlay 2024-05-04 08:12:45 +02:00
Romain Thomas 5330d36aea Infer the page size from the binary instead of the host 2024-05-04 07:03:46 +02:00
Romain Thomas 6d18b3b062 Add support for other CI 2024-05-04 06:34:20 +02:00
Romain Thomas 393500d2cc Update utfcpp-3.2.1 to utfcpp-4.0.5 2024-05-04 05:19:34 +02:00
Romain Thomas cc11e22206 Update Catch2 from 3.5.2 to 3.5.4 2024-05-04 05:09:54 +02:00
Romain Thomas 73d91dd66d Update spdlog from 1.12.0 to 1.14.0 2024-05-04 05:03:32 +02:00
Romain Thomas f7698825a7 Cleanup 2024-04-28 17:30:25 +02:00
Romain Thomas 96240ed47b Add testcase for #1049
Close #1049
2024-04-28 17:16:04 +02:00
Romain Thomas d078438b87 cleanup 2024-04-28 17:10:07 +02:00
Romain Thomas 9c5c513dd5 Fix heap-buffer-overflow as described in issue #1049 2024-04-28 16:52:24 +02:00
Romain Thomas acd253fcd7 Make sure ContentInfo::value_ is not null.
This addresses the segfault case in the issue #1049
2024-04-28 16:12:21 +02:00
Romain Thomas 41a9730d33 Update changelog 2024-04-27 15:57:26 +02:00
Romain Thomas a09b9ac78e Update README 2024-04-27 15:44:57 +02:00
Romain Thomas d447511a64 Add rust bindings 2024-04-27 10:25:58 +02:00
Romain Thomas 6d1a230da2 Rename master branch into main 2024-04-27 06:19:02 +02:00
Romain Thomas 54d0a72c8e Merge pull request #1047 from FFRI/fix-out-of-range
fix ASN1Reader::tag2str
2024-04-27 06:02:08 +02:00
Romain Thomas 4d8211a2bd Remove ARM_UNWIND (in conflict with ARM_EXIDX) 2024-04-27 05:27:03 +02:00
yuki-mogi-ffri 10fa404f5e fix ASN1Reader::tag2str
Now ASN1Reader::tag2str function returns MBEDTLS_ASN1_UNKNOWN instead of throwing an out-of-range exception if the size of  is less than 3.
2024-04-23 15:08:08 +09:00
Romain Thomas 573c885de5 Fix non printable char 2024-04-06 07:30:28 +02:00
Romain Thomas 307e113f8e Resolve #1038 2024-03-30 07:14:40 +01:00
Romain Thomas 8d46eafe14 Remove ref 2024-03-17 05:52:14 +01:00
Romain Thomas 6dbb551af3 Resolve #1034 2024-03-17 05:50:45 +01:00
Romain Thomas ec17282da3 Update documentation 2024-03-17 05:45:45 +01:00
Romain Thomas a996621de2 Use /MD for the DLL 2024-03-17 03:38:00 +01:00
Romain Thomas 1c9c8522b6 Remove reference 2024-03-10 16:25:42 +01:00
Romain Thomas d30b870715 Fix missing entry 2024-03-02 11:14:05 +01:00
Romain Thomas 2b7b21aec0 Merge pull request #1029 from wonderkun/master
fix the bug in symbol.section_number to section
2024-03-02 11:12:23 +01:00
逸程 e0086cef46 fix the bug in symbol.section_number to section 2024-02-28 12:54:22 +08:00
Romain Thomas 5f0ff7094d Add doc 2024-02-25 16:41:47 +01:00
Romain Thomas 9d627769f0 Refactor LIEFApi.cmake 2024-02-25 10:49:42 +01:00
Romain Thomas 690d9f9987 Fix Python 2024-02-24 17:34:22 +01:00
Romain Thomas d62d481a7f Fix const-ness 2024-02-24 17:14:18 +01:00
Romain Thomas 630929ee2d Add const version 2024-02-24 17:11:02 +01:00
Romain Thomas 27f32e9060 Add icons 2024-02-24 16:56:22 +01:00
Romain Thomas a3a7a933ff Simplify the config 2024-02-24 16:56:18 +01:00
Romain Thomas 3f056100a4 Merge pull request #1025 from jevinskie/jev/dylibify
Add usable constructor for MachO::BuildVersion
2024-02-24 11:55:07 +01:00
Jevin Sweval a076f51d51 Add usable constructor to MachO::BuildVersion 2024-02-23 10:40:20 -05:00
Romain Thomas 5aba7e8bf5 Update catch2 2024-02-18 18:45:33 +01:00
Romain Thomas 88c28b16f4 Fix gcc(?) issue 2024-02-18 10:55:00 +01:00
Romain Thomas fe432fe881 Update Python backend dependencies 2024-02-18 06:20:38 +01:00
Romain Thomas 78fad9758e Add helper to disable nanobind warnings 2024-02-17 06:44:10 +01:00
Romain Thomas 129e542ab3 Resolve #1023 2024-02-17 06:30:02 +01:00
Romain Thomas b9b0adf65a Add CodeViewPDB GUID
Resolve #480
2024-02-17 06:01:02 +01:00
Romain Thomas 082fc725fe Init from a dedicated function 2024-02-17 05:29:15 +01:00
Romain Thomas b0f421bd5e Allow a static install of the Python bindings (internal usage) 2024-02-17 05:23:58 +01:00
Romain Thomas 638aa18708 Bump nanobind to 1.8.0.r43.g45c2a74 2024-02-17 05:03:04 +01:00
Romain Thomas 5087d6f1e4 Remove _lief in the type 2024-02-17 04:51:32 +01:00
Romain Thomas a4af271cc0 Add 0.14.1 2024-02-11 21:14:39 +01:00
Romain Thomas 1c112ee57c Resolve #1017 2024-02-11 17:01:51 +01:00
Romain Thomas dee8ad2d88 Fix performance issue: unwanted copy
Resolve #1022
2024-02-11 17:01:50 +01:00
Romain Thomas 480b92574c Merge pull request #1020 from ncatlin/master
fix pe relocations presence getter
2024-02-04 05:51:37 +01:00
Romain Thomas 9502c2b7ec Update copyrights 2024-02-04 05:50:39 +01:00
Romain Thomas 00e4a684a3 Add support for DT_RELR/DT_ANDROID_RELA relocations
This commit adds the support for the (new) relative relocations
as well as the Android packed relocation format.

Resolve: #111 #991
2024-02-03 15:52:54 +01:00
Romain Thomas 0fe1a8452b Fix name 2024-02-03 12:55:16 +01:00
Romain Thomas 6217d70643 Resolve #1019 2024-02-03 12:54:32 +01:00
Romain Thomas 737f2a9394 Fix MSVC issue 2024-02-03 12:54:28 +01:00
Romain Thomas 9d28a065df Disable rtti 2024-02-03 07:30:27 +01:00
Romain Thomas 979d0ec661 Resolve #1018 2024-02-03 07:02:36 +01:00
Romain Thomas cddd8dd076 Rename the static_symbol API into symtab_symbol 2024-02-03 06:31:30 +01:00
Romain Thomas acadc088ed Fix missing AArch64 2024-02-03 05:13:23 +01:00
Romain Thomas 7f02b5084d Handle empty container 2024-02-03 04:56:25 +01:00
Nia Catlin d1e095e194 fix pe relocations presence getter 2024-02-02 19:14:40 +00:00
Romain Thomas 7a62df9b58 Re-scope ELF enums 2024-01-28 22:54:25 +01:00
Romain Thomas 6b49ec5807 (yet) another @v4 fix 2024-01-27 21:45:42 +01:00
Romain Thomas a228ad308d v4 fix 2024-01-27 21:15:44 +01:00
Romain Thomas fb983d1764 Bump artifacts version 2024-01-27 15:15:41 +01:00
Romain Thomas 16c987247e Bump versions 2024-01-27 14:00:15 +01:00
Romain Thomas 3ec4d301aa Fix path 2024-01-27 11:27:06 +01:00
Romain Thomas f5ed2dff32 Fix EXCLUDE_FROM_ALL 2024-01-27 09:52:00 +01:00
Romain Thomas 21efe57265 LIEFConfig.cmake is now installed in lib/cmake/ 2024-01-27 08:28:35 +01:00
Romain Thomas 7cd186ddfa Fix #1016 -- Create aliases: ContentInfo::{digest,digest_algorithm} to SpcIndirectData::{digest,digest_algorithm} 2024-01-27 06:11:39 +01:00
Romain Thomas 0808283f8b Resolve #1014 2024-01-27 05:34:26 +01:00
Romain Thomas bb2bd6c679 CMake tweak 2024-01-21 16:04:19 +01:00
Romain Thomas 90a25eda22 Welcome 0.15.0 2024-01-21 15:43:33 +01:00
Romain Thomas 7c6a474387 Support release/ branches 2024-01-21 15:38:47 +01:00
Romain Thomas 0384b53478 Fix date 2024-01-20 18:19:29 +01:00
Romain Thomas 16962f2f36 Fix script 2024-01-20 06:20:34 +01:00
Romain Thomas 58f499a222 Update typing 2024-01-14 10:22:45 +01:00
Romain Thomas d87dfb24ac Fix test 2024-01-14 10:21:13 +01:00
Romain Thomas cea9fc5ca9 Fix enum conflict 2024-01-13 20:34:05 +01:00
Romain Thomas 6f74de8095 Fix tests 2024-01-13 11:56:06 +01:00
Romain Thomas ada25284df Refactor PE's relocation API 2024-01-13 11:53:58 +01:00
Romain Thomas 03e923030c Merge pull request #1011 from ch4mchi/fix/rsainfo_bignum_wrapper_t_size
Fix the size of bignum_wrapper_t returned from LIEF::PE::RsaInfo methods
2024-01-13 11:21:55 +01:00
ch4mchi ca50c91301 Fix the size of bignum_wrapper_t returned from LIEF::PE::RsaInfo methods 2024-01-11 17:54:17 +09:00
Romain Thomas bcd9b27df3 Address feedback from #1009
Add `has_nx_stack` and `has_nx_heap`
2024-01-07 10:23:37 +01:00
Romain Thomas c01dc6af49 Update PE's ResourcesManager 2024-01-07 10:11:57 +01:00
Romain Thomas 66fcfcc4e7 Add tests 2023-12-25 12:49:45 +01:00
Romain Thomas e13f2d5157 Merge pull request #1007 from yype/master
Another Fix to the `write` Templates
2023-12-24 17:09:32 +01:00
yype 2b13595323 another fix to the write templates 2023-12-24 01:57:05 +00:00
Romain Thomas 78d2f4b9d3 Cleanup PE LoadConfiguration interfaces 2023-12-23 05:06:26 +01:00
Romain Thomas a900afb238 Enhance #952 based on the feedback from @yype 2023-12-17 16:18:51 +01:00
Romain Thomas e6d3f28e7b Resolve #1003 2023-12-17 15:22:34 +01:00
Romain Thomas 3f2046e221 Merge pull request #1002 from ergrelet/fix_elf_has_nx
Fix LIEF::ELF::Binary::has_nx
2023-12-09 10:19:46 +01:00
Romain Thomas 8dd8a255a8 Narrow the scope of SIG_ATTRIBUTE_TYPES to LIEF::PE::Attribute::TYPE 2023-12-09 05:02:47 +01:00
ergrelet 0c7c79bea2 Fix LIEF::ELF::Binary::has_nx
The result boolean expression has been inverted in a previous commit
2023-12-07 23:29:50 +01:00
Romain Thomas 3aa5497b5e Cleanup 2023-12-03 10:02:46 +01:00
Romain Thomas fac0e7840e Add support for ELF NT_GNU_PROPERTY_TYPE_0 (read-only)
See: `tests/elf/test_notes.py` for API usage

Resolve: #975
2023-12-02 08:03:12 +01:00
Romain Thomas e6503fe74e Add compiler macro attributes 2023-12-02 05:30:47 +01:00
Romain Thomas 47a78077b4 Add helpers for cross-compilation 2023-11-26 15:48:58 +01:00
Romain Thomas 6ddc7e4145 Resolve #956 2023-11-25 11:46:31 +01:00
Romain Thomas e082255c32 Resolve #998 2023-11-20 06:12:25 +01:00
Romain Thomas df97777811 Fix typo and update the changelog 2023-11-18 12:33:36 +01:00
Romain Thomas 529d5a8679 Implement classof for Binary object 2023-11-18 09:00:39 +01:00
Romain Thomas ded37c5b92 Expose non-const iterators 2023-11-18 09:00:38 +01:00
Romain Thomas 002f356ed0 More span 2023-11-11 09:53:44 +01:00
Romain Thomas 879c4c5b3b More span 2023-11-10 18:38:29 +01:00
Romain Thomas 3ec79f96b0 Fix inline 2023-11-10 16:22:52 +01:00
Romain Thomas b113795dbb Impl classof() 2023-11-10 16:07:25 +01:00
Romain Thomas 5280c511ec Split files 2023-11-10 16:07:06 +01:00
Romain Thomas ad50afbdbf More span 2023-11-10 10:59:28 +01:00
Romain Thomas 1a1d2ec9e7 Update typing 2023-11-10 07:43:09 +01:00
Romain Thomas 262ad9735a Cleanup std::vector with span when it's suitable 2023-11-10 07:41:31 +01:00
Romain Thomas e25dcc3f90 Add timeout 2023-11-10 06:00:14 +01:00
Romain Thomas 1e0bc5d522 Simplify CMake 2023-11-10 05:33:41 +01:00
Romain Thomas 87cc6f8d4b Remove script no longer needed 2023-11-09 21:15:07 +01:00
Romain Thomas 9044fb6fc2 Fix typo 2023-11-09 21:13:44 +01:00
Romain Thomas 8eaf0669e1 Split fuzzing 2023-11-09 21:10:42 +01:00
Romain Thomas 77b94c0a4e Fix warnings 2023-11-09 20:52:44 +01:00
Romain Thomas fcf5daea07 Update fuzzing 2023-11-09 20:26:28 +01:00
Romain Thomas a9759992cc Add colored output 2023-11-09 20:09:15 +01:00
Romain Thomas af3040dcd6 Force color 2023-11-09 19:39:23 +01:00
Romain Thomas 67dac6bd8a Relax timeout 2023-11-09 19:09:30 +01:00
Romain Thomas 874b4c2512 Outline linux-py-x64 2023-11-09 19:04:48 +01:00
Romain Thomas be2be83eb6 Fix ccache 2023-11-09 16:23:35 +01:00
Romain Thomas e907b5989d Fix typo 2023-11-09 14:22:46 +01:00
Romain Thomas 98a08fc18e Remove script call 2023-11-09 14:22:45 +01:00
Romain Thomas 94f35ef40d Fix endless loop 2023-11-09 14:22:41 +01:00
Romain Thomas 2f61f29e84 Fix typo 2023-11-09 13:26:23 +01:00
Romain Thomas 5fe14ae8ae Split test step 2023-11-09 13:19:34 +01:00
Romain Thomas 1c0df938db Fix error 2023-11-09 09:07:53 +01:00
Romain Thomas c9c3b79334 Resize images 2023-11-09 09:07:37 +01:00
Romain Thomas 78c3196d67 Refactor the ELF Note support 2023-11-09 06:26:56 +01:00
Romain Thomas a7270ae577 Resolve #995 2023-11-09 06:16:50 +01:00
Romain Thomas 07df2f030f Resolve #994 2023-11-09 06:02:39 +01:00
Romain Thomas 267bab415a Update deployment script 2023-11-09 05:54:40 +01:00
Romain Thomas 0c472ca906 Replace str | None with Optional 2023-11-07 13:39:57 +01:00
Romain Thomas 23546d4bad Resolve #996
Usage:

```toml
[lief.build]
cxx-compiler = "/path/to/cxx"
c-compiler = "/path/to/c"
```
2023-11-07 11:43:12 +01:00
Romain Thomas d0ed158094 Update Sphinx C documentation 2023-11-07 10:47:02 +01:00
Romain Thomas 1c3e1d05b4 Fix missing include 2023-11-07 09:42:01 +01:00
Romain Thomas 05168d085a Update Doxygen 2023-11-07 07:20:24 +01:00
Romain Thomas 6b737986ba Fix alignement issue identified by @AvenGeeker
Resolve #993
2023-11-07 05:43:30 +01:00
Romain Thomas 6a98c63b06 Fix tests 2023-11-04 06:06:59 +01:00
Romain Thomas 2ed2b61c09 Speed-up compilation flags detection 2023-11-04 05:39:29 +01:00
Romain Thomas 1eb2df6e47 Use a CMakeLists.txt in the src/ directory 2023-11-04 05:31:13 +01:00
Romain Thomas 78006bc772 New build backend based on scikit-build-core 2023-11-04 04:06:51 +01:00
Romain Thomas 9961f6629d Resolve 984 2023-10-28 15:09:15 +02:00
Romain Thomas 8bd5e5824a Relax git versioning condition 2023-10-28 07:11:34 +02:00
Romain Thomas 1a44327d19 Fix Windows version 2023-10-28 05:47:36 +02:00
Romain Thomas 29f7e9d86f Python 3.12 support 2023-10-28 05:39:27 +02:00
Romain Thomas 00a00150d0 Fix EOL (NIX vs Windows) 2023-10-28 05:37:57 +02:00
Romain Thomas 021705297d Remove unused section 2023-10-22 20:07:31 +02:00
Romain Thomas e5ef1da160 Fix typing 2023-10-22 14:00:04 +02:00
Romain Thomas c6db72896f Add languages 2023-10-21 06:37:05 +02:00
Romain Thomas 2a2c56a173 Make typing stubs more accurate 2023-10-21 06:36:59 +02:00
Romain Thomas a27bd6a644 Add support for os.PathLike inputs in the parsers
Resolve: #974
2023-10-21 05:23:42 +02:00
Romain Thomas dffcff5df7 Fix logging 2023-10-15 23:03:20 +02:00
Romain Thomas 3ade2736c0 Improve typing stubs 2023-10-15 22:14:28 +02:00
Romain Thomas b8409a73c2 Fix missing include 2023-10-15 16:48:57 +02:00
Romain Thomas befbf6b4a0 Merge pull request #978 from adrianherrera/bugfix/cmake_add_subdirectory
Prefer CMAKE_CURRENT_BINARY_DIR over CMAKE_BINARY_DIR
2023-10-14 06:17:23 +02:00
Romain Thomas 5c43eadcd1 Use Python sys.stderr for LIEF's logger
By default, LIEF's logger uses `stderr` to emit log messages which
is not catchable in Python. This commit makes use of `sys.stderr` for
the Python bindings.
2023-10-14 05:36:41 +02:00
Romain Thomas 04b2fb88ac Move to spdlog 1.12.0 2023-10-14 05:01:25 +02:00
Adrian Herrera f4281b07e6 cmake: prefer CMAKE_CURRENT_BINARY_DIR over CMAKE_BINARY_DIR
Using CMAKE_BINARY_DIR breaks nesting LIEF within another cmake project
via add_subdirectory (as described
[here](https://lief-project.github.io/doc/latest/installation.html#add-subdirectory-or-fetchcontent)).
This is because CMAKE_BINARY_DIR will return the top-level of the build
tree, but if LIEF is nested within another cmake project this will not
correspond to LIEF's actual location.

Instead, CMAKE_CURRENT_BINARY_DIR will use the correct location.
2023-10-09 16:02:46 +11:00
Romain Thomas 293500897d Update issue template 2023-10-08 17:13:59 +02:00
Romain Thomas 068512c331 Bump nanobind to 1.6.2.r7.gb4c5af0 2023-10-07 12:48:52 +02:00
Romain Thomas b5b845a076 Cleanup cmake 2023-10-07 06:45:00 +02:00
Romain Thomas e8be94770c Fix temp path 2023-10-07 06:26:35 +02:00
Romain Thomas d1c16a2f8f Resolve #968 2023-10-07 06:07:47 +02:00
Romain Thomas d5dc7fdda0 Resolve #976 2023-10-07 05:39:30 +02:00
Romain Thomas d7b962d782 Fix 2023-10-01 10:35:08 +02:00
Romain Thomas dd95b2fbab Fix list vs tuple 2023-10-01 09:20:55 +02:00
Romain Thomas 9de43ed301 Set build temp 2023-10-01 09:14:08 +02:00
Romain Thomas a807fecf91 Fix path 2023-09-30 22:18:27 +02:00
Romain Thomas beb05cae8d Fix path 2023-09-30 21:44:10 +02:00
Romain Thomas 84b053793c Overload setuptools commands 2023-09-30 21:13:51 +02:00
Romain Thomas dd96f0129c pip wheel update 2023-09-30 15:56:10 +02:00
Romain Thomas b4c2f47563 Get rid of setup.py (deprecated) 2023-09-30 10:48:42 +02:00
Romain Thomas f8b7dd7031 Fix include 2023-09-30 06:44:49 +02:00
Romain Thomas db0bf3e794 Remove typing info 2023-09-30 06:40:03 +02:00
Romain Thomas 8e9eb84785 Resolve #970 2023-09-30 06:04:29 +02:00
Romain Thomas ad312da094 Add option for a custom build dir 2023-09-30 04:39:37 +02:00
Romain Thomas 6e4722624a Fix typo 2023-09-23 06:49:27 +02:00
Romain Thomas 8e9a68aded Merge pull request #971 from su-vikas/master
ELF Python - fixing utf-8 encoding issue
2023-09-21 21:41:48 +02:00
Vikas 84d1388e5e ELF Python - fixing utf-8 encoding issue 2023-09-21 20:08:13 +05:30
Romain Thomas c0a05dc6ec Fix test 2023-09-16 07:21:20 +02:00
Romain Thomas b3d6b20085 Fix return type (#965) 2023-09-16 06:00:21 +02:00
Romain Thomas e89db0c1c9 Update references 2023-09-16 05:49:54 +02:00
Romain Thomas 3c959daa58 Resolve #965 2023-09-16 05:49:26 +02:00
Romain Thomas 3414ded8cd Fix doc (#962) 2023-09-10 20:54:36 +02:00
Romain Thomas 1f52f26c13 Add requirement file 2023-09-10 13:33:28 +02:00
Romain Thomas b820df0bd7 Fix space 2023-09-10 13:11:23 +02:00
Romain Thomas ed4f9b5bb6 Merge pull request #961 from starseeker/master
Adjust file listings for Ninja Multi-Config build
2023-09-09 05:44:32 +02:00
Clifford Yapp c36120abdb Adjust file listings for Ninja Multi-Config build
For CMake's Ninja Multi-Config generator, we need to list all the
mbedtls files explicitly as BUILD_BYPRODUCTS for ExternalProject_Add
rather than just the directory.
2023-09-08 10:48:28 -04:00
Romain Thomas 8ef47cd979 Resolve #959 2023-09-02 11:55:23 +02:00
Romain Thomas 0030630df4 Resolve #958 2023-09-02 06:03:44 +02:00
Romain Thomas 88030da9a8 Remove unused field 2023-08-27 23:12:45 +02:00
Romain Thomas 1ecfbf1fd8 Add new ELF DT_ enums.
This commit resolves the `UNDEFINED` output mentioned in #954, whilst
not supporting yet the packed relocations.
2023-08-27 21:33:23 +02:00
Romain Thomas 2ad31be179 Merge pull request #953 from gvalkov/docfix
Use list comprehension instead of map/filter in tutorial
2023-08-20 16:40:19 +00:00
Georgi Valkov 02ecdd12b3 Use list comprehension instead of map/filter 2023-08-20 10:49:21 +02:00
Romain Thomas 660f26ebf4 Resolve #952 2023-08-19 05:09:20 +02:00
Romain Thomas 1f3b19ea21 Merge pull request #949 from rdbo/rdbo-iterator-windows-fix
Removed _ITERATOR_DEBUG_LEVEL override on Windows builds
2023-08-12 15:34:47 +00:00
Rdbo 71f64b9dab updated CMakeLists
Removed override of `_ITERATOR_DEBUG_LEVEL` variable on Windows.
2023-08-07 00:33:32 +00:00
Romain Thomas bab28ae062 Merge pull request #947 from Biswa96/cmake-fix-win32
CMake: Fix checking Windows platform
2023-08-06 15:41:17 +00:00
Biswapriyo Nath 2b6b2d488e CMake: Fix checking Windows platform
In CMake, WIN32 is true for any toolchain targeting Windows platform.
See https://cmake.org/cmake/help/latest/variable/WIN32.html
2023-08-06 19:23:24 +05:30
Romain Thomas 5b6eefbe9c Resolve #945 2023-08-05 21:28:36 +02:00
Romain Thomas 65d6b150d6 Cleanup 2023-07-30 22:31:11 +02:00
Romain Thomas 9e9d26f70b Fix static_assert 2023-07-30 12:35:21 +02:00
Romain Thomas 3185d59870 Clean header 2023-07-30 12:33:10 +02:00
Romain Thomas 73e23deb60 Clean doc 2023-07-30 12:27:45 +02:00
Romain Thomas 752ab8a3ce Udpate cmake 2023-07-30 11:14:59 +02:00
Romain Thomas f70b2371b9 Clean cmake 2023-07-30 08:26:11 +02:00
Romain Thomas c6381bbcc1 Update doc 2023-07-30 06:24:47 +02:00
Romain Thomas f999ea6456 Clean and refactor the PE SignatureParser 2023-07-30 06:07:41 +02:00
Romain Thomas ac939a645f Update 2023-07-28 17:30:28 +02:00
Romain Thomas cc165d2aba Refactor and clean LIEF::PE::Section 2023-07-28 17:15:14 +02:00
Romain Thomas 5b8ef83022 Clean conf 2023-07-28 07:12:44 +02:00
Romain Thomas 6a90b3457f Refactor and clean LIEF::PE::DataDirectory 2023-07-27 21:14:38 +02:00
Romain Thomas d34d20c198 Refactor and clean LIEF::PE::Header 2023-07-27 18:33:09 +02:00
Romain Thomas 22a6ffa0bd Refactor and clean LIEF::PE::OptionHeader 2023-07-27 18:30:11 +02:00
Romain Thomas 1781ba0f61 Clean DosHeader interface 2023-07-27 18:23:43 +02:00
Romain Thomas 6e328569fb Clean TLS interface 2023-07-27 07:48:08 +02:00
Romain Thomas 00d9cc7c25 Fix test 2023-07-27 07:16:53 +02:00
Romain Thomas bff5411884 Fix reserved identifier 2023-07-27 07:16:40 +02:00
Romain Thomas c225890973 Inline functions that are suitable for inlining 2023-07-26 21:58:48 +02:00
Romain Thomas 96193a0488 Add memory profiler 2023-07-26 21:28:17 +02:00
Romain Thomas 5936e85d02 Fix typo 2023-07-26 07:30:18 +02:00
Romain Thomas e41c3280ec Improve API 2023-07-26 06:09:56 +02:00
Romain Thomas e4a7f679a8 Add code-check action 2023-07-26 06:07:22 +02:00
Romain Thomas 97bf8b65ff Clean and simplify code 2023-07-25 18:41:39 +02:00
1812 changed files with 82368 additions and 43390 deletions

No files matched your search

+1 -1
View File
@@ -1 +1 @@
github: [romainthomas]
github: [lief-project]
+9 -1
View File
@@ -4,7 +4,6 @@ about: You identified a bug or a problem in LIEF
title: ''
labels: ''
assignees: romainthomas
---
**Describe the bug**
@@ -23,3 +22,12 @@ A clear and concise description of what you expected to happen (if applicable)
**Additional context**
Add any other context about the problem here.
**NOTICE**
If the issue does not contain enough information to be reproduced,
it will be flagged as [incomplete](https://github.com/lief-project/LIEF/issues?q=is%3Aissue+is%3Aclosed+label%3AIncomplete)
and closed.
**/NOTICE**
+2 -2
View File
@@ -4,6 +4,6 @@ bucket = "lief"
endpoint = "https://s3.fr-par.scw.cloud"
[lief.deploy]
branches = ["master", "deploy", "devel"]
main-branches = ["master", "main"]
branches = ["main", "master", "deploy", "devel"]
main-branches = ["main", "master"]
default-dir = "latest"
+39 -14
View File
@@ -12,17 +12,18 @@ import os
import sys
import tempfile
import tomli
import re
LOG_LEVEL = logging.INFO
CURRENTDIR = Path(__file__).resolve().parent
REPODIR = CURRENTDIR.parent
ASSET_DIR = CURRENTDIR / "assets"
CONFIG_DIR = CURRENTDIR / "config"
LIEF_S3_KEY = os.getenv("LIEF_S3_KEY", None)
LIEF_S3_SECRET = os.getenv("LIEF_S3_SECRET", None)
OWNED_ORGS = ["lief-project/", "romainthomas/"]
RELEASE_KEYWRD = "release-"
CURRENTDIR = Path(__file__).resolve().parent
REPODIR = CURRENTDIR.parent
ASSET_DIR = CURRENTDIR / "assets"
CONFIG_DIR = CURRENTDIR / "config"
LIEF_S3_KEY = os.getenv("LIEF_S3_KEY", None)
LIEF_S3_SECRET = os.getenv("LIEF_S3_SECRET", None)
OWNED_ORGS = ["lief-project/", "romainthomas/"]
RELEASE_KEYWORD = ["release-", "release/"]
DEFAULT_CONFIG = CONFIG_DIR / "gh-ci.toml"
DEFAULT_TEMPLATE = (ASSET_DIR / "index.j2").read_text()
@@ -248,25 +249,49 @@ class GithubDeploy:
def is_main_branch(self, name: str) -> bool:
return name in self._main_branches
def should_be_deployed(self, branch: str) -> bool:
if GithubDeploy.is_tagged():
return True
if any(re.match(s, branch) for s in self._branches):
return True
if any(branch.startswith(e) for e in RELEASE_KEYWORD):
return True
return False
def deploy(self, directories: list[str]):
s3dir = None
tag = None
if GithubDeploy.is_tagged():
s3dir = GithubDeploy.tag_name()
tag = s3dir if len(s3dir) > 0 else None
logger.info("Deployment for tag: %s", tag)
else:
branch = GithubDeploy.branch()
if branch is None:
logger.warning("Can't resolve the branch name")
sys.exit(1)
if branch.startswith(RELEASE_KEYWRD):
_, s3dir = branch.split(RELEASE_KEYWRD)
elif self.is_main_branch(branch):
s3dir = self._default_dir
else:
s3dir = branch.replace("/", "-").replace("_", "-")
for rel_kwrd in RELEASE_KEYWORD:
if branch.startswith(rel_kwrd):
_, s3dir = branch.split(rel_kwrd)
if s3dir is None:
if self.is_main_branch(branch):
s3dir = self._default_dir
else:
s3dir = branch.replace("/", "-").replace("_", "-")
if not self.should_be_deployed(branch):
logger.info("Skipping deployment for branch: %s", branch)
return
if s3dir is None:
logger.error("Target directory is not set")
sys.exit(1)
logger.info("s3dir: %s", s3dir)
self.s3_manager.change_dir(s3dir)
for dirname in directories:
+7
View File
@@ -0,0 +1,7 @@
setuptools
boto3
requests
twine
tomli
mako
wheel
+7 -7
View File
@@ -1,5 +1,5 @@
name: 'Android'
on: workflow_dispatch
on: push
jobs:
build-sdk:
@@ -9,7 +9,7 @@ jobs:
arch: ['arm', 'arm64']
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -18,7 +18,7 @@ jobs:
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
key: android-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get-date.outputs.date }}
@@ -36,9 +36,9 @@ jobs:
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
--rm liefproject/android-${ARCH} bash /work/scripts/docker/android-${ARCH}.sh
--rm liefproject/android-${ARCH} bash /work/scripts/docker/android-sdk-${ARCH}
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: android-sdk-${{ matrix.arch }}
path: build/*.tar.gz
@@ -48,11 +48,11 @@ jobs:
runs-on: ubuntu-latest
needs: build-sdk
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/artifacts
- name: Display artifacts
+54 -8
View File
@@ -4,12 +4,22 @@ on:
inputs:
branch:
description: 'LIEF branch'
default: 'master'
default: main
required: false
type: string
what:
description: 'clang-tidy action'
default: latest
required: false
type: string
job:
description: 'Job (e.g. coverage)'
default: "all"
required: false
type: string
push:
branches:
- test/code-check
- main
jobs:
coverage:
runs-on: ubuntu-latest
@@ -18,14 +28,50 @@ jobs:
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
GH_BRANCH: ${{ inputs.branch }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: lief-project/code-check
token: ${{ secrets.LIEF_CLONE_TOKEN }}
- name: Print info
run: |
echo ${GH_BRANCH}
- name: Running LIEF coverage
- name: Running LIEF coverage [workflow dispatch]
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.job == 'all' || github.event.inputs.job == 'coverage') }}
run: ./lief-coverage --debug
- name: Running LIEF coverage [regular]
if: ${{ github.event_name != 'workflow_dispatch' }}
run: ./lief-coverage --debug
clang-tidy:
runs-on: ubuntu-latest
container:
image: liefproject/code-check
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
steps:
- uses: actions/checkout@v4
with:
repository: lief-project/code-check
token: ${{ secrets.LIEF_CLONE_TOKEN }}
- name: Running LIEF coverage [workflow dispatch]
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.job == 'all' || github.event.inputs.job == 'clang-tidy') }}
run: ./lief-tidy --branch ${{ github.event.inputs.branch }} ${{ github.event.inputs.what }}
- name: Running LIEF coverage [regular]
if: "github.event.name != 'workflow_dispatch'"
run: ./lief-tidy latest
memory-profiler:
runs-on: ubuntu-latest
container:
image: liefproject/code-check
env:
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
steps:
- uses: actions/checkout@v4
with:
repository: lief-project/code-check
token: ${{ secrets.LIEF_CLONE_TOKEN }}
- name: Running LIEF memory profiler [workflow dispatch]
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.job == 'all' || github.event.inputs.job == 'memprof') }}
run: ./lief-memory-profile --branch ${{ github.event.inputs.branch }}
- name: Running LIEF memory profiler [regular]
if: "github.event.name != 'workflow_dispatch'"
run: ./lief-memory-profile
+8 -15
View File
@@ -1,24 +1,16 @@
name: 'iOS'
on: workflow_dispatch
env:
python-version: '3.10'
on: push
jobs:
ios-sdk:
runs-on: macos-11.0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ env.python-version }}
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
- name: Get Date
id: get-date
run: |
@@ -29,7 +21,7 @@ jobs:
run: |
mkdir -p ~/.ccache
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/.ccache
key: ios-${{ runner.os }}-${{ steps.get-date.outputs.date }}
@@ -45,7 +37,7 @@ jobs:
run: |
bash scripts/osx/package_ios.sh
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ios-sdk
path: build/*.tar.gz
@@ -55,11 +47,11 @@ jobs:
if: ${{ always() }}
needs: ios-sdk
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/artifacts
- name: Display artifacts
@@ -80,7 +72,8 @@ jobs:
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
liefproject/deploy \
python3 /src/.github/deploy.py /runner_tmp/artifacts
+45 -32
View File
@@ -1,11 +1,11 @@
name: 'Linux AArch64'
on: workflow_dispatch
on: push
jobs:
linux-sdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -14,7 +14,7 @@ jobs:
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
key: linux-aarch64-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
@@ -24,22 +24,27 @@ jobs:
shell: bash
run: |
mkdir -p $RUNNER_TEMP/lief-install
docker run --name lief_sdk --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/work \
-v $RUNNER_TEMP/lief-install:/install \
-v $HOME/.ccache:/ccache \
liefproject/manylinux2014-aarch64 bash /work/scripts/docker/linux-aarch64.sh
mkdir -p $HOME/.ccache
chmod -R 777 $HOME/.ccache
docker run --name lief-sdk -u 1001:1001 --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/src \
-v $RUNNER_TEMP/lief-install:/install \
-v $HOME/.ccache:/ccache \
liefproject/manylinux2014-aarch64 \
bash /src/scripts/docker/linux-sdk-aarch64
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-sdk
path: build/*.tar.gz
retention-days: 3
- name: 'Upload Install Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-install
path: ${{ runner.temp }}/lief-install
@@ -49,9 +54,9 @@ jobs:
needs: linux-sdk
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -60,14 +65,14 @@ jobs:
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
key: linux-aarch64-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-aarch64-${{ runner.os }}-${{ matrix.python-version }}
- name: Download LIEF install dir
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: linux-aarch64-install
path: ${{ runner.temp }}/lief-install
@@ -76,20 +81,25 @@ jobs:
env:
PYTHON_VERSION: ${{ matrix.python-version }}
run: |
mkdir -p $HOME/.ccache
chmod -R 777 $HOME/.ccache
PYTHON_VERSION_ALT=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION_ALT \
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION} \
-v $GITHUB_WORKSPACE:/work \
-v $HOME/.ccache:/ccache \
-v $RUNNER_TEMP/lief-install:/install \
liefproject/manylinux2014-aarch64 bash /work/scripts/docker/manylinux2014-aarch64.sh
PYTHON_BINARY="/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION}"
docker run -u 1001:1001 --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION_ALT \
-e PYTHON_BINARY=$PYTHON_BINARY \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
-v $RUNNER_TEMP/lief-install:/install \
liefproject/manylinux2014-aarch64 \
bash /src/scripts/docker/linux-py-aarch64
- name: 'Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-aarch64-python${{ matrix.python-version }}-wheel
path: dist/*.whl
@@ -99,12 +109,14 @@ jobs:
if: ${{ always() }}
needs: [linux-sdk, wheels]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
pattern: linux-aarch64-*
merge-multiple: true
path: ${{ runner.temp }}/artifacts
- name: Display artifacts
run: ls -R
@@ -124,6 +136,7 @@ jobs:
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
liefproject/deploy \
python3 /src/.github/deploy.py /runner_tmp/artifacts
+167 -58
View File
@@ -1,11 +1,25 @@
name: 'Linux x86-64'
on: workflow_dispatch
on: push
jobs:
linux-sdk:
runs-on: ubuntu-latest
container:
image: liefproject/manylinux_2_28_x86_64
env:
CCACHE_DIR: "/home/pylief/.ccache"
CXXFLAGS: "-ffunction-sections -fdata-sections -fvisibility-inlines-hidden -static-libstdc++ -static-libgcc"
CFLAGS: "-ffunction-sections -fdata-sections -static-libstdc++ -static-libgcc"
LDFLAGS: "-Wl,--gc-sections -Wl,--exclude-libs,ALL"
BUILD_DIR_STATIC: "/tmp/build/linux-x86-64/static-release"
BUILD_DIR_SHARED: "/tmp/build/linux-x86-64/shared-release"
CLICOLOR_FORCE: "1"
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
ACTIONS_RUNTIME_TOKEN: "${{ env.ACTIONS_RUNTIME_TOKEN }}"
ACTIONS_CACHE_URL: "${{ env.ACTIONS_CACHE_URL }}"
options: --user 1001:1001
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -13,42 +27,74 @@ jobs:
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Prepare ccache
shell: bash
run: |
mkdir -p /home/pylief/.ccache/tmp
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
path: /home/pylief/.ccache
key: linux-x86-64-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-x86-64-${{ runner.os }}-sdk
- name: Build SDK
- name: CMake - Static
shell: bash
run: |
mkdir -p $RUNNER_TEMP/lief-install
docker run --name lief_sdk --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_DIR=/ccache \
-v $GITHUB_WORKSPACE:/src \
-v $RUNNER_TEMP/lief-install:/install \
-v $HOME/.ccache:/ccache \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_sdk.sh
mkdir -p ${BUILD_DIR_STATIC}
cmake -S $GITHUB_WORKSPACE -B ${BUILD_DIR_STATIC} -GNinja \
-DCMAKE_LINK_WHAT_YOU_USE=on \
-DBUILD_SHARED_LIBS=off \
-DLIEF_INSTALL_COMPILED_EXAMPLES=on \
-DCMAKE_INSTALL_PREFIX=/install \
-DCMAKE_BUILD_TYPE=Release
- name: Compile - Static
shell: bash
run: |
cmake --build ${BUILD_DIR_STATIC} --target install
- name: CMake - Shared
shell: bash
run: |
mkdir -p ${BUILD_DIR_SHARED}
cmake -S $GITHUB_WORKSPACE -B ${BUILD_DIR_SHARED} -GNinja \
-DCMAKE_LINK_WHAT_YOU_USE=on \
-DBUILD_SHARED_LIBS=on \
-DLIEF_INSTALL_COMPILED_EXAMPLES=off \
-DCMAKE_BUILD_TYPE=Release
- name: Compile - Shared
run: |
cmake --build ${BUILD_DIR_SHARED} --target all
- name: Package
run: |
cd /tmp/build/linux-x86-64
cpack --config $GITHUB_WORKSPACE/cmake/cpack.config.cmake
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-x86-64-sdk
path: build/*.tar.gz
path: /tmp/build/linux-x86-64/*.tar.gz
retention-days: 3
- name: 'Upload Install Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-x86-64-install
path: ${{ runner.temp }}/lief-install
path: /install
retention-days: 1
testing:
if: "!contains(github.event.commits[0].message, '[skip-test]')"
runs-on: ubuntu-latest
container:
image: liefproject/manylinux_2_28_x86_64
env:
PYTHON_BINARY: "/opt/python/cp38-cp38/bin/python3.8"
LIEF_SAMPLES_DIR: "/tmp/samples"
LIEF_BUILD_DIR: "/tmp/lief-build"
LIEF_VENV: "/tmp/venv"
CLICOLOR_FORCE: "1"
PYTEST_ADDOPTS: "--color=yes"
options: --user 1001:1001
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -57,35 +103,90 @@ jobs:
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
key: linux-x86-64-${{ runner.os }}-test-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-x86-64-${{ runner.os }}-test
- name: Python 3.8 -- Wheel & Test
- name: Prepare Python virtual env
shell: bash
env:
PYTHON_VERSION: 38
run: |
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp38-cp38/bin/python3.8 \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.sh
$PYTHON_BINARY -m venv ${LIEF_VENV}
source ${LIEF_VENV}/bin/activate
python -m pip install \
-r tests/requirements.txt \
-r api/python/build-requirements.txt
- name: Build & install LIEF
shell: bash
run: |
source ${LIEF_VENV}/bin/activate
export PYLIEF_CONF="${GITHUB_WORKSPACE}/scripts/docker/config/pylinux-test-x64.toml"
python -m pip -vvv install api/python
- name: Prepare test samples
shell: bash
run: |
source ${LIEF_VENV}/bin/activate
mkdir -p ${LIEF_SAMPLES_DIR}
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
- name: Run tests
timeout-minutes: 5
shell: bash
run: |
source ${LIEF_VENV}/bin/activate
python tests/run_pytest.py
python tests/run_tools_check.py ${LIEF_BUILD_DIR}/
ctest --output-on-failure --test-dir ${LIEF_BUILD_DIR}/
- name: Fuzzing [ls x86-64]
shell: bash
timeout-minutes: 20
run: |
source ${LIEF_VENV}/bin/activate
export PYTHONPATH="${GITHUB_WORKSPACE}/tests:$PYTHONPATH"
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_ls.bin -n 100
- name: Fuzzing [openssl x86-64]
shell: bash
timeout-minutes: 20
run: |
source ${LIEF_VENV}/bin/activate
export PYTHONPATH="${GITHUB_WORKSPACE}/tests:$PYTHONPATH"
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_openssl.bin -n 100
- name: Fuzzing [nm x86-64]
shell: bash
timeout-minutes: 20
run: |
source ${LIEF_VENV}/bin/activate
export PYTHONPATH="${GITHUB_WORKSPACE}/tests:$PYTHONPATH"
python tests/elf/fuzzing.py \
${LIEF_BUILD_DIR}/tests/Melkor/src/MELKOR/melkor \
--input-seed ${LIEF_SAMPLES_DIR}/ELF/ELF64_x86-64_binary_nm.bin -n 100
pywheels:
runs-on: ubuntu-latest
needs: linux-sdk
container:
image: liefproject/manylinux_2_28_x86_64
env:
CCACHE_DIR: "/home/pylief/.ccache"
CXXFLAGS: "-ffunction-sections -fdata-sections -fvisibility-inlines-hidden -static-libgcc"
CFLAGS: "-ffunction-sections -fdata-sections -static-libgcc"
LDFLAGS: "-Wl,--gc-sections -Wl,--exclude-libs,ALL"
CLICOLOR_FORCE: "1"
FORCE_COLOR: "1"
LIEF_BUILD_DIR: "/tmp/lief-build"
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
ACTIONS_RUNTIME_TOKEN: "${{ env.ACTIONS_RUNTIME_TOKEN }}"
ACTIONS_CACHE_URL: "${{ env.ACTIONS_CACHE_URL }}"
options: --user 1001:1001
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Date
@@ -93,37 +194,42 @@ jobs:
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Prepare ccache
shell: bash
run: |
mkdir -p /home/pylief/.ccache/tmp
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.ccache
path: /home/pylief/.ccache
key: linux-x86-64-${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
restore-keys: |
linux-x86-64-${{ runner.os }}-${{ matrix.python-version }}
- name: Download LIEF install dir
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: linux-x86-64-install
path: ${{ runner.temp }}/lief-install
- name: Python ${{ matrix.python-version }} -- Wheel
shell: bash
path: /install
- name: Generate wheel
env:
PYTHON_VERSION: ${{ matrix.python-version }}
shell: bash
run: |
export PYLIEF_CONF=$GITHUB_WORKSPACE/scripts/docker/config/pylinux-x64.toml
PYTHON_VERSION_ALT=$(echo "${PYTHON_VERSION}" | sed 's/\.//') # Transform 3.8 -> 38
docker run --rm \
-e CCACHE_COMPRESS=1 \
-e CCACHE_MAXSIZE=10.0G \
-e CCACHE_CPP2=1 \
-e CCACHE_DIR=/ccache \
-e PYTHON_VERSION=$PYTHON_VERSION_ALT \
-e PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION} \
-v $GITHUB_WORKSPACE:/src \
-v $HOME/.ccache:/ccache \
-v $RUNNER_TEMP/lief-install:/install \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux.sh
PYTHON_BINARY=/opt/python/cp${PYTHON_VERSION_ALT}-cp${PYTHON_VERSION_ALT}/bin/python${PYTHON_VERSION}
$PYTHON_BINARY -m pip -vvv wheel --disable-pip-version-check \
--wheel-dir=$GITHUB_WORKSPACE/wheel_stage \
$GITHUB_WORKSPACE/api/python
- name: Run auditwheel
shell: bash
run: |
ls -alh $GITHUB_WORKSPACE/wheel_stage
find $GITHUB_WORKSPACE/wheel_stage -exec \
auditwheel repair -w $GITHUB_WORKSPACE/dist {} \;
ls -alh $GITHUB_WORKSPACE/dist
- name: 'Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: linux-x86-64-python${{ matrix.python-version }}-wheel
path: dist/*.whl
@@ -133,12 +239,14 @@ jobs:
if: ${{ always() }}
needs: [linux-sdk, pywheels]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
pattern: linux-x86-64-*
merge-multiple: true
path: ${{ runner.temp }}/artifacts
- name: Display artifacts
run: ls -R
@@ -158,7 +266,8 @@ jobs:
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
liefproject/deploy \
python3 /src/.github/deploy.py /runner_tmp/artifacts
documentation:
needs: [deploy]
runs-on: ubuntu-latest
@@ -169,9 +278,9 @@ jobs:
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
steps:
- name: Trigger documentation
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/main'
run: |
curl --request POST --url ${CIRCLE_CI_URL} \
--header "Circle-Token: ${CIRCLE_CI_TOKEN}" \
--header 'content-type: application/json' \
--data '{"parameters":{"lief-branch":"master"}}'
--data '{"parameters":{"lief-branch":"main"}}'
+42 -35
View File
@@ -1,5 +1,5 @@
name: 'macOS'
on: workflow_dispatch
on: push
env:
python-test-version: '3.10'
@@ -8,7 +8,7 @@ jobs:
osx-sdk:
runs-on: macos-11.0
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
@@ -24,7 +24,7 @@ jobs:
run: |
mkdir -p $RUNNER_TEMP/.ccache
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/.ccache
key: osx-${{ runner.os }}-sdk-${{ steps.get-date.outputs.date }}
@@ -33,6 +33,7 @@ jobs:
- name: Build SDK
shell: bash
env:
CLICOLOR_FORCE: "1"
MACOSX_DEPLOYMENT_TARGET: "11.0"
CCACHE_DIR: ${{ runner.temp }}/.ccache
CCACHE_MAXSIZE: 10.0G
@@ -41,19 +42,19 @@ jobs:
run: |
bash scripts/osx/package_sdk.sh
- name: 'Upload SDK Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-sdk
path: build/*.tar.gz
retention-days: 3
- name: 'Upload install artifact [arm64]'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-arm64-install
path: install/arm64
retention-days: 1
- name: 'Upload install artifact [x64]'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-x64-install
path: install/x64
@@ -62,17 +63,16 @@ jobs:
runs-on: macos-11.0
if: "!contains(github.event.commits[0].message, '[skip-test]')"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-test-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-test-version }}
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
- name: Get Date
id: get-date
run: |
@@ -83,7 +83,7 @@ jobs:
run: |
mkdir -p $RUNNER_TEMP/.ccache
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/.ccache
key: osx-${{ runner.os }}-test-${{ steps.get-date.outputs.date }}
@@ -92,12 +92,16 @@ jobs:
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip
- name: Build Python 3.10 with tests
shell: bash
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
BUILD_DIR: "/tmp/lief-build"
LIEF_BUILD_DIR: "/tmp/lief-build"
PYLIEF_CONF: "${{ github.workspace }}/scripts/osx/osx-testing-x64.toml"
CLICOLOR_FORCE: "1"
PYTEST_ADDOPTS: "--color=yes"
FORCE_COLOR: "1"
MACOSX_TARGET: "11.7"
MACOSX_DEPLOYMENT_TARGET: "11.0"
CCACHE_DIR: ${{ runner.temp }}/.ccache
@@ -106,37 +110,39 @@ jobs:
CCACHE_COMPRESS: 1
run: |
python -m pip install -r tests/requirements.txt
python -m pip -vvv install api/python
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
cd api/python
PYLIEF_CONF=${GITHUB_WORKSPACE}/scripts/osx/osx-testing-x64.toml \
python ./setup.py build \
--build-base=${BUILD_DIR}/base \
--build-temp=${BUILD_DIR}/temp \
install --user
cd ${GITHUB_WORKSPACE}
- name: Run tests
shell: bash
timeout-minutes: 20
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
LIEF_BUILD_DIR: "/tmp/lief-build"
PYTEST_ADDOPTS: "--color=yes"
run: |
python tests/run_pytest.py
python tests/run_tools_check.py ${BUILD_DIR}/temp
ctest --output-on-failure --test-dir ${BUILD_DIR}/temp
python tests/run_tools_check.py ${LIEF_BUILD_DIR}/
ctest --output-on-failure --test-dir ${LIEF_BUILD_DIR}/
wheels:
runs-on: macos-11.0
needs: osx-sdk
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
arch: ['x64', 'arm64']
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip
- name: Get Date
id: get-date
run: |
@@ -147,18 +153,14 @@ jobs:
run: |
mkdir -p $RUNNER_TEMP/.ccache
- name: ccache cache files
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/.ccache
key: osx-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.date }}
restore-keys: |
osx-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.python-version }}
- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip setuptools
- name: Download LIEF install dir
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: osx-${{ matrix.arch }}-install
path: ~/lief-${{ matrix.arch }}-install
@@ -166,6 +168,8 @@ jobs:
shell: bash
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
FORCE_COLOR: "1"
CLICOLOR_FORCE: "1"
CCACHE_DIR: ${{ runner.temp }}/.ccache
CCACHE_MAXSIZE: 10.0G
CCACHE_CPP2: 1
@@ -174,7 +178,7 @@ jobs:
run: |
python -m pip -vv wheel --wheel-dir=dist/ api/python
- name: 'Upload Python wheel artifact - ${{ matrix.python-version }}'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: osx-wheel-${{ matrix.arch }}-${{ matrix.python-version }}
path: dist/*.whl
@@ -184,12 +188,14 @@ jobs:
if: ${{ always() }}
needs: [osx-sdk, wheels]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
pattern: osx-*
merge-multiple: true
path: ${{ runner.temp }}/artifacts
- name: Display artifacts
run: ls -R
@@ -209,6 +215,7 @@ jobs:
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e LIEF_S3_KEY=$LIEF_S3_KEY \
-e LIEF_S3_SECRET=$LIEF_S3_SECRET \
liefproject/deploy python3 /src/.github/deploy.py /runner_tmp/artifacts
liefproject/deploy \
python3 /src/.github/deploy.py /runner_tmp/artifacts
+24 -31
View File
@@ -9,39 +9,34 @@ jobs:
osx:
runs-on: macos-11.0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-osx-version }}
- name: Install system dependencies
run: |
brew install cmake ninja ccache
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip
- name: Build with Python ${{ env.python-osx-version }} & Test
shell: bash
env:
LIEF_SAMPLES_DIR: "/tmp/samples"
BUILD_DIR: "/tmp/lief-build"
LIEF_BUILD_DIR: "/tmp/lief-build"
PYLIEF_CONF: "${{ github.workspace }}/scripts/osx/osx-testing-x64.toml"
run: |
python -m pip install -r tests/requirements.txt
python -m pip install -e api/python
python tests/dl_samples.py ${LIEF_SAMPLES_DIR}
cd api/python
PYLIEF_CONF=${GITHUB_WORKSPACE}/scripts/osx/osx-testing-x64.toml \
python ./setup.py build \
--build-base=${BUILD_DIR}/base \
--build-temp=${BUILD_DIR}/temp \
install --user
cd ${GITHUB_WORKSPACE}
python tests/run_pytest.py
python tests/run_tools_check.py ${BUILD_DIR}/temp
ctest --output-on-failure --test-dir ${BUILD_DIR}/temp
python tests/run_tools_check.py ${BUILD_DIR}
ctest --output-on-failure --test-dir ${BUILD_DIR}
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build & Test
@@ -49,48 +44,46 @@ jobs:
env:
PYTHON_VERSION: 39
run: |
docker run --rm \
-e PYTHON_VERSION=$PYTHON_VERSION \
docker run --rm \
-e PYTHON_VERSION=$PYTHON_VERSION \
-e PYTHON_BINARY=/opt/python/cp39-cp39/bin/python3.9 \
-v $GITHUB_WORKSPACE:/src \
liefproject/manylinux_2_28_x86_64 bash /src/scripts/docker/run_linux_test.sh
-v $GITHUB_WORKSPACE:/src \
liefproject/manylinux_2_28_x86_64 \
bash /src/scripts/docker/test-linux-x64
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ env.python-win-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-win-version }}
architecture: x64
- name: Install system dependencies
run: |
choco install ninja
python -m pip install --upgrade pip setuptools
python -m pip install --upgrade pip
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
vsversion: "2022"
- name: Set env variables
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
echo ("BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
echo ("LIEF_BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
echo ("PYLIEF_CONF=" + $env:GITHUB_WORKSPACE + "/scripts/windows/py-x64-test.toml") >> $env:GITHUB_ENV
- name: Build Python ${{ env.python-win-version }}
shell: cmd
run: |
python -m pip install -r tests/requirements.txt
python -m pip install api/python
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
cd api/python
python ./setup.py build ^
--build-base=%BUILD_DIR%/base ^
--build-temp=%BUILD_DIR%/temp ^
install --user
shell: cmd
- name: Run tests
timeout-minutes: 20
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
python tests/run_pytest.py
ctest --output-on-failure --test-dir %BUILD_DIR%/temp/Release
shell: cmd
ctest --output-on-failure --test-dir %BUILD_DIR%
+6 -6
View File
@@ -5,7 +5,7 @@ jobs:
gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: compile
@@ -15,11 +15,11 @@ jobs:
-e BUILD_DIR=/tmp/build_gcc \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/gcc.sh
liefproject/sanity:latest bash /src/scripts/docker/test-gcc
clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: compile
@@ -29,11 +29,11 @@ jobs:
-e BUILD_DIR=/tmp/build_clang \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/clang.sh
liefproject/sanity:latest bash /src/scripts/docker/test-clang
asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: compile
@@ -41,4 +41,4 @@ jobs:
run: |
docker run --rm \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/asan_check.sh
liefproject/sanity:latest bash /src/scripts/docker/test-asan
+45 -37
View File
@@ -1,5 +1,13 @@
name: LIEF Windows
on: workflow_dispatch
on:
push:
branches:
- 'main'
- 'master'
- 'release-**'
- 'release/**'
tags:
- '**'
env:
python-test-version: '3.10'
@@ -7,7 +15,7 @@ env:
jobs:
build-sdk:
runs-on: windows-2019
runs-on: windows-2022
strategy:
matrix:
arch: ['x64', 'x86']
@@ -16,11 +24,11 @@ jobs:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
architecture: ${{ matrix.arch }}
@@ -30,14 +38,14 @@ jobs:
choco install sccache
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
vsversion: "2022"
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Setup sccache
uses: actions/cache@v3
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ vars.SCCACHE_DIR }}
@@ -50,13 +58,13 @@ jobs:
run: |
python ./scripts/windows/package_sdk.py
- name: 'Upload SDK artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.arch }}-sdk
path: build/*.zip
retention-days: 3
- name: 'Upload install artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.arch }}-install
path: ${{ runner.temp }}/lief-install
@@ -66,7 +74,7 @@ jobs:
- name: stop sccache server
run: sccache --stop-server || true
tests:
runs-on: windows-2019
runs-on: windows-2022
if: "!contains(github.event.commits[0].message, '[skip-test]')"
strategy:
matrix:
@@ -76,11 +84,11 @@ jobs:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-test-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-test-version }}
architecture: ${{ matrix.arch }}
@@ -90,14 +98,14 @@ jobs:
choco install sccache
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
vsversion: "2022"
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Setup sccache
uses: actions/cache@v3
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ vars.SCCACHE_DIR }}
@@ -121,44 +129,46 @@ jobs:
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
echo ("BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
echo ("LIEF_BUILD_DIR=" + $env:RUNNER_TEMP + "/lief-build") >> $env:GITHUB_ENV
- name: Build Python ${{ env.python-test-version }}
shell: cmd
run: |
python -m pip install -r tests/requirements.txt
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
cd api/python
python ./setup.py build ^
--build-base=%BUILD_DIR%/base ^
--build-temp=%BUILD_DIR%/temp ^
install --user
python -m pip -vvv install --user api/python
- name: Download samples
shell: cmd
run: |
python -m pip install -r tests/requirements.txt
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
- name: Run tests
timeout-minutes: 20
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
python tests/run_pytest.py
ctest --output-on-failure --test-dir %BUILD_DIR%/temp/Release
shell: cmd
ctest --output-on-failure --test-dir %LIEF_BUILD_DIR%/
- name: sccache stats
run: sccache --show-stats
- name: stop sccache server
run: sccache --stop-server || true
wheels:
runs-on: windows-2019
runs-on: windows-2022
needs: build-sdk
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12-dev']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13.0-beta.2']
arch: ['x86', 'x64']
fail-fast: false
env:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.arch }}
@@ -166,17 +176,17 @@ jobs:
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
vsversion: "2022"
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Save sccache
uses: actions/cache@v3
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ vars.SCCACHE_DIR }}
@@ -184,16 +194,12 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-sccache-${{ matrix.python-version }}
- name: Download LIEF install dir
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: windows-${{ matrix.arch }}-install
path: ~/lief-${{ matrix.arch }}-install
- name: Start sccache server
run: sccache --start-server
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: Set arch specific env
if: matrix.arch == 'x64'
run: |
@@ -210,10 +216,10 @@ jobs:
chcp 65001 #set code page to utf-8
- name: Build Python ${{ matrix.python-version }}
run: |
python -m pip -vv wheel --wheel-dir=dist/ api/python
python -m pip -vvv wheel --wheel-dir=dist/ ./api/python
shell: cmd
- name: 'Upload Python artifacts [${{ matrix.python-version }}]'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.arch }}-wheel-${{ matrix.python-version }}
path: dist/*.whl
@@ -223,12 +229,14 @@ jobs:
runs-on: ubuntu-latest
needs: [build-sdk, wheels]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
pattern: windows-*
merge-multiple: true
path: ${{ runner.temp }}/artifacts
- name: Deploy
env:
+24 -15
View File
@@ -1,12 +1,21 @@
name: LIEF Windows Quick
on: workflow_dispatch
on:
push:
branches:
- '**'
- '!master'
- '!main'
- '!release-**'
- '!release/**'
tags-ignore:
- "**"
env:
python-version: '3.9'
python-version: '3.12'
jobs:
quick-test:
runs-on: windows-2019
runs-on: windows-2022
strategy:
matrix:
arch: [x64, x86]
@@ -15,11 +24,11 @@ jobs:
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ${{ vars.SCCACHE_DIR }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
architecture: ${{ matrix.python-version }}
@@ -27,17 +36,17 @@ jobs:
run: |
choco install ninja
choco install sccache
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip
- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: "14.16"
vsversion: "2022"
- name: Get Date
id: get-date
run: |
echo "date=$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
shell: bash
- name: Save sccache
uses: actions/cache@v3
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ vars.SCCACHE_DIR }}
@@ -50,20 +59,20 @@ jobs:
run: |
chcp 65001 #set code page to utf-8
echo ("LIEF_SAMPLES_DIR=" + $env:RUNNER_TEMP + "/samples") >> $env:GITHUB_ENV
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
shell: cmd
- name: Build Python ${{ env.python-version }}
shell: cmd
run: |
python -m pip install -r tests/requirements.txt
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
python -m pip -vv install api/python
python -m pip -vvv install api/python
- name: Download samples
shell: cmd
run: |
python tests/dl_samples.py %LIEF_SAMPLES_DIR%
- name: Run tests
shell: cmd
timeout-minutes: 20
run: |
python ./tests/run_pytest.py
shell: cmd
- name: sccache stats
run: sccache --show-stats
- name: sccache server
+3
View File
@@ -3,3 +3,6 @@ build/
*.whl
lief.egg-info/
dist/
api/rust/cargo/target/*
api/rust/examples/target/*
Cargo.lock
+4
View File
@@ -0,0 +1,4 @@
include:
- project: 'LIEF/ci'
ref: main
file: 'main.yml'
+74 -273
View File
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.24)
enable_language(C)
enable_language(CXX)
# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
@@ -18,56 +20,30 @@ include(CheckCCompilerFlag)
include(ExternalProject)
include(CMakePackageConfigHelpers)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
find_package(Git REQUIRED)
# Information from git
# ====================
find_package(Git)
if (DEFINED ENV{LIEF_VERSION_ENV})
string(REGEX MATCHALL "([0-9]+)" VERSION_STRING "$ENV{LIEF_VERSION_ENV}")
if (NOT VERSION_STRING)
message(FATAL_ERROR "Invalid version")
endif()
list(GET VERSION_STRING 0 LIEF_VERSION_MAJOR)
list(GET VERSION_STRING 1 LIEF_VERSION_MINOR)
list(GET VERSION_STRING 2 LIEF_VERSION_PATCH)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git" AND Git_FOUND)
include(LIEFGit)
else()
set(LIEF_VERSION_MAJOR "0")
set(LIEF_VERSION_MINOR "14")
set(LIEF_VERSION_MINOR "15")
set(LIEF_VERSION_PATCH "0")
endif()
# LIEF Project
# ============
project(
LIEF
VERSION ${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
project(LIEF VERSION
${LIEF_VERSION_MAJOR}.${LIEF_VERSION_MINOR}.${LIEF_VERSION_PATCH})
message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION}")
# Select the MSVC runtime based on the LIEF_USE_CRT_XXX variable
if(MSVC)
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${build_type}" build)
if(DEFINED "LIEF_USE_CRT_${build}")
set(runtime "${LIEF_USE_CRT_${build}}")
if(build_type STREQUAL Debug)
set(default_runtime MDd)
else()
set(default_runtime MD)
endif()
if(runtime AND NOT "${runtime}" STREQUAL "${default_runtime}")
if(runtime STREQUAL "MT")
set(runtime_library "MultiThreaded")
elseif(runtime STREQUAL "MD")
set(runtime_library "MultiThreadedDLL")
elseif(runtime STREQUAL "MTd")
set(runtime_library "MultiThreadedDebug")
elseif(runtime STREQUAL "MDd")
set(runtime_library "MultiThreadedDebugDLL")
else()
message(FATAL_ERROR "Unsupported value LIEF_USE_CRT_${build}=${runtime}")
endif()
message(STATUS "LIEF_CRT_${build}: ${runtime}")
set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}$<$<CONFIG:${build_type}>:${runtime_library}>")
endif()
endif()
endforeach()
endif()
# LIEF options
# =============
include(LIEFOptions)
@@ -111,6 +87,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
endif()
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_LINK_EXECUTABLE: ${CMAKE_CXX_LINK_EXECUTABLE}")
message(STATUS "CMAKE_CXX_LINK_FLAGS: ${CMAKE_CXX_LINK_FLAGS}")
@@ -123,86 +101,26 @@ message(STATUS "CMAKE_LINK_LIBRARY_FILE_FLAG: ${CMAKE_LINK_LIBRARY_FILE_FLA
message(STATUS "CMAKE_LINK_INTERFACE_LIBRARIES: ${CMAKE_LINK_INTERFACE_LIBRARIES}")
message(STATUS "CMAKE_CXX_IMPLICIT_LINK_LIBRARIES: ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY: ${CMAKE_MSVC_RUNTIME_LIBRARY}")
if(LIEF_INSTALL)
if(UNIX)
include(GNUInstallDirs)
set(CMAKE_INSTALL_LIBDIR "lib")
else()
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_DATADIR "share")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_DATAROOTDIR "share")
message(STATUS "Setting installation destination to: ${CMAKE_INSTALL_PREFIX}")
endif()
endif()
# LIEF Source definition
# ======================
set(LIEF_PRIVATE_INCLUDE_DIR)
set(LIEF_PUBLIC_INCLUDE_DIR)
set(LIEF_PUBLIC_INCLUDE_FILES)
set(LIEF_PRIVATE_INCLUDE_FILES)
set(LIBLIEF_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/errors.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/iostream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_utils.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Object.tcc"
"${CMAKE_CURRENT_SOURCE_DIR}/src/Visitor.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/BinaryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/VectorStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/FileStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/MemoryStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/SpanStream.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/BinaryStream/Convert.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/hash.cpp")
# Grouping basic headers together
# ===============================
set(LIEF_INC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/errors.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/span.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/ELF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Abstract.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iostream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/iterators.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/LIEF.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/logging.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/MachO.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/PE.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/types.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visibility.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Object.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/Visitor.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/visitor_macros.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/BinaryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/VectorStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/FileStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/MemoryStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/SpanStream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/BinaryStream/Convert.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_utils.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/hash_stream.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/frozen.hpp"
)
set(LIEF_VISITOR_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/hash.hpp")
set(LIEF_INCLUDE_FILES ${LIEF_INC_FILES} ${LIEF_VISITOR_INCLUDE_FILES})
set(LIEF_JSON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/json.cpp")
set(LIEF_JSON_HDR "${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/json.hpp")
list(APPEND LIEF_INC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp")
list(APPEND LIBLIEF_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/json_api.cpp")
if(LIEF_ENABLE_JSON)
list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}")
list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}")
endif()
source_group("Header Files" FILES ${LIEF_INC_FILES})
source_group("Source Files" FILES ${LIBLIEF_SOURCE_FILES})
source_group("Header Files\\visitors" FILES ${LIEF_VISITOR_INCLUDE_FILES})
add_library(LIB_LIEF ${LIBLIEF_SOURCE_FILES} ${LIEF_INCLUDE_FILES})
add_library(LIB_LIEF src/Object.cpp)
add_subdirectory(src)
if(NOT LIEF_PY_LIEF_EXT)
add_library(LIEF::LIEF ALIAS LIB_LIEF)
@@ -212,42 +130,30 @@ if(NOT LIEF_OPT_MBEDTLS_EXTERNAL)
set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE)
set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE)
target_sources(LIB_LIEF PRIVATE
"${mbedtls_src_crypto}"
"${mbedtls_src_x509}"
"${mbedtls_src_tls}")
target_sources(LIB_LIEF PRIVATE ${mbedtls_src_crypto}
${mbedtls_src_x509}
${mbedtls_src_tls})
source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto})
source_group("mbedtls\\x509" FILES ${mbedtls_src_x509})
source_group("mbedtls\\tls" FILES ${mbedtls_src_tls})
target_include_directories(
LIB_LIEF SYSTEM PRIVATE
"${MBEDTLS_INCLUDE_DIRS}"
"${MBEDTLS_SOURCE_DIR}/library"
target_include_directories(LIB_LIEF SYSTEM PRIVATE
${MBEDTLS_INCLUDE_DIRS}
"${MBEDTLS_SOURCE_DIR}/library"
)
add_dependencies(LIB_LIEF lief_mbed_tls)
else()
find_package(MbedTLS REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE
MbedTLS::mbedcrypto
MbedTLS::mbedx509)
MbedTLS::mbedcrypto MbedTLS::mbedx509)
endif()
if(WINDOWS AND BUILD_SHARED_LIBS)
target_link_libraries(LIB_LIEF ws2_32)
if(WIN32 AND BUILD_SHARED_LIBS)
target_link_libraries(LIB_LIEF PRIVATE ws2_32)
endif()
if(MSVC)
add_compile_options(/bigobj)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug AND WINDOWS)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_SECURE_SCL=0
-D_HAS_ITERATOR_DEBUGGING=0)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug AND UNIX)
target_compile_options(LIB_LIEF PRIVATE -g -O0)
endif()
@@ -258,39 +164,8 @@ else()
target_compile_definitions(LIB_LIEF PRIVATE -DLIEF_STATIC)
endif()
# Abstract part
include("${CMAKE_CURRENT_SOURCE_DIR}/src/Abstract/CMakeLists.txt")
# ELF Part
# ========
include("${CMAKE_CURRENT_SOURCE_DIR}/src/ELF/CMakeLists.txt")
if(LIEF_ELF)
set(ENABLE_ELF_SUPPORT 1)
else()
set(ENABLE_ELF_SUPPORT 0)
endif()
# PE Part
# =======
include("${CMAKE_CURRENT_SOURCE_DIR}/src/PE/CMakeLists.txt")
if(LIEF_PE)
set(ENABLE_PE_SUPPORT 1)
else()
set(ENABLE_PE_SUPPORT 0)
endif()
# MachO part
# ==========
include("${CMAKE_CURRENT_SOURCE_DIR}/src/MachO/CMakeLists.txt")
if(LIEF_MACHO)
set(ENABLE_MACHO_SUPPORT 1)
else()
set(ENABLE_MACHO_SUPPORT 0)
endif()
# Logging Configuration
# =====================
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_DISABLE_DEFAULT_LOGGER
SPDLOG_NO_EXCEPTIONS
SPDLOG_FUNCTION=)
@@ -299,47 +174,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_NO_THREAD_ID)
endif()
# OAT part
# ========
if(LIEF_OAT)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/OAT/CMakeLists.txt)
set(ENABLE_OAT_SUPPORT 1)
else()
set(ENABLE_OAT_SUPPORT 0)
endif()
# DEX part
# ========
if(LIEF_DEX)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/DEX/CMakeLists.txt)
set(ENABLE_DEX_SUPPORT 1)
else()
set(ENABLE_DEX_SUPPORT 0)
endif()
# VDEX part
# =========
if(LIEF_VDEX)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/VDEX/CMakeLists.txt)
set(ENABLE_VDEX_SUPPORT 1)
else()
set(ENABLE_VDEX_SUPPORT 0)
endif()
# ART part
# ========
if(LIEF_ART)
include(${CMAKE_CURRENT_SOURCE_DIR}/src/ART/CMakeLists.txt)
set(ENABLE_ART_SUPPORT 1)
else()
set(ENABLE_ART_SUPPORT 0)
endif()
# Platforms
# =========
include(${CMAKE_CURRENT_SOURCE_DIR}/src/platforms/CMakeLists.txt)
# LIEF includes
# =============
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/version.h.in"
@@ -348,16 +182,18 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/version.h.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/config.h" @ONLY)
list(APPEND LIEF_PUBLIC_INCLUDE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/"
"${CMAKE_CURRENT_BINARY_DIR}/include/")
set(LIEF_PUBLIC_INCLUDE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/include/
${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/
${CMAKE_CURRENT_BINARY_DIR}/include/)
list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}")
set(LIEF_PRIVATE_INCLUDE_DIR
${LIEF_PUBLIC_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEF.pc.in ${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEF.pc.in
${CMAKE_CURRENT_BINARY_DIR}/LIEF.pc @ONLY)
target_include_directories(LIB_LIEF
PUBLIC "$<BUILD_INTERFACE:${LIEF_PUBLIC_INCLUDE_DIR}>"
@@ -382,6 +218,7 @@ if(LIEF_ENABLE_JSON)
target_include_directories(LIB_LIEF PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/)
endif()
target_compile_definitions(LIB_LIEF PRIVATE JSON_NOEXCEPTION)
endif()
if(LIEF_FROZEN_ENABLED)
@@ -462,28 +299,23 @@ endif()
target_link_libraries(LIB_LIEF PRIVATE lief_spdlog)
if(ANDROID AND BUILD_SHARED_LIBS AND LIEF_LOGGING)
if(ANDROID AND LIEF_LOGGING)
target_link_libraries(LIB_LIEF PUBLIC log)
endif()
# Flags definition
# ----------------
# cmake-format: off
set_target_properties(
LIB_LIEF
set_target_properties(LIB_LIEF
PROPERTIES POSITION_INDEPENDENT_CODE ON
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
VISIBILITY_INLINES_HIDDEN ON
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden)
# cmake-format: on
if(UNIX AND NOT APPLE)
set_property(
TARGET LIB_LIEF
APPEND
PROPERTY LINK_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")
set_property(TARGET LIB_LIEF APPEND
PROPERTY LINK_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")
endif()
target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1)
@@ -539,7 +371,7 @@ endif()
if(LIEF_SANITIZER)
message("LIEF Sanitizer enabled: ${SANITIZER_FLAGS}")
target_compile_options(LIB_LIEF PUBLIC ${SANITIZER_FLAGS})
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/tests/sanitizer")
add_subdirectory(tests/sanitizer)
endif()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -553,13 +385,13 @@ if(LIEF_FUZZING)
target_compile_options(LIB_LIEF PRIVATE ${FUZZING_FLAGS})
target_link_libraries(LIB_LIEF PUBLIC asan pthread)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/fuzzing")
add_subdirectory(fuzzing)
endif()
include(LIEFCompilerFlags)
if(LIEF_PROFILING)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/profiling")
add_subdirectory(profiling)
endif()
set_target_properties(LIB_LIEF PROPERTIES
@@ -586,30 +418,22 @@ if(APPLE)
set_target_properties(LIB_LIEF PROPERTIES MACOSX_RPATH ON)
endif()
# API
# ======================
include(LIEFApi)
add_subdirectory(api)
# Examples
# ======================
if(LIEF_EXAMPLES)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/examples")
add_subdirectory(examples)
endif()
# Tests
# ======================
if(LIEF_TESTS)
enable_testing()
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/tests")
add_subdirectory(tests)
endif()
# Documentation
# ======================
if(LIEF_DOC)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/doc)
add_subdirectory(doc)
endif()
# Post-build operations
# ======================
if(BUILD_SHARED_LIBS AND CMAKE_BUILD_TYPE MATCHES "Release")
@@ -638,10 +462,8 @@ if(LIEF_INSTALL)
# Find Package Config
# ======================
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEFConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LIEFConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake @ONLY)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
@@ -663,25 +485,6 @@ if(LIEF_INSTALL)
endif()
endif()
# Installation
# ======================
if(UNIX)
include(GNUInstallDirs)
set(CMAKE_INSTALL_LIBDIR "lib")
else()
if(WIN32)
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_DATADIR "share")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_DATAROOTDIR "share")
message(STATUS "Setting installation destination on Windows to: ${CMAKE_INSTALL_PREFIX}")
else()
message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet")
endif()
endif()
install(
TARGETS LIB_LIEF lief_spdlog
EXPORT LIEFExport
@@ -700,7 +503,7 @@ if(LIEF_INSTALL)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/LIEFConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LIEFConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LIEF
COMPONENT config)
install(
@@ -717,7 +520,7 @@ if(LIEF_INSTALL)
install(
EXPORT LIEFExport
NAMESPACE LIEF::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/LIEF/cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LIEF
FILE LIEFExport-${lib_type}.cmake
COMPONENT config)
@@ -726,7 +529,5 @@ if(LIEF_INSTALL)
NAMESPACE LIEF::
FILE LIEFExport-${lib_type}.cmake)
# Package
# ======================
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package")
add_subdirectory(package)
endif()
+2 -2
View File
@@ -186,8 +186,8 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2017 - 2023 R. Thomas
Copyright 2017 - 2023 Quarkslab
Copyright 2017 - 2024 R. Thomas
Copyright 2017 - 2024 Quarkslab
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+44 -17
View File
@@ -1,5 +1,5 @@
<p align="center" >
<img width="90%" src="https://github.com/lief-project/LIEF/blob/master/.github/images/architecture.png"/><br />
<img width="90%" src="https://github.com/lief-project/LIEF/blob/main/.github/images/architecture.png"/><br />
</p>
<p align="center">
@@ -8,27 +8,27 @@
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/linux-x86-64.yml">
<img alt="Linux x86-64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-x86-64.yml?branch=master&label=Linux%20x86-64&logo=github">
<img alt="Linux x86-64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-x86-64.yml?branch=main&label=Linux%20x86-64&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/linux-aarch64.yml">
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-aarch64.yml?branch=master&label=Linux%20AArch64&logo=github">
<img alt="Linux AArch64 CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/linux-aarch64.yml?branch=main&label=Linux%20AArch64&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/android.yml">
<img alt="Android CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/android.yml?branch=master&label=Android&logo=github">
<img alt="Android CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/android.yml?branch=main&label=Android&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/osx.yml">
<img alt="macOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/osx.yml?branch=master&label=macOS&logo=github">
<img alt="macOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/osx.yml?branch=main&label=macOS&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/ios.yml">
<img alt="iOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/ios.yml?branch=master&label=iOS&logo=github">
<img alt="iOS CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/ios.yml?branch=main&label=iOS&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/actions/workflows/windows-all.yml">
<img alt="Windows CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/windows-all.yml?branch=master&label=Windows&logo=github">
<img alt="Windows CI status" src="https://img.shields.io/github/actions/workflow/status/lief-project/LIEF/windows-all.yml?branch=main&label=Windows&logo=github">
</a>
&nbsp;
<a href="https://github.com/lief-project/LIEF/releases">
@@ -58,7 +58,7 @@ Main features:
* **Parsing**: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to format internals.
* **Modify**: LIEF enables to modify some parts of these formats
* **Abstract**: Three formats have common features like sections, symbols, entry point... LIEF factors them.
* **API**: LIEF can be used in C, C++ and Python
* **API**: LIEF can be used in C++, Python, Rust and C
# Content
@@ -105,7 +105,7 @@ pip install lief
To install nightly build:
```console
pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.14.0.dev0
pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.15.0.dev0
```
### Packages
@@ -113,7 +113,7 @@ pip install [--user] --index-url https://lief.s3-website.fr-par.scw.cloud/latest
- **Nightly**:
* SDK: https://lief.s3-website.fr-par.scw.cloud/latest/sdk
* Python Wheels: https://lief.s3-website.fr-par.scw.cloud/latest/lief
- **v0.13.2**: https://github.com/lief-project/LIEF/releases/tag/0.13.2
- **v0.14.1**: https://github.com/lief-project/LIEF/releases/tag/0.14.1
Here are guides to install or integrate LIEF:
@@ -131,17 +131,38 @@ import lief
# ELF
binary = lief.parse("/usr/bin/ls")
print(binary)
for section in binary.sections:
print(section.name, section.virtual_address)
# PE
binary = lief.parse("C:\\Windows\\explorer.exe")
print(binary)
if rheader := pe.rich_header:
print(rheader.key)
# Mach-O
binary = lief.parse("/usr/bin/ls")
print(binary)
for fixup in binary.dyld_chained_fixups:
print(fixup)
```
### Rust
```rust
use lief::Binary;
use lief::pe::debug::Entries::CodeViewPDB;
if let Some(Binary::PE(pe)) = Binary::parse(path.as_str()) {
for entry in pe.debug() {
if let CodeViewPDB(pdb_view) = entry {
println!("{}", pdb_view.filename());
}
}
}
```
### C++
```cpp
@@ -150,17 +171,23 @@ print(binary)
int main(int argc, char** argv) {
// ELF
if (std::unique_ptr<const LIEF::ELF::Binary> elf = LIEF::ELF::Parser::parse("/bin/ls")) {
std::cout << *elf << '\n';
for (const LIEF::ELF::Section& section : elf->sections()) {
std::cout << section->name() << ' ' << section->virtual_address() << '\n';
}
}
// PE
if (std::unique_ptr<const LIEF::PE::Binary> pe = LIEF::PE::Parser::parse("C:\\Windows\\explorer.exe")) {
std::cout << *pe << '\n';
if (const LIEF::PE::RichHeader* rheader : pe->rich_header()) {
std::cout << rheader->key() << '\n';
}
}
// Mach-O
if (std::unique_ptr<LIEF::MachO::FatBinary> macho = LIEF::MachO::Parser::parse("/bin/ls")) {
std::cout << *macho << '\n';
for (const LIEF::MachO::DyldChainedFixups& fixup : macho->dyld_chained_fixups()) {
std::cout << fixup << '\n';
}
}
return 0;
@@ -207,7 +234,7 @@ Romain Thomas ([@rh0main](https://twitter.com/rh0main)) - [Quarkslab](https://ww
### License
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.13.0/LICENSE).
LIEF is provided under the [Apache 2.0 license](https://github.com/lief-project/LIEF/blob/0.14.1/LICENSE).
### Bibtex
+12
View File
@@ -0,0 +1,12 @@
if (LIEF_PYTHON_API)
add_subdirectory(python)
endif()
if(LIEF_C_API)
add_subdirectory(c)
endif()
if(LIEF_RUST_API)
add_subdirectory(rust)
endif()
+9 -26
View File
@@ -1,32 +1,15 @@
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
)
set(LIEF_C_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/LIEF.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/logging.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/types.h"
)
set(LIEF_C_SRC "${CMAKE_CURRENT_LIST_DIR}/logging.cpp")
if (LIEF_ELF)
include("${CMAKE_CURRENT_LIST_DIR}/ELF/CMakeLists.txt")
if(LIEF_ELF)
add_subdirectory(ELF)
endif()
if (LIEF_PE)
include("${CMAKE_CURRENT_LIST_DIR}/PE/CMakeLists.txt")
if(LIEF_PE)
add_subdirectory(PE)
endif()
if (LIEF_MACHO)
include("${CMAKE_CURRENT_LIST_DIR}/MachO/CMakeLists.txt")
if(LIEF_MACHO)
add_subdirectory(MachO)
endif()
source_group("Header Files\\C API" FILES ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF PRIVATE "${LIEF_C_SRC}" ${LIEF_C_INCLUDE_FILES})
target_sources(LIB_LIEF PRIVATE logging.cpp)
target_include_directories(LIB_LIEF PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>")
+8 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ namespace LIEF {
namespace ELF {
void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->handler = reinterpret_cast<void*>(binary);
c_binary->type = static_cast<enum LIEF_ELF_ELF_CLASS>(binary->type());
c_binary->type = static_cast<uint32_t>(binary->type());
c_binary->interpreter = nullptr;
if (binary->has_interpreter()) {
const std::string& interp = binary->interpreter();
@@ -48,15 +48,12 @@ void init_c_binary(Elf_Binary_t* c_binary, Binary* binary) {
reinterpret_cast<char*>(const_cast<char*>(c_binary->interpreter))[interp.size()] = '\0';
}
init_c_header(c_binary, binary);
init_c_sections(c_binary, binary);
init_c_segments(c_binary, binary);
init_c_dynamic_symbols(c_binary, binary);
init_c_static_symbols(c_binary, binary);
init_c_symtab_symbols(c_binary, binary);
init_c_dynamic_entries(c_binary, binary);
}
}
@@ -81,9 +78,9 @@ Elf_Binary_t* elf_parse(const char *file) {
int elf_binary_save_header(Elf_Binary_t* binary) {
Header& hdr = reinterpret_cast<Binary*>(binary->handler)->header();
hdr.file_type(static_cast<LIEF::ELF::E_TYPE>(binary->header.file_type));
hdr.machine_type(static_cast<LIEF::ELF::ARCH>(binary->header.machine_type));
hdr.object_file_version(static_cast<LIEF::ELF::VERSION>(binary->header.object_file_version));
hdr.file_type(LIEF::ELF::Header::FILE_TYPE(binary->header.file_type));
hdr.machine_type(LIEF::ELF::ARCH(binary->header.machine_type));
hdr.object_file_version(LIEF::ELF::Header::VERSION(binary->header.object_file_version));
hdr.program_headers_offset(binary->header.program_headers_offset);
hdr.section_headers_offset(binary->header.section_headers_offset);
hdr.processor_flag(binary->header.processor_flags);
@@ -104,7 +101,7 @@ void elf_binary_destroy(Elf_Binary_t* binary) {
destroy_sections(binary);
destroy_segments(binary);
destroy_dynamic_symbols(binary);
destroy_static_symbols(binary);
destroy_symtab_symbols(binary);
destroy_dynamic_entries(binary);
if (binary->interpreter != nullptr) {
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+8 -43
View File
@@ -1,44 +1,9 @@
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
target_sources(LIB_LIEF PRIVATE
Symbol.cpp
Section.cpp
Segment.cpp
DynamicEntry.cpp
Header.cpp
Binary.cpp
utils.cpp
)
set(LIEF_C_ELF_SRC
"${CMAKE_CURRENT_LIST_DIR}/Symbol.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Segment.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DynamicEntry.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Header.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Binary.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EnumToString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/utils.cpp"
)
set(LIEF_API_C_ELF_INCLUDE_FILES_CPP
"${CMAKE_CURRENT_LIST_DIR}/Binary.hpp"
"${CMAKE_CURRENT_LIST_DIR}/DynamicEntry.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Header.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Segment.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Symbol.hpp"
)
set(LIEF_API_C_ELF_INCLUDE_FILES_C
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Binary.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/DynamicEntry.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/EnumToString.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Header.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Section.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Segment.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/Symbol.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/ELF/utils.h"
)
set(LIEF_C_ELF_INC "${LIEF_API_C_ELF_INCLUDE_FILES_C}" "${LIEF_API_C_ELF_INCLUDE_FILES_CPP}")
source_group("Source Files\\C API\\ELF" FILES ${LIEF_API_C_ELF_SRC})
source_group("Header Files\\C API\\ELF" FILES ${LIEF_C_ELF_INC})
target_sources(LIB_LIEF PRIVATE "${LIEF_C_ELF_SRC}" "${LIEF_C_ELF_INC}")
+30 -59
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,13 +34,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
for (size_t i = 0; i < dyn_entries.size(); ++i) {
DynamicEntry& entry = dyn_entries[i];
switch(entry.tag()) {
case DYNAMIC_TAGS::DT_NEEDED:
case DynamicEntry::TAG::NEEDED:
{
auto* e = static_cast<Elf_DynamicEntry_Library_t*>(
malloc(sizeof(Elf_DynamicEntry_Library_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
e->name = reinterpret_cast<DynamicEntryLibrary*>(&entry)->name().c_str();
@@ -48,12 +47,12 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
break;
}
case DYNAMIC_TAGS::DT_SONAME:
case DynamicEntry::TAG::SONAME:
{
auto* e = static_cast<Elf_DynamicEntry_SharedObject_t*>(
malloc(sizeof(Elf_DynamicEntry_SharedObject_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
e->name = reinterpret_cast<DynamicSharedObject*>(&entry)->name().c_str();
@@ -61,42 +60,42 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
break;
}
case DYNAMIC_TAGS::DT_RPATH:
case DynamicEntry::TAG::RPATH:
{
auto* e = static_cast<Elf_DynamicEntry_Rpath_t*>(
malloc(sizeof(Elf_DynamicEntry_Rpath_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
e->rpath = reinterpret_cast<DynamicEntryRpath*>(&entry)->name().c_str();
e->rpath = reinterpret_cast<DynamicEntryRpath*>(&entry)->rpath().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
}
case DYNAMIC_TAGS::DT_RUNPATH:
case DynamicEntry::TAG::RUNPATH:
{
auto* e = static_cast<Elf_DynamicEntry_RunPath_t*>(
malloc(sizeof(Elf_DynamicEntry_RunPath_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
e->runpath = reinterpret_cast<DynamicEntryRunPath*>(&entry)->name().c_str();
e->runpath = reinterpret_cast<DynamicEntryRunPath*>(&entry)->runpath().c_str();
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
}
case DYNAMIC_TAGS::DT_INIT_ARRAY:
case DYNAMIC_TAGS::DT_FINI_ARRAY:
case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
case DynamicEntry::TAG::INIT_ARRAY:
case DynamicEntry::TAG::FINI_ARRAY:
case DynamicEntry::TAG::PREINIT_ARRAY:
{
auto* e = static_cast<Elf_DynamicEntry_Array_t*>(
malloc(sizeof(Elf_DynamicEntry_Array_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
const std::vector<uint64_t>& array = reinterpret_cast<DynamicEntryArray*>(&entry)->array();
e->array = static_cast<uint64_t*>(malloc((array.size() + 1) * sizeof(uint64_t)));
@@ -109,55 +108,33 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
break;
}
case DYNAMIC_TAGS::DT_FLAGS:
case DynamicEntry::TAG::FLAGS:
{
auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
const DynamicEntryFlags::flags_list_t& flags = reinterpret_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS)));
e->flags_1 = nullptr;
auto it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(*it);
}
e->flags[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS>(0);
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
}
case DYNAMIC_TAGS::DT_FLAGS_1:
case DynamicEntry::TAG::FLAGS_1:
{
auto* e = static_cast<Elf_DynamicEntry_Flags_t*>(
malloc(sizeof(Elf_DynamicEntry_Flags_t)));
e->tag = static_cast<enum LIEF_ELF_DYNAMIC_TAGS>(entry.tag());
e->tag = static_cast<uint64_t>(entry.tag());
e->value = entry.value();
const DynamicEntryFlags::flags_list_t& flags = reinterpret_cast<DynamicEntryFlags*>(&entry)->flags();
e->flags_1 = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1*>(malloc((flags.size() + 1) * sizeof(enum LIEF_ELF_DYNAMIC_FLAGS_1)));
e->flags = nullptr;
auto it = std::begin(flags);
for (size_t i = 0; it != std::end(flags); ++i, ++it) {
e->flags_1[i] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(*it);
}
e->flags_1[flags.size()] = static_cast<enum LIEF_ELF_DYNAMIC_FLAGS_1>(0);
c_binary->dynamic_entries[i] = reinterpret_cast<Elf_DynamicEntry_t*>(e);
break;
}
default:
{
c_binary->dynamic_entries[i] =
@@ -170,7 +147,6 @@ void init_c_dynamic_entries(Elf_Binary_t* c_binary, Binary* binary) {
}
c_binary->dynamic_entries[dyn_entries.size()] = nullptr;
}
@@ -179,34 +155,34 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
Elf_DynamicEntry_t **dynamic_entries = c_binary->dynamic_entries;
for (size_t idx = 0; dynamic_entries[idx] != nullptr; ++idx) {
switch(static_cast<DYNAMIC_TAGS>(dynamic_entries[idx]->tag)) {
case DYNAMIC_TAGS::DT_NEEDED:
switch(DynamicEntry::TAG(dynamic_entries[idx]->tag)) {
case DynamicEntry::TAG::NEEDED:
{
free(reinterpret_cast<Elf_DynamicEntry_Library_t*>(dynamic_entries[idx]));
break;
}
case DYNAMIC_TAGS::DT_SONAME:
case DynamicEntry::TAG::SONAME:
{
free(reinterpret_cast<Elf_DynamicEntry_SharedObject_t*>(dynamic_entries[idx]));
break;
}
case DYNAMIC_TAGS::DT_RPATH:
case DynamicEntry::TAG::RPATH:
{
free(reinterpret_cast<Elf_DynamicEntry_Rpath_t*>(dynamic_entries[idx]));
break;
}
case DYNAMIC_TAGS::DT_RUNPATH:
case DynamicEntry::TAG::RUNPATH:
{
free(reinterpret_cast<Elf_DynamicEntry_RunPath_t*>(dynamic_entries[idx]));
break;
}
case DYNAMIC_TAGS::DT_INIT_ARRAY:
case DYNAMIC_TAGS::DT_FINI_ARRAY:
case DYNAMIC_TAGS::DT_PREINIT_ARRAY:
case DynamicEntry::TAG::INIT_ARRAY:
case DynamicEntry::TAG::FINI_ARRAY:
case DynamicEntry::TAG::PREINIT_ARRAY:
{
Elf_DynamicEntry_Array_t* entry_array=reinterpret_cast<Elf_DynamicEntry_Array_t*>(dynamic_entries[idx]);
free(entry_array->array);
@@ -214,24 +190,21 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
break;
}
case DYNAMIC_TAGS::DT_FLAGS:
case DynamicEntry::TAG::FLAGS:
{
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
free(entry_flags->flags);
free(entry_flags);
break;
}
case DYNAMIC_TAGS::DT_FLAGS_1:
case DynamicEntry::TAG::FLAGS_1:
{
Elf_DynamicEntry_Flags_t* entry_flags=reinterpret_cast<Elf_DynamicEntry_Flags_t*>(dynamic_entries[idx]);
free(entry_flags->flags_1);
free(entry_flags);
break;
}
default:
{
free(dynamic_entries[idx]);
}
@@ -244,5 +217,3 @@ void destroy_dynamic_entries(Elf_Binary_t* c_binary) {
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
-80
View File
@@ -1,80 +0,0 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "LIEF/ELF/EnumToString.h"
#include "LIEF/ELF/EnumToString.hpp"
#include "LIEF/ELF/enums.h"
#include "LIEF/ELF/enums.hpp"
extern "C"
{
const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::E_TYPE>(e));
}
const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SYMBOL_BINDINGS>(e));
}
const char* VERSION_to_string(enum LIEF_ELF_VERSION e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::VERSION>(e));
}
const char* ARCH_to_string(enum LIEF_ELF_ARCH e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ARCH>(e));
}
const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::SEGMENT_TYPES>(e));
}
const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_TAGS>(e));
}
const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_TYPES>(e));
}
const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SECTION_FLAGS>(e));
}
const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_SYMBOL_TYPES>(e));
}
const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_CLASS>(e));
}
const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::ELF_DATA>(e));
}
const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::OS_ABI>(e));
}
const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS>(e));
}
const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e) {
return LIEF::ELF::to_string(static_cast<LIEF::ELF::DYNAMIC_FLAGS_1>(e));
}
}
+6 -9
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@ namespace ELF {
void init_c_header(Elf_Binary_t* c_binary, Binary* binary) {
const Header& hdr = binary->header();
c_binary->header.file_type = static_cast<enum LIEF_ELF_E_TYPE>(hdr.file_type());
c_binary->header.machine_type = static_cast<enum LIEF_ELF_ARCH>(hdr.machine_type());
c_binary->header.object_file_version = static_cast<enum LIEF_ELF_VERSION>(hdr.object_file_version());
c_binary->header.file_type = static_cast<uint32_t>(hdr.file_type());
c_binary->header.machine_type = static_cast<uint32_t>(hdr.machine_type());
c_binary->header.object_file_version = static_cast<uint32_t>(hdr.object_file_version());
c_binary->header.program_headers_offset = hdr.program_headers_offset();
c_binary->header.section_headers_offset = hdr.section_headers_offset();
c_binary->header.processor_flags = hdr.processor_flag();
@@ -35,10 +35,7 @@ void init_c_header(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->header.name_string_table_idx = hdr.section_name_table_idx();
c_binary->header.entrypoint = hdr.entrypoint();
const Header::identity_t& ident = hdr.identity();
std::copy(
std::begin(ident),
std::end(ident),
c_binary->header.identity);
std::copy(std::begin(ident), std::end(ident), c_binary->header.identity);
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ void init_c_sections(Elf_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->name = b_section.fullname().c_str();
c_binary->sections[i]->flags = b_section.flags();
c_binary->sections[i]->type = static_cast<enum LIEF_ELF_ELF_SECTION_TYPES>(b_section.type());
c_binary->sections[i]->type = static_cast<uint32_t>(b_section.type());
c_binary->sections[i]->virtual_address = b_section.virtual_address();
c_binary->sections[i]->offset = b_section.file_offset();
c_binary->sections[i]->original_size = b_section.original_size();
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -6
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
span<const uint8_t> segment_content = segment.content();
c_binary->segments[i] = static_cast<Elf_Segment_t*>(malloc(sizeof(Elf_Segment_t)));
c_binary->segments[i]->type = static_cast<enum LIEF_ELF_SEGMENT_TYPES>(segment.type());
c_binary->segments[i]->type = static_cast<uint32_t>(segment.type());
c_binary->segments[i]->flags = static_cast<uint32_t>(segment.flags());
c_binary->segments[i]->virtual_address = segment.virtual_address();
c_binary->segments[i]->virtual_size = segment.virtual_size();
@@ -44,10 +44,7 @@ void init_c_segments(Elf_Binary_t* c_binary, Binary* binary) {
}
void destroy_segments(Elf_Binary_t* c_binary) {
Elf_Segment_t **segments = c_binary->segments;
for (size_t idx = 0; segments[idx] != nullptr; ++idx) {
free(segments[idx]);
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+24 -26
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,8 +28,8 @@ void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
Symbol& b_sym = dyn_symb[i];
c_binary->dynamic_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
c_binary->dynamic_symbols[i]->name = b_sym.name().c_str();
c_binary->dynamic_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->dynamic_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
c_binary->dynamic_symbols[i]->type = static_cast<uint32_t>(b_sym.type());
c_binary->dynamic_symbols[i]->binding = static_cast<uint32_t>(b_sym.binding());
c_binary->dynamic_symbols[i]->other = b_sym.other();
c_binary->dynamic_symbols[i]->shndx = b_sym.shndx();
c_binary->dynamic_symbols[i]->value = b_sym.value();
@@ -40,32 +40,30 @@ void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary) {
}
c_binary->dynamic_symbols[dyn_symb.size()] = nullptr;
}
void init_c_static_symbols(Elf_Binary_t* c_binary, Binary* binary) {
Binary::it_static_symbols static_symb = binary->static_symbols();
void init_c_symtab_symbols(Elf_Binary_t* c_binary, Binary* binary) {
Binary::it_symtab_symbols static_symb = binary->symtab_symbols();
c_binary->static_symbols = static_cast<Elf_Symbol_t**>(
c_binary->symtab_symbols = static_cast<Elf_Symbol_t**>(
malloc((static_symb.size() + 1) * sizeof(Elf_Symbol_t**)));
for (size_t i = 0; i < static_symb.size(); ++i) {
Symbol& b_sym = static_symb[i];
c_binary->static_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
c_binary->static_symbols[i]->name = b_sym.name().c_str();
c_binary->static_symbols[i]->type = static_cast<enum LIEF_ELF_ELF_SYMBOL_TYPES>(b_sym.type());
c_binary->static_symbols[i]->binding = static_cast<enum LIEF_ELF_SYMBOL_BINDINGS>(b_sym.binding());
c_binary->static_symbols[i]->other = b_sym.other();
c_binary->static_symbols[i]->shndx = b_sym.shndx();
c_binary->static_symbols[i]->value = b_sym.value();
c_binary->static_symbols[i]->size = b_sym.size();
c_binary->static_symbols[i]->information = b_sym.information();
c_binary->static_symbols[i]->is_exported = b_sym.is_exported();
c_binary->static_symbols[i]->is_imported = b_sym.is_imported();
c_binary->symtab_symbols[i] = static_cast<Elf_Symbol_t*>(malloc(sizeof(Elf_Symbol_t)));
c_binary->symtab_symbols[i]->name = b_sym.name().c_str();
c_binary->symtab_symbols[i]->type = static_cast<uint32_t>(b_sym.type());
c_binary->symtab_symbols[i]->binding = static_cast<uint32_t>(b_sym.binding());
c_binary->symtab_symbols[i]->other = b_sym.other();
c_binary->symtab_symbols[i]->shndx = b_sym.shndx();
c_binary->symtab_symbols[i]->value = b_sym.value();
c_binary->symtab_symbols[i]->size = b_sym.size();
c_binary->symtab_symbols[i]->information = b_sym.information();
c_binary->symtab_symbols[i]->is_exported = b_sym.is_exported();
c_binary->symtab_symbols[i]->is_imported = b_sym.is_imported();
}
c_binary->static_symbols[static_symb.size()] = nullptr;
c_binary->symtab_symbols[static_symb.size()] = nullptr;
}
@@ -80,12 +78,12 @@ void destroy_dynamic_symbols(Elf_Binary_t* c_binary) {
}
void destroy_static_symbols(Elf_Binary_t* c_binary) {
Elf_Symbol_t **static_symbols = c_binary->static_symbols;
for (size_t idx = 0; static_symbols[idx] != nullptr; ++idx) {
free(static_symbols[idx]);
void destroy_symtab_symbols(Elf_Binary_t* c_binary) {
Elf_Symbol_t **symtab_symbols = c_binary->symtab_symbols;
for (size_t idx = 0; symtab_symbols[idx] != nullptr; ++idx) {
free(symtab_symbols[idx]);
}
free(c_binary->static_symbols);
free(c_binary->symtab_symbols);
}
}
+4 -4
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@ namespace LIEF {
namespace ELF {
void init_c_dynamic_symbols(Elf_Binary_t* c_binary, Binary* binary);
void init_c_static_symbols(Elf_Binary_t* c_binary, Binary* binary);
void init_c_symtab_symbols(Elf_Binary_t* c_binary, Binary* binary);
void destroy_dynamic_symbols(Elf_Binary_t* c_binary);
void destroy_static_symbols(Elf_Binary_t* c_binary);
void destroy_symtab_symbols(Elf_Binary_t* c_binary);
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+8 -44
View File
@@ -1,45 +1,9 @@
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
target_sources(LIB_LIEF PRIVATE
Parser.cpp
LoadCommand.cpp
Segment.cpp
Symbol.cpp
Section.cpp
Header.cpp
Binary.cpp
)
set(LIEF_API_C_MACHO_SRC
"${CMAKE_CURRENT_LIST_DIR}/EnumToString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Parser.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LoadCommand.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Segment.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Symbol.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Header.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Binary.cpp"
)
set(LIEF_API_C_MACHO_INCLUDE_FILES_CPP
"${CMAKE_CURRENT_LIST_DIR}/Header.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Binary.hpp"
"${CMAKE_CURRENT_LIST_DIR}/LoadCommand.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Segment.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Symbol.hpp"
)
set(LIEF_API_C_MACHO_INCLUDE_FILES_C
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Binary.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/EnumToString.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Header.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/LoadCommand.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Section.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Segment.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/MachO/Symbol.h"
)
set(LIEF_C_MACHO_INC "${LIEF_API_C_MACHO_INCLUDE_FILES_C}" "${LIEF_API_C_MACHO_INCLUDE_FILES_CPP}")
source_group("Source Files\\C API\\MachO" FILES ${LIEF_API_C_MACHO_SRC})
source_group("Header Files\\C API\\MachO" FILES ${LIEF_C_MACHO_INC})
target_sources(LIB_LIEF PRIVATE "${LIEF_API_C_MACHO_SRC}" ${LIEF_C_MACHO_INC})
-76
View File
@@ -1,76 +0,0 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "LIEF/MachO/EnumToString.h"
#include "LIEF/MachO/EnumToString.hpp"
#include "LIEF/MachO/enums.hpp"
#include "LIEF/MachO/enums.h"
extern "C"
{
const char* LOAD_COMMAND_TYPES_to_string(enum LIEF_MACHO_LOAD_COMMAND_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::LOAD_COMMAND_TYPES>(e));
}
const char* MACHO_TYPES_to_string(enum LIEF_MACHO_MACHO_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_TYPES>(e));
}
const char* FILE_TYPES_to_string(enum LIEF_MACHO_FILE_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::FILE_TYPES>(e));
}
const char* CPU_TYPES_to_string(enum LIEF_MACHO_CPU_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::CPU_TYPES>(e));
}
const char* HEADER_FLAGS_to_string(enum LIEF_MACHO_HEADER_FLAGS e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::HEADER_FLAGS>(e));
}
const char* MACHO_SECTION_TYPES_to_string(enum LIEF_MACHO_MACHO_SECTION_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SECTION_TYPES>(e));
}
const char* MACHO_SYMBOL_TYPES_to_string(enum LIEF_MACHO_MACHO_SYMBOL_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::MACHO_SYMBOL_TYPES>(e));
}
const char* N_LIST_TYPES_to_string(enum LIEF_MACHO_N_LIST_TYPES e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::N_LIST_TYPES>(e));
}
const char* SYMBOL_DESCRIPTIONS_to_string(enum LIEF_MACHO_SYMBOL_DESCRIPTIONS e) {
return LIEF::MachO::to_string(static_cast<LIEF::MachO::SYMBOL_DESCRIPTIONS>(e));
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ void init_c_commands(Macho_Binary_t* c_binary, Binary* binary) {
LoadCommand& cmd = commands[i];
c_binary->commands[i] = static_cast<Macho_Command_t*>(malloc(sizeof(Macho_Command_t)));
const std::vector<uint8_t>& cmd_content = cmd.data();
const span<const uint8_t> cmd_content = cmd.data();
auto* content = static_cast<uint8_t*>(malloc(cmd_content.size() * sizeof(uint8_t)));
std::copy(
std::begin(cmd_content),
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->sections[i]->alignment = section.alignment();
c_binary->sections[i]->relocation_offset = section.relocation_offset();
c_binary->sections[i]->numberof_relocations = section.numberof_relocations();
c_binary->sections[i]->flags = section.flags();
c_binary->sections[i]->flags = section.raw_flags();
c_binary->sections[i]->type = static_cast<enum LIEF_MACHO_MACHO_SECTION_TYPES>(section.type());
c_binary->sections[i]->reserved1 = section.reserved1();
c_binary->sections[i]->reserved2 = section.reserved2();
@@ -53,7 +53,6 @@ void init_c_sections(Macho_Binary_t* c_binary, Binary* binary) {
}
void destroy_sections(Macho_Binary_t* c_binary) {
Macho_Section_t **sections = c_binary->sections;
for (size_t idx = 0; sections[idx] != nullptr; ++idx) {
@@ -67,4 +66,3 @@ void destroy_sections(Macho_Binary_t* c_binary) {
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ void init_c_symbols(Macho_Binary_t* c_binary, Binary* binary) {
c_binary->symbols[i] = static_cast<Macho_Symbol_t*>(malloc(sizeof(Macho_Symbol_t)));
c_binary->symbols[i]->name = symbol.name().c_str();
c_binary->symbols[i]->type = symbol.type();
c_binary->symbols[i]->type = symbol.raw_type();
c_binary->symbols[i]->numberof_sections = symbol.numberof_sections();
c_binary->symbols[i]->description = symbol.description();
c_binary->symbols[i]->value = symbol.value();
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+10 -47
View File
@@ -1,48 +1,11 @@
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
target_sources(LIB_LIEF PRIVATE
Binary.cpp
DosHeader.cpp
Header.cpp
OptionalHeader.cpp
Section.cpp
DataDirectory.cpp
EnumToString.cpp
Import.cpp
ImportEntry.cpp
)
set(LIEF_API_C_PE_SRC
"${CMAKE_CURRENT_LIST_DIR}/Binary.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DosHeader.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Header.cpp"
"${CMAKE_CURRENT_LIST_DIR}/OptionalHeader.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.cpp"
"${CMAKE_CURRENT_LIST_DIR}/DataDirectory.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EnumToString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Import.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ImportEntry.cpp"
)
set(LIEF_API_C_PE_INCLUDE_FILES_CPP
"${CMAKE_CURRENT_LIST_DIR}/Binary.hpp"
"${CMAKE_CURRENT_LIST_DIR}/DataDirectory.hpp"
"${CMAKE_CURRENT_LIST_DIR}/DosHeader.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Header.hpp"
"${CMAKE_CURRENT_LIST_DIR}/OptionalHeader.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Section.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Import.hpp"
"${CMAKE_CURRENT_LIST_DIR}/ImportEntry.hpp"
)
set(LIEF_API_C_PE_INCLUDE_FILES_C
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/enums.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/Binary.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/DataDirectory.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/DosHeader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/EnumToString.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/Header.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/OptionalHeader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/Section.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/Import.h"
"${CMAKE_CURRENT_SOURCE_DIR}/api/c/include/LIEF/PE/ImportEntry.h"
)
set(LIEF_C_PE_INC "${LIEF_API_C_PE_INCLUDE_FILES_C}" "${LIEF_API_C_PE_INCLUDE_FILES_CPP}")
source_group("Source Files\\C API\\PE" FILES ${LIEF_API_C_PE_SRC})
source_group("Header Files\\C API\\PE" FILES ${LIEF_C_PE_INC})
target_sources(LIB_LIEF PRIVATE "${LIEF_API_C_PE_SRC}" "${LIEF_C_PE_INC}")
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+4 -4
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef LIEF_PE_DATA_DIRECTORY_CPP_C_API_
#define LIEF_PE_DATA_DIRECTORY_CPP_C_API_
#ifndef LIEF_PE_DATA_DIRECTORY_CPP_C_API
#define LIEF_PE_DATA_DIRECTORY_CPP_C_API
#include "LIEF/PE/Binary.h"
#include "LIEF/PE/Binary.hpp"
+3 -3
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ namespace PE {
void init_c_dos_header(Pe_Binary_t* c_binary, Binary* binary) {
const DosHeader& dos_header = binary->dos_header();
c_binary->dos_header.magic = dos_header.magic();
c_binary->dos_header.used_bytes_in_the_last_page = dos_header.used_bytes_in_the_last_page();
c_binary->dos_header.used_bytes_in_last_page = dos_header.used_bytes_in_last_page();
c_binary->dos_header.file_size_in_pages = dos_header.file_size_in_pages();
c_binary->dos_header.numberof_relocation = dos_header.numberof_relocation();
c_binary->dos_header.header_size_in_paragraphs = dos_header.header_size_in_paragraphs();
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -14
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,21 +20,10 @@
#include "LIEF/PE/enums.h"
extern "C"
{
extern "C" {
const char* PE_TYPES_to_string(enum LIEF_PE_PE_TYPES e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::PE_TYPE>(e));
}
const char* MACHINE_TYPES_to_string(enum LIEF_PE_MACHINE_TYPES e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::MACHINE_TYPES>(e));
}
const char* SUBSYSTEM_to_string(enum LIEF_PE_SUBSYSTEM e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::SUBSYSTEM>(e));
}
}
+13 -6
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,11 +32,18 @@ void init_c_header(Pe_Binary_t* c_binary, Binary* binary) {
c_binary->header.sizeof_optional_header = header.sizeof_optional_header();
c_binary->header.characteristics = static_cast<uint16_t>(header.characteristics());
std::copy(
std::begin(signature),
std::end(signature),
c_binary->header.signature);
std::copy(std::begin(signature), std::end(signature),
c_binary->header.signature);
}
}
}
const char* lief_pe_header_machine_str(enum LIEF_PE_MACHINE_TYPES e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::Header::MACHINE_TYPES>(e));
}
const char* lief_pe_header_characteristics_str(enum LIEF_PE_HEADER_CHARACTERISTICS e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::Header::CHARACTERISTICS>(e));
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+8 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "OptionalHeader.hpp"
#include "LIEF/PE/OptionalHeader.h"
namespace LIEF {
namespace PE {
@@ -59,3 +60,8 @@ void init_c_optional_header(Pe_Binary_t* c_binary, Binary* binary) {
}
}
const char* lief_pe_subsytem_str(enum LIEF_PE_SUBSYSTEM e) {
return LIEF::PE::to_string(static_cast<LIEF::PE::OptionalHeader::SUBSYSTEM>(e));
}
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+3 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,11 @@
#ifndef C_LIEF_ELF_H_
#define C_LIEF_ELF_H_
/** @defgroup elf_c_api ELF C API */
#include "LIEF/ELF/Binary.h"
#include "LIEF/ELF/Symbol.h"
#include "LIEF/ELF/Section.h"
#include "LIEF/ELF/Header.h"
#include "LIEF/ELF/DynamicEntry.h"
#include "LIEF/ELF/EnumToString.h"
#include "LIEF/ELF/utils.h"
#endif
+9 -26
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,16 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_BINARY_H_
#define C_LIEF_ELF_BINARY_H_
/** @defgroup elf_binary_c_api Binary
* @ingroup elf_c_api
* @addtogroup elf_binary_c_api
* @brief Binary C API
*
* @{
*/
#ifndef LIEF_C_ELF_BINARY_H
#define LIEF_C_ELF_BINARY_H
#include <stddef.h>
@@ -40,40 +32,31 @@
extern "C" {
#endif
/** @brief LIEF::ELF::Binary C Handler */
/** LIEF::ELF::Binary C Handler */
struct Elf_Binary_t {
void* handler;
const char* name;
const char* interpreter;
enum LIEF_ELF_ELF_CLASS type;
uint32_t type;
Elf_Header_t header;
Elf_Section_t **sections;
Elf_Segment_t **segments;
Elf_DynamicEntry_t **dynamic_entries;
Elf_Symbol_t **dynamic_symbols;
Elf_Symbol_t **static_symbols;
Elf_Symbol_t **symtab_symbols;
};
typedef struct Elf_Binary_t Elf_Binary_t;
/** @brief Wrapper for LIEF::ELF::Parser::parse */
/** Wrapper for LIEF::ELF::Parser::parse */
LIEF_API Elf_Binary_t* elf_parse(const char *file);
LIEF_API void elf_binary_destroy(Elf_Binary_t* binary);
/* ELF::Binary methods
* ==================
*/
/** @brief Update LIEF::ELF::Header object */
/** Update LIEF::ELF::Header object */
LIEF_API int elf_binary_save_header(Elf_Binary_t* binary);
#ifdef __cplusplus
}
#endif
/** @} */
#endif
+4 -19
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,22 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_DYNAMIC_ENTRY_H_
#define C_LIEF_ELF_DYNAMIC_ENTRY_H_
#ifndef LIEF_C_ELF_DYNAMIC_ENTRY_H
#define LIEF_C_ELF_DYNAMIC_ENTRY_H
#include <stdint.h>
#include "LIEF/ELF/enums.h"
/** @defgroup elf_dynamic_entry_c_api Dynamic Entry
* @ingroup elf_c_api
* @addtogroup elf_dynamic_entry_c_api
* @brief Dynamic Entry C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -68,12 +57,9 @@ struct Elf_DynamicEntry_RunPath_t {
const char* runpath;
};
struct Elf_DynamicEntry_Flags_t {
uint64_t tag;
uint64_t value;
enum LIEF_ELF_DYNAMIC_FLAGS *flags;
enum LIEF_ELF_DYNAMIC_FLAGS_1 *flags_1;
};
typedef struct Elf_DynamicEntry_t Elf_DynamicEntry_t;
@@ -88,5 +74,4 @@ typedef struct Elf_DynamicEntry_Flags_t Elf_DynamicEntry_Flags_t;
}
#endif
/** @} */
#endif
-47
View File
@@ -1,47 +0,0 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_ENUM_TO_STRING_H_
#define C_LIEF_ELF_ENUM_TO_STRING_H_
#include "LIEF/visibility.h"
#include "LIEF/ELF/enums.h"
#ifdef __cplusplus
extern "C" {
#endif
LIEF_API const char* SYMBOL_BINDINGS_to_string(enum LIEF_ELF_SYMBOL_BINDINGS e);
LIEF_API const char* E_TYPE_to_string(enum LIEF_ELF_E_TYPE e);
LIEF_API const char* VERSION_to_string(enum LIEF_ELF_VERSION e);
LIEF_API const char* ARCH_to_string(enum LIEF_ELF_ARCH e);
LIEF_API const char* SEGMENT_TYPES_to_string(enum LIEF_ELF_SEGMENT_TYPES e);
LIEF_API const char* DYNAMIC_TAGS_to_string(enum LIEF_ELF_DYNAMIC_TAGS e);
LIEF_API const char* ELF_SECTION_TYPES_to_string(enum LIEF_ELF_ELF_SECTION_TYPES e);
LIEF_API const char* ELF_SECTION_FLAGS_to_string(enum LIEF_ELF_ELF_SECTION_FLAGS e);
LIEF_API const char* ELF_SYMBOL_TYPES_to_string(enum LIEF_ELF_ELF_SYMBOL_TYPES e);
LIEF_API const char* ELF_CLASS_to_string(enum LIEF_ELF_ELF_CLASS e);
LIEF_API const char* ELF_DATA_to_string(enum LIEF_ELF_ELF_DATA e);
LIEF_API const char* OS_ABI_to_string(enum LIEF_ELF_OS_ABI e);
LIEF_API const char* DYNAMIC_FLAGS_to_string(enum LIEF_ELF_DYNAMIC_FLAGS e);
LIEF_API const char* DYNAMIC_FLAGS_1_to_string(enum LIEF_ELF_DYNAMIC_FLAGS_1 e);
#ifdef __cplusplus
}
#endif
#endif
+18 -26
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,38 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_HEADER_H_
#define C_LIEF_ELF_HEADER_H_
#ifndef LIEF_C_ELF_HEADER_H
#define LIEF_C_ELF_HEADER_H
#include <inttypes.h>
#include "LIEF/ELF/enums.h"
/** @defgroup elf_header_c_api Header
* @ingroup elf_c_api
* @addtogroup elf_header_c_api
* @brief Header C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Elf_Header_t {
uint8_t identity[LIEF_ELF_EI_NIDENT];
enum LIEF_ELF_E_TYPE file_type;
enum LIEF_ELF_ARCH machine_type;
enum LIEF_ELF_VERSION object_file_version;
uint64_t entrypoint;
uint64_t program_headers_offset;
uint64_t section_headers_offset;
uint32_t processor_flags;
uint32_t header_size;
uint32_t program_header_size;
uint32_t numberof_segments;
uint32_t section_header_size;
uint32_t numberof_sections;
uint32_t name_string_table_idx;
uint8_t identity[LIEF_EI_NIDENT];
uint32_t file_type;
uint32_t machine_type;
uint32_t object_file_version;
uint64_t entrypoint;
uint64_t program_headers_offset;
uint64_t section_headers_offset;
uint32_t processor_flags;
uint32_t header_size;
uint32_t program_header_size;
uint32_t numberof_segments;
uint32_t section_header_size;
uint32_t numberof_sections;
uint32_t name_string_table_idx;
};
typedef struct Elf_Header_t Elf_Header_t;
@@ -54,5 +47,4 @@ typedef struct Elf_Header_t Elf_Header_t;
}
#endif
/** @} */
#endif
+17 -28
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,39 +13,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_SECTION_H_
#define C_LIEF_ELF_SECTION_H_
#ifndef LIEF_C_ELF_SECTION_H
#define LIEF_C_ELF_SECTION_H
#include <stdint.h>
#include "LIEF/ELF/enums.h"
/** @defgroup elf_section_c_api Section
* @ingroup elf_c_api
* @addtogroup elf_section_c_api
* @brief Section C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Elf_Section_t {
const char* name;
uint32_t flags;
enum LIEF_ELF_ELF_SECTION_TYPES type;
uint64_t virtual_address;
uint64_t offset;
uint64_t original_size;
uint32_t link;
uint32_t info;
uint64_t alignment;
uint64_t entry_size;
uint64_t size;
uint8_t* content;
double entropy;
const char* name;
uint32_t flags;
uint32_t type;
uint64_t virtual_address;
uint64_t offset;
uint64_t original_size;
uint32_t link;
uint32_t info;
uint64_t alignment;
uint64_t entry_size;
uint64_t size;
uint8_t* content;
double entropy;
};
typedef struct Elf_Section_t Elf_Section_t;
@@ -54,5 +44,4 @@ typedef struct Elf_Section_t Elf_Section_t;
}
#endif
/** @} */
#endif
+12 -21
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,33 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_SEGMENT_H_
#define C_LIEF_ELF_SEGMENT_H_
#ifndef LIEF_C_ELF_SEGMENT_H_
#define LIEF_C_ELF_SEGMENT_H_
#include <stdint.h>
#include "LIEF/ELF/enums.h"
/** @defgroup elf_segment_c_api Segment
* @ingroup elf_c_api
* @addtogroup elf_segment_c_api
* @brief Segment C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Elf_Segment_t {
enum LIEF_ELF_SEGMENT_TYPES type;
uint32_t flags;
uint64_t virtual_address;
uint64_t virtual_size;
uint64_t offset;
uint64_t alignment;
uint64_t size;
uint8_t* content;
uint32_t type;
uint32_t flags;
uint64_t virtual_address;
uint64_t virtual_size;
uint64_t offset;
uint64_t alignment;
uint64_t size;
uint8_t* content;
};
typedef struct Elf_Segment_t Elf_Segment_t;
@@ -48,5 +40,4 @@ typedef struct Elf_Segment_t Elf_Segment_t;
}
#endif
/** @} */
#endif
+14 -24
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,36 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_SYMBOL_H_
#define C_LIEF_ELF_SYMBOL_H_
#ifndef LIEF_C_ELF_SYMBOL_H
#define LIEF_C_ELF_SYMBOL_H
#include <stdint.h>
#include "LIEF/ELF/enums.h"
#include "LIEF/types.h"
/** @defgroup elf_symbol_c_api Symbol
* @ingroup elf_c_api
* @addtogroup elf_symbol_c_api
* @brief Symbol C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Elf_Symbol_t {
const char* name;
enum LIEF_ELF_ELF_SYMBOL_TYPES type;
enum LIEF_ELF_SYMBOL_BINDINGS binding;
uint8_t information;
uint8_t other;
uint16_t shndx;
uint64_t value;
uint64_t size;
bool is_exported; /**< Whether or not the symbol is exported */
bool is_imported; /**< Whether or not the symbol is imported */
const char* name;
uint32_t type;
uint32_t binding;
uint8_t information;
uint8_t other;
uint16_t shndx;
uint64_t value;
uint64_t size;
bool is_exported; /**< Whether or not the symbol is exported */
bool is_imported; /**< Whether or not the symbol is imported */
};
typedef struct Elf_Symbol_t Elf_Symbol_t;
@@ -51,5 +42,4 @@ typedef struct Elf_Symbol_t Elf_Symbol_t;
}
#endif
/** @} */
#endif
+972 -7
View File
@@ -6,15 +6,980 @@
extern "C" {
#endif
#define _LIEF_EN(N) LIEF_ELF_##N
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N
#define _LIEF_EI(X) LIEF_ELF_##X
/** e_ident size and indices. */
enum LIEF_IDENTITY {
LIEF_EI_MAG0 = 0, /**< File identification index. */
LIEF_EI_MAG1 = 1, /**< File identification index. */
LIEF_EI_MAG2 = 2, /**< File identification index. */
LIEF_EI_MAG3 = 3, /**< File identification index. */
LIEF_EI_CLASS = 4, /**< File class. */
LIEF_EI_DATA = 5, /**< Data encoding. */
LIEF_EI_VERSION = 6, /**< File version. */
LIEF_EI_OSABI = 7, /**< OS/ABI identification. */
LIEF_EI_ABIVERSION = 8, /**< ABI version. */
LIEF_EI_PAD = 9, /**< Start of padding bytes. */
LIEF_EI_NIDENT = 16 /**< Number of bytes in e_ident. */
};
#include "LIEF/ELF/enums.inc"
#undef _LIEF_EN
#undef _LIEF_EN_2
#undef _LIEF_EI
/** Enum associated with *e_type* */
enum LIEF_E_TYPE {
LIEF_ET_NONE = 0, /**< No file type */
LIEF_ET_REL = 1, /**< Relocatable file */
LIEF_ET_EXEC = 2, /**< Executable file */
LIEF_ET_DYN = 3, /**< Shared object file */
LIEF_ET_CORE = 4, /**< Core file */
LIEF_ET_LOPROC = 0xff00, /**< Beginning of processor-specific codes */
LIEF_ET_HIPROC = 0xffff /**< Processor-specific */
};
/** Versioning */
enum LIEF_VERSION {
LIEF_EV_NONE = 0,
LIEF_EV_CURRENT = 1 /**< Default value */
};
/**
* @brief Machine architectures
* See current registered ELF machine architectures at:
* http://www.sco.com/developers/gabi/latest/ch4.eheader.html
*/
enum LIEF_ARCH {
LIEF_EM_NONE = 0, /**< No machine */
LIEF_EM_M32 = 1, /**< AT&T WE 32100 */
LIEF_EM_SPARC = 2, /**< SPARC */
LIEF_EM_386 = 3, /**< Intel 386 */
LIEF_EM_68K = 4, /**< Motorola 68000 */
LIEF_EM_88K = 5, /**< Motorola 88000 */
LIEF_EM_IAMCU = 6, /**< Intel MCU */
LIEF_EM_860 = 7, /**< Intel 80860 */
LIEF_EM_MIPS = 8, /**< MIPS R3000 */
LIEF_EM_S370 = 9, /**< IBM System/370 */
LIEF_EM_MIPS_RS3_LE = 10, /**< MIPS RS3000 Little-endian */
LIEF_EM_PARISC = 15, /**< Hewlett-Packard PA-RISC */
LIEF_EM_VPP500 = 17, /**< Fujitsu VPP500 */
LIEF_EM_SPARC32PLUS = 18, /**< Enhanced instruction set SPARC */
LIEF_EM_960 = 19, /**< Intel 80960 */
LIEF_EM_PPC = 20, /**< PowerPC */
LIEF_EM_PPC64 = 21, /**< PowerPC64 */
LIEF_EM_S390 = 22, /**< IBM System/390 */
LIEF_EM_SPU = 23, /**< IBM SPU/SPC */
LIEF_EM_V800 = 36, /**< NEC V800 */
LIEF_EM_FR20 = 37, /**< Fujitsu FR20 */
LIEF_EM_RH32 = 38, /**< TRW RH-32 */
LIEF_EM_RCE = 39, /**< Motorola RCE */
LIEF_EM_ARM = 40, /**< ARM */
LIEF_EM_ALPHA = 41, /**< DEC Alpha */
LIEF_EM_SH = 42, /**< Hitachi SH */
LIEF_EM_SPARCV9 = 43, /**< SPARC V9 */
LIEF_EM_TRICORE = 44, /**< Siemens TriCore */
LIEF_EM_ARC = 45, /**< Argonaut RISC Core */
LIEF_EM_H8_300 = 46, /**< Hitachi H8/300 */
LIEF_EM_H8_300H = 47, /**< Hitachi H8/300H */
LIEF_EM_H8S = 48, /**< Hitachi H8S */
LIEF_EM_H8_500 = 49, /**< Hitachi H8/500 */
LIEF_EM_IA_64 = 50, /**< Intel IA-64 processor architecture */
LIEF_EM_MIPS_X = 51, /**< Stanford MIPS-X */
LIEF_EM_COLDFIRE = 52, /**< Motorola ColdFire */
LIEF_EM_68HC12 = 53, /**< Motorola M68HC12 */
LIEF_EM_MMA = 54, /**< Fujitsu MMA Multimedia Accelerator */
LIEF_EM_PCP = 55, /**< Siemens PCP */
LIEF_EM_NCPU = 56, /**< Sony nCPU embedded RISC processor */
LIEF_EM_NDR1 = 57, /**< Denso NDR1 microprocessor */
LIEF_EM_STARCORE = 58, /**< Motorola Star*Core processor */
LIEF_EM_ME16 = 59, /**< Toyota ME16 processor */
LIEF_EM_ST100 = 60, /**< STMicroelectronics ST100 processor */
LIEF_EM_TINYJ = 61, /**< Advanced Logic Corp. TinyJ embedded processor family */
LIEF_EM_X86_64 = 62, /**< AMD x86-64 architecture */
LIEF_EM_PDSP = 63, /**< Sony DSP Processor */
LIEF_EM_PDP10 = 64, /**< Digital Equipment Corp. PDP-10 */
LIEF_EM_PDP11 = 65, /**< Digital Equipment Corp. PDP-11 */
LIEF_EM_FX66 = 66, /**< Siemens FX66 microcontroller */
LIEF_EM_ST9PLUS = 67, /**< STMicroelectronics ST9+ 8/16 bit microcontroller */
LIEF_EM_ST7 = 68, /**< STMicroelectronics ST7 8-bit microcontroller */
LIEF_EM_68HC16 = 69, /**< Motorola MC68HC16 Microcontroller */
LIEF_EM_68HC11 = 70, /**< Motorola MC68HC11 Microcontroller */
LIEF_EM_68HC08 = 71, /**< Motorola MC68HC08 Microcontroller */
LIEF_EM_68HC05 = 72, /**< Motorola MC68HC05 Microcontroller */
LIEF_EM_SVX = 73, /**< Silicon Graphics SVx */
LIEF_EM_ST19 = 74, /**< STMicroelectronics ST19 8-bit microcontroller */
LIEF_EM_VAX = 75, /**< Digital VAX */
LIEF_EM_CRIS = 76, /**< Axis Communications 32-bit embedded processor */
LIEF_EM_JAVELIN = 77, /**< Infineon Technologies 32-bit embedded processor */
LIEF_EM_FIREPATH = 78, /**< Element 14 64-bit DSP Processor */
LIEF_EM_ZSP = 79, /**< LSI Logic 16-bit DSP Processor */
LIEF_EM_MMIX = 80, /**< Donald Knuth's educational 64-bit processor */
LIEF_EM_HUANY = 81, /**< Harvard University machine-independent object files */
LIEF_EM_PRISM = 82, /**< SiTera Prism */
LIEF_EM_AVR = 83, /**< Atmel AVR 8-bit microcontroller */
LIEF_EM_FR30 = 84, /**< Fujitsu FR30 */
LIEF_EM_D10V = 85, /**< Mitsubishi D10V */
LIEF_EM_D30V = 86, /**< Mitsubishi D30V */
LIEF_EM_V850 = 87, /**< NEC v850 */
LIEF_EM_M32R = 88, /**< Mitsubishi M32R */
LIEF_EM_MN10300 = 89, /**< Matsushita MN10300 */
LIEF_EM_MN10200 = 90, /**< Matsushita MN10200 */
LIEF_EM_PJ = 91, /**< picoJava */
LIEF_EM_OPENRISC = 92, /**< OpenRISC 32-bit embedded processor */
LIEF_EM_ARC_COMPACT = 93, /**< ARC International ARCompact processor (old spelling/synonym: EM_ARC_A5 */
LIEF_EM_XTENSA = 94, /**< Tensilica Xtensa Architecture */
LIEF_EM_VIDEOCORE = 95, /**< Alphamosaic VideoCore processor */
LIEF_EM_TMM_GPP = 96, /**< Thompson Multimedia General Purpose Processor */
LIEF_EM_NS32K = 97, /**< National Semiconductor 32000 series */
LIEF_EM_TPC = 98, /**< Tenor Network TPC processor */
LIEF_EM_SNP1K = 99, /**< Trebia SNP 1000 processor */
LIEF_EM_ST200 = 100, /**< STMicroelectronics (www.st.com ST200 */
LIEF_EM_IP2K = 101, /**< Ubicom IP2xxx microcontroller family */
LIEF_EM_MAX = 102, /**< MAX Processor */
LIEF_EM_CR = 103, /**< National Semiconductor CompactRISC microprocessor */
LIEF_EM_F2MC16 = 104, /**< Fujitsu F2MC16 */
LIEF_EM_MSP430 = 105, /**< Texas Instruments embedded microcontroller msp430 */
LIEF_EM_BLACKFIN = 106, /**< Analog Devices Blackfin (DSP processor */
LIEF_EM_SE_C33 = 107, /**< S1C33 Family of Seiko Epson processors */
LIEF_EM_SEP = 108, /**< Sharp embedded microprocessor */
LIEF_EM_ARCA = 109, /**< Arca RISC Microprocessor */
LIEF_EM_UNICORE = 110, /**< Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
LIEF_EM_EXCESS = 111, /**< eXcess: 16/32/64-bit configurable embedded CPU */
LIEF_EM_DXP = 112, /**< Icera Semiconductor Inc. Deep Execution Processor */
LIEF_EM_ALTERA_NIOS2 = 113, /**< Altera Nios II soft-core processor */
LIEF_EM_CRX = 114, /**< National Semiconductor CompactRISC CRX */
LIEF_EM_XGATE = 115, /**< Motorola XGATE embedded processor */
LIEF_EM_C166 = 116, /**< Infineon C16x/XC16x processor */
LIEF_EM_M16C = 117, /**< Renesas M16C series microprocessors */
LIEF_EM_DSPIC30F = 118, /**< Microchip Technology dsPIC30F Digital Signal */
/* Controller */
LIEF_EM_CE = 119, /**< Freescale Communication Engine RISC core */
LIEF_EM_M32C = 120, /**< Renesas M32C series microprocessors */
LIEF_EM_TSK3000 = 131, /**< Altium TSK3000 core */
LIEF_EM_RS08 = 132, /**< Freescale RS08 embedded processor */
LIEF_EM_SHARC = 133, /**< Analog Devices SHARC family of 32-bit DSP */
/* processors */
LIEF_EM_ECOG2 = 134, /**< Cyan Technology eCOG2 microprocessor */
LIEF_EM_SCORE7 = 135, /**< Sunplus S+core7 RISC processor */
LIEF_EM_DSP24 = 136, /**< New Japan Radio (NJR 24-bit DSP Processor */
LIEF_EM_VIDEOCORE3 = 137, /**< Broadcom VideoCore III processor */
LIEF_EM_LATTICEMICO32 = 138, /**< RISC processor for Lattice FPGA architecture */
LIEF_EM_SE_C17 = 139, /**< Seiko Epson C17 family */
LIEF_EM_TI_C6000 = 140, /**< The Texas Instruments TMS320C6000 DSP family */
LIEF_EM_TI_C2000 = 141, /**< The Texas Instruments TMS320C2000 DSP family */
LIEF_EM_TI_C5500 = 142, /**< The Texas Instruments TMS320C55x DSP family */
LIEF_EM_MMDSP_PLUS = 160, /**< STMicroelectronics 64bit VLIW Data Signal Processor */
LIEF_EM_CYPRESS_M8C = 161, /**< Cypress M8C microprocessor */
LIEF_EM_R32C = 162, /**< Renesas R32C series microprocessors */
LIEF_EM_TRIMEDIA = 163, /**< NXP Semiconductors TriMedia architecture family */
LIEF_EM_HEXAGON = 164, /**< Qualcomm Hexagon processor */
LIEF_EM_8051 = 165, /**< Intel 8051 and variants */
LIEF_EM_STXP7X = 166, /**< STMicroelectronics STxP7x family of configurable */
/* and extensible RISC processors */
LIEF_EM_NDS32 = 167, /* Andes Technology compact code size embedded RISC */
/* processor family */
LIEF_EM_ECOG1 = 168, /**< Cyan Technology eCOG1X family */
LIEF_EM_ECOG1X = 168, /**< Cyan Technology eCOG1X family */
LIEF_EM_MAXQ30 = 169, /**< Dallas Semiconductor MAXQ30 Core Micro-controllers */
LIEF_EM_XIMO16 = 170, /**< New Japan Radio (NJR 16-bit DSP Processor */
LIEF_EM_MANIK = 171, /**< M2000 Reconfigurable RISC Microprocessor */
LIEF_EM_CRAYNV2 = 172, /**< Cray Inc. NV2 vector architecture */
LIEF_EM_RX = 173, /**< Renesas RX family */
LIEF_EM_METAG = 174, /**< Imagination Technologies META processor */
/* architecture */
LIEF_EM_MCST_ELBRUS = 175, /**< MCST Elbrus general purpose hardware architecture */
LIEF_EM_ECOG16 = 176, /**< Cyan Technology eCOG16 family */
LIEF_EM_CR16 = 177, /**< National Semiconductor CompactRISC CR16 16-bit */
/* microprocessor */
LIEF_EM_ETPU = 178, /**< Freescale Extended Time Processing Unit */
LIEF_EM_SLE9X = 179, /**< Infineon Technologies SLE9X core */
LIEF_EM_L10M = 180, /**< Intel L10M */
LIEF_EM_K10M = 181, /**< Intel K10M */
LIEF_EM_AARCH64 = 183, /**< ARM AArch64 */
LIEF_EM_AVR32 = 185, /**< Atmel Corporation 32-bit microprocessor family */
LIEF_EM_STM8 = 186, /**< STMicroeletronics STM8 8-bit microcontroller */
LIEF_EM_TILE64 = 187, /**< Tilera TILE64 multicore architecture family */
LIEF_EM_TILEPRO = 188, /**< Tilera TILEPro multicore architecture family */
LIEF_EM_CUDA = 190, /**< NVIDIA CUDA architecture */
LIEF_EM_TILEGX = 191, /**< Tilera TILE-Gx multicore architecture family */
LIEF_EM_CLOUDSHIELD = 192, /**< CloudShield architecture family */
LIEF_EM_COREA_1ST = 193, /**< KIPO-KAIST Core-A 1st generation processor family */
LIEF_EM_COREA_2ND = 194, /**< KIPO-KAIST Core-A 2nd generation processor family */
LIEF_EM_ARC_COMPACT2 = 195, /**< Synopsys ARCompact V2 */
LIEF_EM_OPEN8 = 196, /**< Open8 8-bit RISC soft processor core */
LIEF_EM_RL78 = 197, /**< Renesas RL78 family */
LIEF_EM_VIDEOCORE5 = 198, /**< Broadcom VideoCore V processor */
LIEF_EM_78KOR = 199, /**< Renesas 78KOR family */
LIEF_EM_56800EX = 200, /**< Freescale 56800EX Digital Signal Controller (DSC */
LIEF_EM_BA1 = 201, /**< Beyond BA1 CPU architecture */
LIEF_EM_BA2 = 202, /**< Beyond BA2 CPU architecture */
LIEF_EM_XCORE = 203, /**< XMOS xCORE processor family */
LIEF_EM_MCHP_PIC = 204, /**< Microchip 8-bit PIC(r family */
LIEF_EM_INTEL205 = 205, /**< Reserved by Intel */
LIEF_EM_INTEL206 = 206, /**< Reserved by Intel */
LIEF_EM_INTEL207 = 207, /**< Reserved by Intel */
LIEF_EM_INTEL208 = 208, /**< Reserved by Intel */
LIEF_EM_INTEL209 = 209, /**< Reserved by Intel */
LIEF_EM_KM32 = 210, /**< KM211 KM32 32-bit processor */
LIEF_EM_KMX32 = 211, /**< KM211 KMX32 32-bit processor */
LIEF_EM_KMX16 = 212, /**< KM211 KMX16 16-bit processor */
LIEF_EM_KMX8 = 213, /**< KM211 KMX8 8-bit processor */
LIEF_EM_KVARC = 214, /**< KM211 KVARC processor */
LIEF_EM_CDP = 215, /**< Paneve CDP architecture family */
LIEF_EM_COGE = 216, /**< Cognitive Smart Memory Processor */
LIEF_EM_COOL = 217, /**< iCelero CoolEngine */
LIEF_EM_NORC = 218, /**< Nanoradio Optimized RISC */
LIEF_EM_CSR_KALIMBA = 219, /**< CSR Kalimba architecture family */
LIEF_EM_AMDGPU = 224, /**< AMD GPU architecture */
LIEF_EM_RISCV = 243, /**< RISC-V */
LIEF_EM_BPF = 247, /**< eBPF Filter */
LIEF_EM_LOONGARCH = 258 /**< LoongArch */
};
/** Object file classes. */
enum LIEF_ELF_CLASS {
LIEF_ELFCLASSNONE = 0, /**< Unknown */
LIEF_ELFCLASS32 = 1, /**< 32-bit object file */
LIEF_ELFCLASS64 = 2 /**< 64-bit object file */
};
/** Object file byte orderings. */
enum LIEF_ELF_DATA {
LIEF_ELFDATANONE = 0, /**< Invalid data encoding. */
LIEF_ELFDATA2LSB = 1, /**< Little-endian object file */
LIEF_ELFDATA2MSB = 2 /**< Big-endian object file */
};
/** OS ABI identification. */
enum LIEF_OS_ABI {
LIEF_OSABI_SYSTEMV = 0, /**< UNIX System V ABI */
LIEF_OSABI_HPUX = 1, /**< HP-UX operating system */
LIEF_OSABI_NETBSD = 2, /**< NetBSD */
LIEF_OSABI_GNU = 3, /**< GNU/Linux */
LIEF_OSABI_LINUX = 3, /**< Historical alias for ELFOSABI_GNU. */
LIEF_OSABI_HURD = 4, /**< GNU/Hurd */
LIEF_OSABI_SOLARIS = 6, /**< Solaris */
LIEF_OSABI_AIX = 7, /**< AIX */
LIEF_OSABI_IRIX = 8, /**< IRIX */
LIEF_OSABI_FREEBSD = 9, /**< FreeBSD */
LIEF_OSABI_TRU64 = 10, /**< TRU64 UNIX */
LIEF_OSABI_MODESTO = 11, /**< Novell Modesto */
LIEF_OSABI_OPENBSD = 12, /**< OpenBSD */
LIEF_OSABI_OPENVMS = 13, /**< OpenVMS */
LIEF_OSABI_NSK = 14, /**< Hewlett-Packard Non-Stop Kernel */
LIEF_OSABI_AROS = 15, /**< AROS */
LIEF_OSABI_FENIXOS = 16, /**< FenixOS */
LIEF_OSABI_CLOUDABI = 17, /**< Nuxi CloudABI */
LIEF_OSABI_C6000_ELFABI = 64, /**< Bare-metal TMS320C6000 */
LIEF_OSABI_AMDGPU_HSA = 64, /**< AMD HSA runtime */
LIEF_OSABI_C6000_LINUX = 65, /**< Linux TMS320C6000 */
LIEF_OSABI_ARM = 97, /**< ARM */
LIEF_OSABI_STANDALONE = 255 /**< Standalone (embedded application */
};
/* ELF Relocations */
#define ELF_RELOC(name, value) name = value,
/** x86_64 relocations. */
enum LIEF_RELOC_x86_64 {
#include "LIEF/ELF/Relocations/x86_64.def"
};
/** i386 relocations. */
enum RELOC_i386 {
#include "LIEF/ELF/Relocations/i386.def"
};
/* ELF Relocation types for PPC32 */
enum LIEF_RELOC_POWERPC32 {
#include "LIEF/ELF/Relocations/PowerPC.def"
};
/* ELF Relocation types for PPC64 */
enum LIEF_RELOC_POWERPC64 {
#include "LIEF/ELF/Relocations/PowerPC64.def"
};
/* ELF Relocation types for AArch64 */
enum LIEF_RELOC_AARCH64 {
#include "LIEF/ELF/Relocations/AArch64.def"
};
/* ELF Relocation types for ARM */
enum LIEF_RELOC_ARM {
#include "LIEF/ELF/Relocations/ARM.def"
};
/* ELF Relocation types for Mips */
enum LIEF_RELOC_MIPS {
#include "LIEF/ELF/Relocations/Mips.def"
};
/* ELF Relocation types for Hexagon */
enum LIEF_RELOC_HEXAGON {
#include "LIEF/ELF/Relocations/Hexagon.def"
};
/* ELF Relocation types for S390/zSeries */
enum LIEF_RELOC_SYSTEMZ {
#include "LIEF/ELF/Relocations/SystemZ.def"
};
/* ELF Relocation type for Sparc. */
enum LIEF_RELOC_SPARC {
#include "LIEF/ELF/Relocations/Sparc.def"
};
/* ELF Relocation types for LoongArch. */
enum LIEF_RELOC_LOONGARCH {
#include "LIEF/ELF/Relocations/LoongArch.def"
};
#undef ELF_RELOC
/* Specific e_flags for PPC64 */
enum LIEF_PPC64_EFLAGS {
/* e_flags bits specifying ABI: */
/* 1 for original ABI using function descriptors, */
/* 2 for revised ABI without function descriptors, */
/* 0 for unspecified or not using any features affected by the differences. */
LIEF_EF_PPC64_ABI = 3
};
/* ARM Specific e_flags */
enum LIEF_ARM_EFLAGS {
LIEF_EF_ARM_SOFT_FLOAT = 0x00000200U,
LIEF_EF_ARM_VFP_FLOAT = 0x00000400U,
LIEF_EF_ARM_EABI_UNKNOWN = 0x00000000U,
LIEF_EF_ARM_EABI_VER1 = 0x01000000U,
LIEF_EF_ARM_EABI_VER2 = 0x02000000U,
LIEF_EF_ARM_EABI_VER3 = 0x03000000U,
LIEF_EF_ARM_EABI_VER4 = 0x04000000U,
LIEF_EF_ARM_EABI_VER5 = 0x05000000U,
LIEF_EF_ARM_EABIMASK = 0xFF000000U
};
/* Mips Specific e_flags */
enum LIEF_MIPS_EFLAGS {
LIEF_EF_MIPS_NOREORDER = 0x00000001, /* Don't reorder instructions */
LIEF_EF_MIPS_PIC = 0x00000002, /* Position independent code */
LIEF_EF_MIPS_CPIC = 0x00000004, /* Call object with Position independent code */
LIEF_EF_MIPS_ABI2 = 0x00000020, /* File uses N32 ABI */
LIEF_EF_MIPS_32BITMODE = 0x00000100, /* Code compiled for a 64-bit machine */
/* in 32-bit mode */
LIEF_EF_MIPS_FP64 = 0x00000200, /* Code compiled for a 32-bit machine */
/* but uses 64-bit FP registers */
LIEF_EF_MIPS_NAN2008 = 0x00000400, /* Uses IEE 754-2008 NaN encoding */
/* ABI flags */
LIEF_EF_MIPS_ABI_O32 = 0x00001000, /* This file follows the first MIPS 32 bit ABI */
LIEF_EF_MIPS_ABI_O64 = 0x00002000, /* O32 ABI extended for 64-bit architecture. */
LIEF_EF_MIPS_ABI_EABI32 = 0x00003000, /* EABI in 32 bit mode. */
LIEF_EF_MIPS_ABI_EABI64 = 0x00004000, /* EABI in 64 bit mode. */
LIEF_EF_MIPS_ABI = 0x0000f000, /* Mask for selecting EF_MIPS_ABI_ variant. */
/* MIPS machine variant */
LIEF_EF_MIPS_MACH_3900 = 0x00810000, /* Toshiba R3900 */
LIEF_EF_MIPS_MACH_4010 = 0x00820000, /* LSI R4010 */
LIEF_EF_MIPS_MACH_4100 = 0x00830000, /* NEC VR4100 */
LIEF_EF_MIPS_MACH_4650 = 0x00850000, /* MIPS R4650 */
LIEF_EF_MIPS_MACH_4120 = 0x00870000, /* NEC VR4120 */
LIEF_EF_MIPS_MACH_4111 = 0x00880000, /* NEC VR4111/VR4181 */
LIEF_EF_MIPS_MACH_SB1 = 0x008a0000, /* Broadcom SB-1 */
LIEF_EF_MIPS_MACH_OCTEON = 0x008b0000, /* Cavium Networks Octeon */
LIEF_EF_MIPS_MACH_XLR = 0x008c0000, /* RMI Xlr */
LIEF_EF_MIPS_MACH_OCTEON2 = 0x008d0000, /* Cavium Networks Octeon2 */
LIEF_EF_MIPS_MACH_OCTEON3 = 0x008e0000, /* Cavium Networks Octeon3 */
LIEF_EF_MIPS_MACH_5400 = 0x00910000, /* NEC VR5400 */
LIEF_EF_MIPS_MACH_5900 = 0x00920000, /* MIPS R5900 */
LIEF_EF_MIPS_MACH_5500 = 0x00980000, /* NEC VR5500 */
LIEF_EF_MIPS_MACH_9000 = 0x00990000, /* Unknown */
LIEF_EF_MIPS_MACH_LS2E = 0x00a00000, /* ST Microelectronics Loongson 2E */
LIEF_EF_MIPS_MACH_LS2F = 0x00a10000, /* ST Microelectronics Loongson 2F */
LIEF_EF_MIPS_MACH_LS3A = 0x00a20000, /* Loongson 3A */
LIEF_EF_MIPS_MACH = 0x00ff0000, /* EF_MIPS_MACH_xxx selection mask */
/* ARCH_ASE */
LIEF_EF_MIPS_MICROMIPS = 0x02000000, /* microMIPS */
LIEF_EF_MIPS_ARCH_ASE_M16 = 0x04000000, /* Has Mips-16 ISA extensions */
LIEF_EF_MIPS_ARCH_ASE_MDMX = 0x08000000, /* Has MDMX multimedia extensions */
LIEF_EF_MIPS_ARCH_ASE = 0x0f000000, /* Mask for EF_MIPS_ARCH_ASE_xxx flags */
/* ARCH */
LIEF_EF_MIPS_ARCH_1 = 0x00000000, /* MIPS1 instruction set */
LIEF_EF_MIPS_ARCH_2 = 0x10000000, /* MIPS2 instruction set */
LIEF_EF_MIPS_ARCH_3 = 0x20000000, /* MIPS3 instruction set */
LIEF_EF_MIPS_ARCH_4 = 0x30000000, /* MIPS4 instruction set */
LIEF_EF_MIPS_ARCH_5 = 0x40000000, /* MIPS5 instruction set */
LIEF_EF_MIPS_ARCH_32 = 0x50000000, /* MIPS32 instruction set per linux not elf.h */
LIEF_EF_MIPS_ARCH_64 = 0x60000000, /* MIPS64 instruction set per linux not elf.h */
LIEF_EF_MIPS_ARCH_32R2 = 0x70000000, /* mips32r2, mips32r3, mips32r5 */
LIEF_EF_MIPS_ARCH_64R2 = 0x80000000, /* mips64r2, mips64r3, mips64r5 */
LIEF_EF_MIPS_ARCH_32R6 = 0x90000000, /* mips32r6 */
LIEF_EF_MIPS_ARCH_64R6 = 0xa0000000, /* mips64r6 */
LIEF_EF_MIPS_ARCH = 0xf0000000 /* Mask for applying EF_MIPS_ARCH_ variant */
};
/* Hexagon Specific e_flags */
/* Release 5 ABI */
enum LIEF_HEXAGON_EFLAGS {
/* Object processor version flags, bits[3:0] */
LIEF_EF_HEXAGON_MACH_V2 = 0x00000001, /* Hexagon V2 */
LIEF_EF_HEXAGON_MACH_V3 = 0x00000002, /* Hexagon V3 */
LIEF_EF_HEXAGON_MACH_V4 = 0x00000003, /* Hexagon V4 */
LIEF_EF_HEXAGON_MACH_V5 = 0x00000004, /* Hexagon V5 */
/* Highest ISA version flags */
LIEF_EF_HEXAGON_ISA_MACH = 0x00000000, /* Same as specified in bits[3:0] */
/* of e_flags */
LIEF_EF_HEXAGON_ISA_V2 = 0x00000010, /* Hexagon V2 ISA */
LIEF_EF_HEXAGON_ISA_V3 = 0x00000020, /* Hexagon V3 ISA */
LIEF_EF_HEXAGON_ISA_V4 = 0x00000030, /* Hexagon V4 ISA */
LIEF_EF_HEXAGON_ISA_V5 = 0x00000040 /* Hexagon V5 ISA */
};
/* LoongArch Specific e_flags */
enum LIEF_LOONGARCH_EFLAGS {
LIEF_EF_LOONGARCH_ABI_SOFT_FLOAT = 0x1,
LIEF_EF_LOONGARCH_ABI_SINGLE_FLOAT = 0x2,
LIEF_EF_LOONGARCH_ABI_DOUBLE_FLOAT = 0x3
};
/** Special section indices. */
enum LIEF_SYMBOL_SECTION_INDEX {
LIEF_SHN_UNDEF = 0, /**< Undefined, missing, irrelevant, or meaningless */
LIEF_SHN_LORESERVE = 0xff00, /**< Lowest reserved index */
LIEF_SHN_LOPROC = 0xff00, /**< Lowest processor-specific index */
LIEF_SHN_HIPROC = 0xff1f, /**< Highest processor-specific index */
LIEF_SHN_LOOS = 0xff20, /**< Lowest operating system-specific index */
LIEF_SHN_HIOS = 0xff3f, /**< Highest operating system-specific index */
LIEF_SHN_ABS = 0xfff1, /**< Symbol has absolute value; does not need relocation */
LIEF_SHN_COMMON = 0xfff2, /**< FORTRAN COMMON or C external global variables */
LIEF_SHN_XINDEX = 0xffff, /**< Mark that the index is >= SHN_LORESERVE */
LIEF_SHN_HIRESERVE = 0xffff /**< Highest reserved index */
};
/** Section types. */
enum LIEF_ELF_SECTION_TYPES {
LIEF_SHT_NULL = 0, /**< No associated section (inactive entry. */
LIEF_SHT_PROGBITS = 1, /**< Program-defined contents. */
LIEF_SHT_SYMTAB = 2, /**< Symbol table. */
LIEF_SHT_STRTAB = 3, /**< String table. */
LIEF_SHT_RELA = 4, /**< Relocation entries; explicit addends. */
LIEF_SHT_HASH = 5, /**< Symbol hash table. */
LIEF_SHT_DYNAMIC = 6, /**< Information for dynamic linking. */
LIEF_SHT_NOTE = 7, /**< Information about the file. */
LIEF_SHT_NOBITS = 8, /**< Data occupies no space in the file. */
LIEF_SHT_REL = 9, /**< Relocation entries; no explicit addends. */
LIEF_SHT_SHLIB = 10, /**< Reserved. */
LIEF_SHT_DYNSYM = 11, /**< Symbol table. */
LIEF_SHT_INIT_ARRAY = 14, /**< Pointers to initialization functions. */
LIEF_SHT_FINI_ARRAY = 15, /**< Pointers to termination functions. */
LIEF_SHT_PREINIT_ARRAY = 16, /**< Pointers to pre-init functions. */
LIEF_SHT_GROUP = 17, /**< Section group. */
LIEF_SHT_SYMTAB_SHNDX = 18, /**< Indices for SHN_XINDEX entries. */
LIEF_SHT_LOOS = 0x60000000, /**< Lowest operating system-specific type. */
LIEF_SHT_ANDROID_REL = 0x60000001, /**< Packed relocations (Android specific. */
LIEF_SHT_ANDROID_RELA = 0x60000002, /**< Packed relocations (Android specific. */
LIEF_SHT_LLVM_ADDRSIG = 0x6fff4c03, /**< This section is used to mark symbols as address-significant. */
LIEF_SHT_RELR = 0x6fffff00, /**< New relr relocations (Android specific. */
LIEF_SHT_GNU_ATTRIBUTES = 0x6ffffff5, /**< Object attributes. */
LIEF_SHT_GNU_HASH = 0x6ffffff6, /**< GNU-style hash table. */
LIEF_SHT_GNU_verdef = 0x6ffffffd, /**< GNU version definitions. */
LIEF_SHT_GNU_verneed = 0x6ffffffe, /**< GNU version references. */
LIEF_SHT_GNU_versym = 0x6fffffff, /**< GNU symbol versions table. */
LIEF_SHT_HIOS = 0x6fffffff, /**< Highest operating system-specific type. */
LIEF_SHT_LOPROC = 0x70000000, /**< Lowest processor arch-specific type. */
LIEF_SHT_ARM_EXIDX = 0x70000001U, /**< Exception Index table */
LIEF_SHT_ARM_PREEMPTMAP = 0x70000002U, /**< BPABI DLL dynamic linking pre-emption map */
LIEF_SHT_ARM_ATTRIBUTES = 0x70000003U, /**< Object file compatibility attributes */
LIEF_SHT_ARM_DEBUGOVERLAY = 0x70000004U,
LIEF_SHT_ARM_OVERLAYSECTION = 0x70000005U,
LIEF_SHT_HEX_ORDERED = 0x70000000, /**< Link editor is to sort the entries in */
/* this section based on their sizes */
LIEF_SHT_X86_64_UNWIND = 0x70000001, /**< Unwind information */
LIEF_SHT_MIPS_REGINFO = 0x70000006, /**< Register usage information */
LIEF_SHT_MIPS_OPTIONS = 0x7000000d, /**< General options */
LIEF_SHT_MIPS_ABIFLAGS = 0x7000002a, /**< ABI information. */
LIEF_SHT_HIPROC = 0x7fffffff, /**< Highest processor arch-specific type. */
LIEF_SHT_LOUSER = 0x80000000, /**< Lowest type reserved for applications. */
LIEF_SHT_HIUSER = 0xffffffff /**< Highest type reserved for applications. */
};
/** Section flags. */
enum LIEF_ELF_SECTION_FLAGS {
LIEF_SHF_NONE = 0x0,
LIEF_SHF_WRITE = 0x1, /**< Section data should be writable during execution. */
LIEF_SHF_ALLOC = 0x2, /**< Section occupies memory during program execution. */
LIEF_SHF_EXECINSTR = 0x4, /**< Section contains executable machine instructions. */
LIEF_SHF_MERGE = 0x10, /**< The data in this section may be merged. */
LIEF_SHF_STRINGS = 0x20, /**< The data in this section is null-terminated strings. */
LIEF_SHF_INFO_LINK = 0x40U, /**< A field in this section holds a section header table index. */
LIEF_SHF_LINK_ORDER = 0x80U, /**< Adds special ordering requirements for link editors. */
LIEF_SHF_OS_NONCONFORMING = 0x100U, /**< This section requires special OS-specific processing to avoid incorrect behavior */
LIEF_SHF_GROUP = 0x200U, /**< This section is a member of a section group. */
LIEF_SHF_TLS = 0x400U, /**< This section holds Thread-Local Storage. */
LIEF_SHF_EXCLUDE = 0x80000000U, /**< This section is excluded from the final executable or shared library. */
/* Start of target-specific flags. */
/* XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
* together by the linker to form the constant pool and the cp register is
* set to the start of the constant pool by the boot code.
*/
LIEF_XCORE_SHF_CP_SECTION = 0x800U,
/* XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
* together by the linker to form the data section and the dp register is
* set to the start of the section by the boot code.
*/
LIEF_XCORE_SHF_DP_SECTION = 0x1000U,
LIEF_SHF_MASKOS = 0x0ff00000,
LIEF_SHF_MASKPROC = 0xf0000000, /**< Bits indicating processor-specific flags. */
/* If an object file section does not have this flag set, then it may not hold
* more than 2GB and can be freely referred to in objects using smaller code
* models. Otherwise, only objects using larger code models can refer to them.
* For example, a medium code model object can refer to data in a section that
* sets this flag besides being able to refer to data in a section that does
* not set it; likewise, a small code model object can refer only to code in a
* section that does not set this flag.
*/
LIEF_SHF_X86_64_LARGE = 0x10000000,
/* All sections with the GPREL flag are grouped into a global data area
* for faster accesses.
*/
LIEF_SHF_HEX_GPREL = 0x10000000,
/* Section contains text/data which may be replicated in other sections.
* Linker must retain only one copy.
*/
LIEF_SHF_MIPS_NODUPES = 0x01000000,
LIEF_SHF_MIPS_NAMES = 0x02000000, /**< Linker must generate implicit hidden weak names. */
LIEF_SHF_MIPS_LOCAL = 0x04000000, /**< Section data local to process. */
LIEF_SHF_MIPS_NOSTRIP = 0x08000000, /**< Do not strip this section. */
LIEF_SHF_MIPS_GPREL = 0x10000000, /**< Section must be part of global data area. */
LIEF_SHF_MIPS_MERGE = 0x20000000, /**< This section should be merged. */
LIEF_SHF_MIPS_ADDR = 0x40000000, /**< Address size to be inferred from section entry size. */
LIEF_SHF_MIPS_STRING = 0x80000000 /**< Section data is string data by default. */
};
/** Symbol bindings. */
enum LIEF_SYMBOL_BINDINGS {
LIEF_STB_LOCAL = 0, /**< Local symbol, not visible outside obj file containing def */
LIEF_STB_GLOBAL = 1, /**< Global symbol, visible to all object files being combined */
LIEF_STB_WEAK = 2, /**< Weak symbol, like global but lower-precedence */
LIEF_STB_GNU_UNIQUE = 10,
LIEF_STB_LOOS = 10, /**< Lowest operating system-specific binding type */
LIEF_STB_HIOS = 12, /**< Highest operating system-specific binding type */
LIEF_STB_LOPROC = 13, /**< Lowest processor-specific binding type */
LIEF_STB_HIPROC = 15 /**< Highest processor-specific binding type */
};
/* Symbol types. */
enum LIEF_ELF_SYMBOL_TYPES {
LIEF_STT_NOTYPE = 0, /* Symbol's type is not specified */
LIEF_STT_OBJECT = 1, /* Symbol is a data object (variable, array, etc. */
LIEF_STT_FUNC = 2, /* Symbol is executable code (function, etc. */
LIEF_STT_SECTION = 3, /* Symbol refers to a section */
LIEF_STT_FILE = 4, /* Local, absolute symbol that refers to a file */
LIEF_STT_COMMON = 5, /* An uninitialized common block */
LIEF_STT_TLS = 6, /* Thread local data object */
LIEF_STT_GNU_IFUNC = 10, /* GNU indirect function */
LIEF_STT_LOOS = 10, /* Lowest operating system-specific symbol type */
LIEF_STT_HIOS = 12, /* Highest operating system-specific symbol type */
LIEF_STT_LOPROC = 13, /* Lowest processor-specific symbol type */
LIEF_STT_HIPROC = 15 /* Highest processor-specific symbol type */
};
enum LIEF_ELF_SYMBOL_VISIBILITY {
LIEF_STV_DEFAULT = 0, /* Visibility is specified by binding type */
LIEF_STV_INTERNAL = 1, /* Defined by processor supplements */
LIEF_STV_HIDDEN = 2, /* Not visible to other components */
LIEF_STV_PROTECTED = 3 /* Visible in other components but not preemptable */
};
/** @brief Segment types. */
enum LIEF_SEGMENT_TYPES {
LIEF_PT_NULL = 0, /**< Unused segment. */
LIEF_PT_LOAD = 1, /**< Loadable segment. */
LIEF_PT_DYNAMIC = 2, /**< Dynamic linking information. */
LIEF_PT_INTERP = 3, /**< Interpreter pathname. */
LIEF_PT_NOTE = 4, /**< Auxiliary information. */
LIEF_PT_SHLIB = 5, /**< Reserved. */
LIEF_PT_PHDR = 6, /**< The program header table itself. */
LIEF_PT_TLS = 7, /**< The thread-local storage template. */
LIEF_PT_LOOS = 0x60000000, /**< Lowest operating system-specific pt entry type. */
LIEF_PT_HIOS = 0x6fffffff, /**< Highest operating system-specific pt entry type. */
LIEF_PT_LOPROC = 0x70000000, /**< Lowest processor-specific program hdr entry type. */
LIEF_PT_HIPROC = 0x7fffffff, /**< Highest processor-specific program hdr entry type. */
/* x86-64 program header types. */
/* These all contain stack unwind tables. */
LIEF_PT_GNU_EH_FRAME = 0x6474e550,
LIEF_PT_SUNW_EH_FRAME = 0x6474e550,
LIEF_PT_SUNW_UNWIND = 0x6464e550,
LIEF_PT_GNU_STACK = 0x6474e551, /**< Indicates stack executability. */
LIEF_PT_GNU_PROPERTY = 0x6474e553, /**< GNU property */
LIEF_PT_GNU_RELRO = 0x6474e552, /**< Read-only after relocation. */
/* ARM program header types. */
LIEF_PT_ARM_ARCHEXT = 0x70000000, /**< Platform architecture compatibility info */
/* These all contain stack unwind tables. */
LIEF_PT_ARM_EXIDX = 0x70000001,
LIEF_PT_ARM_UNWIND = 0x70000001,
/* MIPS program header types. */
LIEF_PT_MIPS_REGINFO = 0x70000000, /**< Register usage information. */
LIEF_PT_MIPS_RTPROC = 0x70000001, /**< Runtime procedure table. */
LIEF_PT_MIPS_OPTIONS = 0x70000002, /**< Options segment. */
LIEF_PT_MIPS_ABIFLAGS = 0x70000003 /**< Abiflags segment. */
};
/** Segment flags. */
enum LIEF_ELF_SEGMENT_FLAGS {
LIEF_PF_NONE = 0,
LIEF_PF_X = 1, /**< Execute */
LIEF_PF_W = 2, /**< Write */
LIEF_PF_R = 4, /**< Read */
LIEF_PF_MASKOS = 0x0ff00000,/**< Bits for operating system-specific semantics. */
LIEF_PF_MASKPROC = 0xf0000000 /**< Bits for processor-specific semantics. */
};
/** Dynamic table entry tags. */
enum LIEF_DYNAMIC_TAGS {
LIEF_DT_NULL = 0, /**< Marks end of dynamic array. */
LIEF_DT_NEEDED = 1, /**< String table offset of needed library. */
LIEF_DT_PLTRELSZ = 2, /**< Size of relocation entries in PLT. */
LIEF_DT_PLTGOT = 3, /**< Address associated with linkage table. */
LIEF_DT_HASH = 4, /**< Address of symbolic hash table. */
LIEF_DT_STRTAB = 5, /**< Address of dynamic string table. */
LIEF_DT_SYMTAB = 6, /**< Address of dynamic symbol table. */
LIEF_DT_RELA = 7, /**< Address of relocation table (Rela entries. */
LIEF_DT_RELASZ = 8, /**< Size of Rela relocation table. */
LIEF_DT_RELAENT = 9, /**< Size of a Rela relocation entry. */
LIEF_DT_STRSZ = 10, /**< Total size of the string table. */
LIEF_DT_SYMENT = 11, /**< Size of a symbol table entry. */
LIEF_DT_INIT = 12, /**< Address of initialization function. */
LIEF_DT_FINI = 13, /**< Address of termination function. */
LIEF_DT_SONAME = 14, /**< String table offset of a shared objects name. */
LIEF_DT_RPATH = 15, /**< String table offset of library search path. */
LIEF_DT_SYMBOLIC = 16, /**< Changes symbol resolution algorithm. */
LIEF_DT_REL = 17, /**< Address of relocation table (Rel entries. */
LIEF_DT_RELSZ = 18, /**< Size of Rel relocation table. */
LIEF_DT_RELENT = 19, /**< Size of a Rel relocation entry. */
LIEF_DT_PLTREL = 20, /**< Type of relocation entry used for linking. */
LIEF_DT_DEBUG = 21, /**< Reserved for debugger. */
LIEF_DT_TEXTREL = 22, /**< Relocations exist for non-writable segments. */
LIEF_DT_JMPREL = 23, /**< Address of relocations associated with PLT. */
LIEF_DT_BIND_NOW = 24, /**< Process all relocations before execution. */
LIEF_DT_INIT_ARRAY = 25, /**< Pointer to array of initialization functions. */
LIEF_DT_FINI_ARRAY = 26, /**< Pointer to array of termination functions. */
LIEF_DT_INIT_ARRAYSZ = 27, /**< Size of DT_INIT_ARRAY. */
LIEF_DT_FINI_ARRAYSZ = 28, /**< Size of DT_FINI_ARRAY. */
LIEF_DT_RUNPATH = 29, /**< String table offset of lib search path. */
LIEF_DT_FLAGS = 30, /**< Flags. */
LIEF_DT_ENCODING = 32, /**< Values from here to DT_LOOS follow the rules for the interpretation of the d_un union. */
LIEF_DT_PREINIT_ARRAY = 32, /**< Pointer to array of preinit functions. */
LIEF_DT_PREINIT_ARRAYSZ = 33, /**< Size of the DT_PREINIT_ARRAY array. */
LIEF_DT_LOOS = 0x60000000, /**< Start of environment specific tags. */
LIEF_DT_HIOS = 0x6FFFFFFF, /**< End of environment specific tags. */
LIEF_DT_LOPROC = 0x70000000, /**< Start of processor specific tags. */
LIEF_DT_HIPROC = 0x7FFFFFFF, /**< End of processor specific tags. */
LIEF_DT_GNU_HASH = 0x6FFFFEF5, /**< Reference to the GNU hash table. */
LIEF_DT_RELACOUNT = 0x6FFFFFF9, /**< ELF32_Rela count. */
LIEF_DT_RELCOUNT = 0x6FFFFFFA, /**< ELF32_Rel count. */
LIEF_DT_FLAGS_1 = 0x6FFFFFFB, /**< Flags_1. */
LIEF_DT_VERSYM = 0x6FFFFFF0, /**< The address of .gnu.version section. */
LIEF_DT_VERDEF = 0x6FFFFFFC, /**< The address of the version definition table. */
LIEF_DT_VERDEFNUM = 0x6FFFFFFD, /**< The number of entries in DT_VERDEF. */
LIEF_DT_VERNEED = 0x6FFFFFFE, /**< The address of the version Dependency table. */
LIEF_DT_VERNEEDNUM = 0x6FFFFFFF, /**< The number of entries in DT_VERNEED. */
/* Mips specific dynamic table entry tags. */
LIEF_DT_MIPS_RLD_VERSION = 0x70000001, /**< 32 bit version number for runtime linker interface. */
LIEF_DT_MIPS_TIME_STAMP = 0x70000002, /**< Time stamp. */
LIEF_DT_MIPS_ICHECKSUM = 0x70000003, /**< Checksum of external strings and common sizes. */
LIEF_DT_MIPS_IVERSION = 0x70000004, /**< Index of version string in string table. */
LIEF_DT_MIPS_FLAGS = 0x70000005, /**< 32 bits of flags. */
LIEF_DT_MIPS_BASE_ADDRESS = 0x70000006, /**< Base address of the segment. */
LIEF_DT_MIPS_MSYM = 0x70000007, /**< Address of .msym section. */
LIEF_DT_MIPS_CONFLICT = 0x70000008, /**< Address of .conflict section. */
LIEF_DT_MIPS_LIBLIST = 0x70000009, /**< Address of .liblist section. */
LIEF_DT_MIPS_LOCAL_GOTNO = 0x7000000a, /**< Number of local global offset table entries. */
LIEF_DT_MIPS_CONFLICTNO = 0x7000000b, /**< Number of entries in the .conflict section. */
LIEF_DT_MIPS_LIBLISTNO = 0x70000010, /**< Number of entries in the .liblist section. */
LIEF_DT_MIPS_SYMTABNO = 0x70000011, /**< Number of entries in the .dynsym section. */
LIEF_DT_MIPS_UNREFEXTNO = 0x70000012, /**< Index of first external dynamic symbol not referenced locally. */
LIEF_DT_MIPS_GOTSYM = 0x70000013, /**< Index of first dynamic symbol in global offset table. */
LIEF_DT_MIPS_HIPAGENO = 0x70000014, /**< Number of page table entries in global offset table. */
LIEF_DT_MIPS_RLD_MAP = 0x70000016, /**< Address of run time loader map, used for debugging. */
LIEF_DT_MIPS_DELTA_CLASS = 0x70000017, /**< Delta C++ class definition. */
LIEF_DT_MIPS_DELTA_CLASS_NO = 0x70000018, /**< Number of entries in DT_MIPS_DELTA_CLASS. */
LIEF_DT_MIPS_DELTA_INSTANCE = 0x70000019, /**< Delta C++ class instances. */
LIEF_DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, /**< Number of entries in DT_MIPS_DELTA_INSTANCE. */
LIEF_DT_MIPS_DELTA_RELOC = 0x7000001B, /**< Delta relocations. */
LIEF_DT_MIPS_DELTA_RELOC_NO = 0x7000001C, /**< Number of entries in DT_MIPS_DELTA_RELOC. */
LIEF_DT_MIPS_DELTA_SYM = 0x7000001D, /**< Delta symbols that Delta relocations refer to. */
LIEF_DT_MIPS_DELTA_SYM_NO = 0x7000001E, /**< Number of entries in DT_MIPS_DELTA_SYM. */
LIEF_DT_MIPS_DELTA_CLASSSYM = 0x70000020, /**< Delta symbols that hold class declarations. */
LIEF_DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, /**< Number of entries in DT_MIPS_DELTA_CLASSSYM. */
LIEF_DT_MIPS_CXX_FLAGS = 0x70000022, /**< Flags indicating information about C++ flavor. */
LIEF_DT_MIPS_PIXIE_INIT = 0x70000023, /**< Pixie information. */
LIEF_DT_MIPS_SYMBOL_LIB = 0x70000024, /**< Address of .MIPS.symlib */
LIEF_DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, /**< The GOT index of the first PTE for a segment */
LIEF_DT_MIPS_LOCAL_GOTIDX = 0x70000026, /**< The GOT index of the first PTE for a local symbol */
LIEF_DT_MIPS_HIDDEN_GOTIDX = 0x70000027, /**< The GOT index of the first PTE for a hidden symbol */
LIEF_DT_MIPS_PROTECTED_GOTIDX = 0x70000028, /**< The GOT index of the first PTE for a protected symbol */
LIEF_DT_MIPS_OPTIONS = 0x70000029, /**< Address of `.MIPS.options'. */
LIEF_DT_MIPS_INTERFACE = 0x7000002A, /**< Address of `.interface'. */
LIEF_DT_MIPS_DYNSTR_ALIGN = 0x7000002B, /**< Unknown. */
LIEF_DT_MIPS_INTERFACE_SIZE = 0x7000002C, /**< Size of the .interface section. */
LIEF_DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, /**< Size of rld_text_resolve function stored in the GOT. */
LIEF_DT_MIPS_PERF_SUFFIX = 0x7000002E, /**< Default suffix of DSO to be added by rld on dlopen( calls. */
LIEF_DT_MIPS_COMPACT_SIZE = 0x7000002F, /**< Size of compact relocation section (O32. */
LIEF_DT_MIPS_GP_VALUE = 0x70000030, /**< GP value for auxiliary GOTs. */
LIEF_DT_MIPS_AUX_DYNAMIC = 0x70000031, /**< Address of auxiliary .dynamic. */
LIEF_DT_MIPS_PLTGOT = 0x70000032, /**< Address of the base of the PLTGOT. */
LIEF_DT_MIPS_RWPLT = 0x70000034, /**< Points to the base of a writable PLT. */
/* Android specific dynamic table entry tags. */
LIEF_DT_ANDROID_REL_OFFSET = 0x6000000D, /**< The offset of packed relocation data (older version < M) (Android specific. */
LIEF_DT_ANDROID_REL_SIZE = 0x6000000E, /**< The size of packed relocation data in bytes (older version < M) (Android specific. */
LIEF_DT_ANDROID_REL = 0x6000000F, /**< The offset of packed relocation data (Android specific. */
LIEF_DT_ANDROID_RELSZ = 0x60000010, /**< The size of packed relocation data in bytes (Android specific. */
LIEF_DT_ANDROID_RELA = 0x60000011, /**< The offset of packed relocation data (Android specific. */
LIEF_DT_ANDROID_RELASZ = 0x60000012, /**< The size of packed relocation data in bytes (Android specific. */
LIEF_DT_RELR = 0x6FFFE000, /**< The offset of new relr relocation data (Android specific. */
LIEF_DT_RELRSZ = 0x6FFFE001, /**< The size of nre relr relocation data in bytes (Android specific. */
LIEF_DT_RELRENT = 0x6FFFE003, /**< The size of a new relr relocation entry (Android specific. */
LIEF_DT_RELRCOUNT = 0x6FFFE005 /**< Specifies the relative count of new relr relocation entries (Android specific. */
};
/** DT_FLAGS and DT_FLAGS_1 values. */
enum LIEF_DYNAMIC_FLAGS {
LIEF_DF_ORIGIN = 0x00000001, /**< The object may reference $ORIGIN. */
LIEF_DF_SYMBOLIC = 0x00000002, /**< Search the shared lib before searching the exe. */
LIEF_DF_TEXTREL = 0x00000004, /**< Relocations may modify a non-writable segment. */
LIEF_DF_BIND_NOW = 0x00000008, /**< Process all relocations on load. */
LIEF_DF_STATIC_TLS = 0x00000010, /**< Reject attempts to load dynamically. */
};
enum LIEF_DYNAMIC_FLAGS_1 {
LIEF_DF_1_NOW = 0x00000001, /**< Set RTLD_NOW for this object. */
LIEF_DF_1_GLOBAL = 0x00000002, /**< Set RTLD_GLOBAL for this object. */
LIEF_DF_1_GROUP = 0x00000004, /**< Set RTLD_GROUP for this object. */
LIEF_DF_1_NODELETE = 0x00000008, /**< Set RTLD_NODELETE for this object. */
LIEF_DF_1_LOADFLTR = 0x00000010, /**< Trigger filtee loading at runtime. */
LIEF_DF_1_INITFIRST = 0x00000020, /**< Set RTLD_INITFIRST for this object. */
LIEF_DF_1_NOOPEN = 0x00000040, /**< Set RTLD_NOOPEN for this object. */
LIEF_DF_1_ORIGIN = 0x00000080, /**< $ORIGIN must be handled. */
LIEF_DF_1_DIRECT = 0x00000100, /**< Direct binding enabled. */
LIEF_DF_1_TRANS = 0x00000200,
LIEF_DF_1_INTERPOSE = 0x00000400, /**< Object is used to interpose. */
LIEF_DF_1_NODEFLIB = 0x00000800, /**< Ignore default lib search path. */
LIEF_DF_1_NODUMP = 0x00001000, /**< Object can't be dldump'ed. */
LIEF_DF_1_CONFALT = 0x00002000, /**< Configuration alternative created. */
LIEF_DF_1_ENDFILTEE = 0x00004000, /**< Filtee terminates filters search. */
LIEF_DF_1_DISPRELDNE = 0x00008000, /**< Disp reloc applied at build time. */
LIEF_DF_1_DISPRELPND = 0x00010000, /**< Disp reloc applied at run-time. */
LIEF_DF_1_NODIRECT = 0x00020000, /**< Object has no-direct binding. */
LIEF_DF_1_IGNMULDEF = 0x00040000,
LIEF_DF_1_NOKSYMS = 0x00080000,
LIEF_DF_1_NOHDR = 0x00100000,
LIEF_DF_1_EDITED = 0x00200000, /**< Object is modified after built. */
LIEF_DF_1_NORELOC = 0x00400000,
LIEF_DF_1_SYMINTPOSE = 0x00800000, /**< Object has individual interposers. */
LIEF_DF_1_GLOBAUDIT = 0x01000000, /**< Global auditing required. */
LIEF_DF_1_SINGLETON = 0x02000000, /**< Singleton symbols are used. */
LIEF_DF_1_PIE = 0x08000000 /**< Singleton symbols are used. */
};
/* DT_MIPS_FLAGS values. */
enum {
LIEF_RHF_NONE = 0x00000000, /* No flags. */
LIEF_RHF_QUICKSTART = 0x00000001, /* Uses shortcut pointers. */
LIEF_RHF_NOTPOT = 0x00000002, /* Hash size is not a power of two. */
LIEF_RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, /* Ignore LD_LIBRARY_PATH. */
LIEF_RHF_NO_MOVE = 0x00000008, /* DSO address may not be relocated. */
LIEF_RHF_SGI_ONLY = 0x00000010, /* SGI specific features. */
LIEF_RHF_GUARANTEE_INIT = 0x00000020, /* Guarantee that .init will finish */
/* executing before any non-init */
/* code in DSO is called. */
LIEF_RHF_DELTA_C_PLUS_PLUS = 0x00000040, /* Contains Delta C++ code. */
LIEF_RHF_GUARANTEE_START_INIT = 0x00000080, /* Guarantee that .init will start */
/* executing before any non-init */
/* code in DSO is called. */
LIEF_RHF_PIXIE = 0x00000100, /* Generated by pixie. */
LIEF_RHF_DEFAULT_DELAY_LOAD = 0x00000200, /* Delay-load DSO by default. */
LIEF_RHF_REQUICKSTART = 0x00000400, /* Object may be requickstarted */
LIEF_RHF_REQUICKSTARTED = 0x00000800, /* Object has been requickstarted */
LIEF_RHF_CORD = 0x00001000, /* Generated by cord. */
LIEF_RHF_NO_UNRES_UNDEF = 0x00002000, /* Object contains no unresolved */
/* undef symbols. */
LIEF_RHF_RLD_ORDER_SAFE = 0x00004000 /* Symbol table is in a safe order. */
};
/** ElfXX_VerDef structure version (GNU versioning) */
enum {
LIEF_VER_DEF_NONE = 0,
LIEF_VER_DEF_CURRENT = 1
};
/** VerDef Flags (ElfXX_VerDef::vd_flags) */
enum {
LIEF_VER_FLG_BASE = 0x1,
LIEF_VER_FLG_WEAK = 0x2,
LIEF_VER_FLG_INFO = 0x4
};
/** Special constants for the version table. (SHT_GNU_versym/.gnu.version) */
enum {
LIEF_VER_NDX_LOCAL = 0, /**< Unversioned local symbol */
LIEF_VER_NDX_GLOBAL = 1, /**< Unversioned global symbol */
LIEF_VERSYM_VERSION = 0x7fff, /**< Version Index mask */
LIEF_VERSYM_HIDDEN = 0x8000 /**< Hidden bit (non-default version */
};
/** ElfXX_VerNeed structure version (GNU versioning) */
enum {
LIEF_VER_NEED_NONE = 0,
LIEF_VER_NEED_CURRENT = 1
};
enum LIEF_AUX_TYPE {
LIEF_AT_NULL = 0, /**< End of vector */
LIEF_AT_IGNORE = 1, /**< Entry should be ignored */
LIEF_AT_EXECFD = 2, /**< File descriptor of program */
LIEF_AT_PHDR = 3, /**< Program headers for program */
LIEF_AT_PHENT = 4, /**< Size of program header entry */
LIEF_AT_PHNUM = 5, /**< Number of program headers */
LIEF_AT_PAGESZ = 6, /**< System page size */
LIEF_AT_BASE = 7, /**< Base address of interpreter */
LIEF_AT_FLAGS = 8, /**< Flags */
LIEF_AT_ENTRY = 9, /**< Entry point of program */
LIEF_AT_NOTELF = 10, /**< Program is not ELF */
LIEF_AT_UID = 11, /**< Real uid */
LIEF_AT_EUID = 12, /**< Effective uid */
LIEF_AT_GID = 13, /**< Real gid */
LIEF_AT_EGID = 14, /**< Effective gid */
LIEF_AT_CLKTCK = 17, /**< Frequency of times( */
/* Some more special a_type values describing the hardware. */
LIEF_AT_PLATFORM = 15, /**< String identifying platform. */
LIEF_AT_HWCAP = 16, /**< Machine dependent hints about processor capabilities. */
/* This entry gives some information about the FPU initialization
performed by the kernel. */
LIEF_AT_FPUCW = 18, /**< Used FPU control word. */
/* Cache block sizes. */
LIEF_AT_DCACHEBSIZE = 19, /**< Data cache block size. */
LIEF_AT_ICACHEBSIZE = 20, /**< Instruction cache block size. */
LIEF_AT_UCACHEBSIZE = 21, /**< Unified cache block size. */
/* A special ignored value for PPC, used by the kernel to control the
interpretation of the AUXV. Must be > 16. */
LIEF_AT_IGNOREPPC = 22, /**< Entry should be ignored. */
LIEF_AT_SECURE = 23, /**< Boolean, was exec setuid-like? */
LIEF_AT_BASE_PLATFORM = 24, /**< String identifying real platforms.*/
LIEF_AT_RANDOM = 25, /**< Address of 16 random bytes. */
LIEF_AT_HWCAP2 = 26, /**< Extension of AT_HWCAP. */
LIEF_AT_EXECFN = 31, /**< Filename of executable. */
/* Pointer to the global system page used for system calls and other
nice things. */
LIEF_AT_SYSINFO = 32,
LIEF_AT_SYSINFO_EHDR = 33,
/* Shapes of the caches. Bits 0-3 contains associativity; bits 4-7 contains
log2 of line size; mask those to get cache size. */
LIEF_AT_L1I_CACHESHAPE = 34,
LIEF_AT_L1D_CACHESHAPE = 35,
LIEF_AT_L2_CACHESHAPE = 36,
LIEF_AT_L3_CACHESHAPE = 37
};
/** Methods that can be used by the LIEF::ELF::Parser
to count the number of dynamic symbols */
enum LIEF_DYNSYM_COUNT_METHODS {
LIEF_COUNT_AUTO = 0, /**< Automatic detection */
LIEF_COUNT_SECTION = 1, /**< Count based on sections (not very reliable */
LIEF_COUNT_HASH = 2, /**< Count based on hash table (reliable */
LIEF_COUNT_RELOCATIONS = 3, /**< Count based on PLT/GOT relocations (very reliable but not accurate */
};
enum LIEF_NOTE_TYPES {
LIEF_NT_UNKNOWN = 0,
LIEF_NT_GNU_ABI_TAG = 1,
LIEF_NT_GNU_HWCAP = 2,
LIEF_NT_GNU_BUILD_ID = 3,
LIEF_NT_GNU_GOLD_VERSION = 4,
LIEF_NT_GNU_PROPERTY_TYPE_0 = 5,
LIEF_NT_GNU_BUILD_ATTRIBUTE_OPEN = 0x100,
LIEF_NT_GNU_BUILD_ATTRIBUTE_FUNC = 0x101,
LIEF_NT_CRASHPAD = 0x4f464e49,
};
enum LIEF_NOTE_TYPES_CORE {
LIEF_NT_CORE_UNKNOWN = 0,
LIEF_NT_PRSTATUS = 1,
LIEF_NT_PRFPREG = 2,
LIEF_NT_PRPSINFO = 3,
LIEF_NT_TASKSTRUCT = 4,
LIEF_NT_AUXV = 6,
LIEF_NT_SIGINFO = 0x53494749,
LIEF_NT_FILE = 0x46494c45,
LIEF_NT_PRXFPREG = 0x46e62b7f,
LIEF_NT_ARM_VFP = 0x400,
LIEF_NT_ARM_TLS = 0x401,
LIEF_NT_ARM_HW_BREAK = 0x402,
LIEF_NT_ARM_HW_WATCH = 0x403,
LIEF_NT_ARM_SYSTEM_CALL = 0x404,
LIEF_NT_ARM_SVE = 0x405,
LIEF_NT_386_TLS = 0x200,
LIEF_NT_386_IOPERM = 0x201,
LIEF_NT_386_XSTATE = 0x202,
};
enum LIEF_NOTE_ABIS {
LIEF_ELF_NOTE_UNKNOWN = ~(unsigned int)(0),
LIEF_ELF_NOTE_OS_LINUX = 0,
LIEF_ELF_NOTE_OS_GNU = 1,
LIEF_ELF_NOTE_OS_SOLARIS2 = 2,
LIEF_ELF_NOTE_OS_FREEBSD = 3,
LIEF_ELF_NOTE_OS_NETBSD = 4,
LIEF_ELF_NOTE_OS_SYLLABLE = 5,
};
enum LIEF_RELOCATION_PURPOSES {
LIEF_RELOC_PURPOSE_NONE = 0,
LIEF_RELOC_PURPOSE_PLTGOT = 1,
LIEF_RELOC_PURPOSE_DYNAMIC = 2,
LIEF_RELOC_PURPOSE_OBJECT = 3,
};
#ifdef __cplusplus
}
+4 -13
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,16 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_ELF_UTILS_H_
#define C_LIEF_ELF_UTILS_H_
/** @defgroup elf_utils_c_api Utils
* @ingroup elf_c_api
* @addtogroup elf_utils_c_api
* @brief Utils C API
*
* @{
*/
#ifndef LIEF_C_ELF_UTILS_H
#define LIEF_C_ELF_UTILS_H
#include <stddef.h>
@@ -42,5 +34,4 @@ LIEF_API bool is_elf(const char* file);
#endif
/** @} */
#endif
+2 -2
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
+2 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,10 @@
#ifndef C_LIEF_MACHO_H_
#define C_LIEF_MACHO_H_
/** @defgroup macho_c_api MachO C API */
#include "LIEF/MachO/Binary.h"
#include "LIEF/MachO/Symbol.h"
#include "LIEF/MachO/Segment.h"
#include "LIEF/MachO/Section.h"
#include "LIEF/MachO/LoadCommand.h"
#include "LIEF/MachO/Header.h"
#include "LIEF/MachO/EnumToString.h"
#endif
+2 -12
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +16,6 @@
#ifndef C_LIEF_MACHO_BINARY_H_
#define C_LIEF_MACHO_BINARY_H_
/** @defgroup macho_binary_c_api Binary
* @ingroup macho_c_api
* @addtogroup macho_binary_c_api
* @brief Binary C API
*
* @{
*/
#include <stdint.h>
#include "LIEF/visibility.h"
@@ -41,7 +33,6 @@ extern "C" {
/** @brief LIEF::MachO::Binary C Handler */
struct Macho_Binary_t {
void* handler;
const char* name;
uint64_t imagebase;
Macho_Header_t header;
Macho_Command_t** commands;
@@ -63,5 +54,4 @@ LIEF_API void macho_binaries_destroy(Macho_Binary_t** binaries);
#endif
/** @} */
#endif
-41
View File
@@ -1,41 +0,0 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_MACHO_ENUM_TO_STRING_H_
#define C_LIEF_MACHO_ENUM_TO_STRING_H_
#include "LIEF/visibility.h"
#include "LIEF/MachO/enums.h"
#ifdef __cplusplus
extern "C" {
#endif
LIEF_API const char* LOAD_COMMAND_TYPES_to_string(enum LIEF_MACHO_LOAD_COMMAND_TYPES e);
LIEF_API const char* MACHO_TYPES_to_string(enum LIEF_MACHO_MACHO_TYPES e);
LIEF_API const char* FILE_TYPES_to_string(enum LIEF_MACHO_FILE_TYPES e);
LIEF_API const char* CPU_TYPES_to_string(enum LIEF_MACHO_CPU_TYPES e);
LIEF_API const char* HEADER_FLAGS_to_string(enum LIEF_MACHO_HEADER_FLAGS e);
LIEF_API const char* MACHO_SECTION_TYPES_to_string(enum LIEF_MACHO_MACHO_SECTION_TYPES e);
LIEF_API const char* MACHO_SYMBOL_TYPES_to_string(enum LIEF_MACHO_MACHO_SYMBOL_TYPES e);
LIEF_API const char* N_LIST_TYPES_to_string(enum LIEF_MACHO_N_LIST_TYPES e);
LIEF_API const char* SYMBOL_DESCRIPTIONS_to_string(enum LIEF_MACHO_SYMBOL_DESCRIPTIONS e);
#ifdef __cplusplus
}
#endif
#endif
+2 -10
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,6 @@
#include <inttypes.h>
#include "LIEF/MachO/enums.h"
/** @defgroup macho_header_c_api Header
* @ingroup macho_c_api
* @addtogroup macho_header_c_api
* @brief Header C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
@@ -48,5 +41,4 @@ typedef struct Macho_Header_t Macho_Header_t;
}
#endif
/** @} */
#endif
+2 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,6 @@
#include <inttypes.h>
#include "LIEF/MachO/enums.h"
/** @defgroup macho_load_command_c_api Header
* @ingroup macho_c_api
* @addtogroup macho_load_command_c_api
* @brief Load Command C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -44,5 +36,4 @@ typedef struct Macho_Command_t Macho_Command_t;
}
#endif
/** @} */
#endif
+2 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,6 @@
#include <inttypes.h>
#include "LIEF/MachO/enums.h"
/** @defgroup macho_section_c_api Header
* @ingroup macho_c_api
* @addtogroup macho_section_c_api
* @brief Section C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -55,5 +47,4 @@ typedef struct Macho_Section_t Macho_Section_t;
}
#endif
/** @} */
#endif
+3 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,7 @@
#include <inttypes.h>
#include "LIEF/MachO/enums.h"
/** @defgroup macho_segment_c_api Header
* @ingroup macho_c_api
* @addtogroup macho_segment_c_api
* @brief Segment C API
*
* @{
*/
#include "LIEF/MachO/Section.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -52,5 +45,4 @@ typedef struct Macho_Segment_t Macho_Segment_t;
}
#endif
/** @} */
#endif
+2 -10
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,6 @@
#include <inttypes.h>
#include "LIEF/MachO/enums.h"
/** @defgroup macho_symbol_c_api Header
* @ingroup macho_c_api
* @addtogroup macho_symbol_c_api
* @brief Symbol C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
@@ -45,5 +38,4 @@ typedef struct Macho_Symbol_t Macho_Symbol_t;
}
#endif
/** @} */
#endif
+2 -4
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
#ifndef C_LIEF_PE_H_
#define C_LIEF_PE_H_
/** @defgroup pe_c_api PE C API */
#include "LIEF/PE/Binary.h"
#include "LIEF/PE/EnumToString.h"
#endif
+2 -13
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,14 +16,6 @@
#ifndef C_LIEF_PE_BINARY_H_
#define C_LIEF_PE_BINARY_H_
/** @defgroup pe_binary_c_api Binary
* @ingroup pe_c_api
* @addtogroup pe_binary_c_api
* @brief Binary C API
*
* @{
*/
#include <stddef.h>
#include "LIEF/visibility.h"
@@ -44,7 +36,6 @@ extern "C" {
/** @brief LIEF::PE::Binary C Handler */
struct Pe_Binary_t {
void* handler;
const char* name;
Pe_DosHeader_t dos_header;
Pe_Header_t header;
Pe_OptionalHeader_t optional_header;
@@ -64,6 +55,4 @@ LIEF_API void pe_binary_destroy(Pe_Binary_t* binary);
}
#endif
/** @} */
#endif
+27 -13
View File
@@ -1,7 +1,7 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License",;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -13,24 +13,39 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_PE_DATA_DIRECTORY_H_
#define C_LIEF_PE_DATA_DIRECTORY_H_
#ifndef C_LIEF_PE_DATA_DIRECTORY_H
#define C_LIEF_PE_DATA_DIRECTORY_H
#include <inttypes.h>
#include "LIEF/PE/enums.h"
/** @defgroup pe_data_directory_c_api Section
* @ingroup pe_c_api
* @addtogroup pe_data_directory_c_api
* @brief Data directory C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
enum LIEF_PE_DATA_DIRECTORY {
LIEF_PE_DATA_DIR_EXPORT_TABLE = 0,
LIEF_PE_DATA_DIR_IMPORT_TABLE,
LIEF_PE_DATA_DIR_RESOURCE_TABLE,
LIEF_PE_DATA_DIR_EXCEPTION_TABLE,
LIEF_PE_DATA_DIR_CERTIFICATE_TABLE,
LIEF_PE_DATA_DIR_BASE_RELOCATION_TABLE,
LIEF_PE_DATA_DIR_DEBUG,
LIEF_PE_DATA_DIR_ARCHITECTURE,
LIEF_PE_DATA_DIR_GLOBAL_PTR,
LIEF_PE_DATA_DIR_TLS_TABLE,
LIEF_PE_DATA_DIR_LOAD_CONFIG_TABLE,
LIEF_PE_DATA_DIR_BOUND_IMPORT,
LIEF_PE_DATA_DIR_IAT,
LIEF_PE_DATA_DIR_DELAY_IMPORT_DESCRIPTOR,
LIEF_PE_DATA_DIR_CLR_RUNTIME_HEADER,
LIEF_PE_DATA_DIR_RESERVED,
LIEF_PE_DATA_DIR_NONE,
};
struct Pe_DataDirectory_t {
uint32_t rva;
uint32_t size;
@@ -43,5 +58,4 @@ typedef struct Pe_DataDirectory_t Pe_DataDirectory_t;
}
#endif
/** @} */
#endif
+3 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,6 @@
#include <inttypes.h>
#include "LIEF/ELF/enums.h"
/** @defgroup pe_dos_header_c_api DosHeader
* @ingroup pe_c_api
* @addtogroup pe_dos_header_c_api
* @brief Dos Header C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
@@ -32,7 +25,7 @@ extern "C" {
struct Pe_DosHeader_t {
uint16_t magic ;
uint16_t used_bytes_in_the_last_page;
uint16_t used_bytes_in_last_page;
uint16_t file_size_in_pages;
uint16_t numberof_relocation;
uint16_t header_size_in_paragraphs;
@@ -59,5 +52,4 @@ typedef struct Pe_DosHeader_t Pe_DosHeader_t;
}
#endif
/** @} */
#endif
+2 -5
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,10 +24,7 @@
extern "C" {
#endif
LIEF_API const char* PE_TYPES_to_string(enum LIEF_PE_PE_TYPES e);
LIEF_API const char* MACHINE_TYPES_to_string(enum LIEF_PE_MACHINE_TYPES e);
LIEF_API const char* SUBSYSTEM_to_string(enum LIEF_PE_SUBSYSTEM e);
#ifdef __cplusplus
}
+54 -13
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,24 +13,64 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_PE_HEADER_H_
#define C_LIEF_PE_HEADER_H_
#ifndef C_LIEF_PE_HEADER_H
#define C_LIEF_PE_HEADER_H
#include <inttypes.h>
#include "LIEF/PE/enums.h"
/** @defgroup pe_header_c_api Header
* @ingroup pe_c_api
* @addtogroup pe_header_c_api
* @brief Header C API
*
* @{
*/
#include "LIEF/visibility.h"
#ifdef __cplusplus
extern "C" {
#endif
enum LIEF_PE_MACHINE_TYPES {
LIEF_PE_MACHINE_UNKNOWN = 0x0,
LIEF_PE_MACHINE_AM33 = 0x1D3, /**< Matsushita AM33 */
LIEF_PE_MACHINE_AMD64 = 0x8664, /**< AMD x64 */
LIEF_PE_MACHINE_ARM = 0x1C0, /**< ARM little endian */
LIEF_PE_MACHINE_ARMNT = 0x1C4, /**< ARMv7 Thumb mode only */
LIEF_PE_MACHINE_ARM64 = 0xAA64, /**< ARMv8 in 64-bits mode */
LIEF_PE_MACHINE_EBC = 0xEBC, /**< EFI byte code */
LIEF_PE_MACHINE_I386 = 0x14C, /**< Intel 386 or later */
LIEF_PE_MACHINE_IA64 = 0x200, /**< Intel Itanium processor family */
LIEF_PE_MACHINE_M32R = 0x9041, /**< Mitsubishi M32R little endian */
LIEF_PE_MACHINE_MIPS16 = 0x266, /**< MIPS16 */
LIEF_PE_MACHINE_MIPSFPU = 0x366, /**< MIPS with FPU */
LIEF_PE_MACHINE_MIPSFPU16 = 0x466, /**< MIPS16 with FPU */
LIEF_PE_MACHINE_POWERPC = 0x1F0, /**< Power PC little endian */
LIEF_PE_MACHINE_POWERPCFP = 0x1F1, /**< Power PC with floating point */
LIEF_PE_MACHINE_R4000 = 0x166, /**< MIPS with little endian */
LIEF_PE_MACHINE_RISCV32 = 0x5032, /**< RISC-V 32-bit address space */
LIEF_PE_MACHINE_RISCV64 = 0x5064, /**< RISC-V 64-bit address space */
LIEF_PE_MACHINE_RISCV128 = 0x5128, /**< RISC-V 128-bit address space */
LIEF_PE_MACHINE_SH3 = 0x1A2, /**< Hitachi SH3 */
LIEF_PE_MACHINE_SH3DSP = 0x1A3, /**< Hitachi SH3 DSP */
LIEF_PE_MACHINE_SH4 = 0x1A6, /**< Hitachi SH4 */
LIEF_PE_MACHINE_SH5 = 0x1A8, /**< Hitachi SH5 */
LIEF_PE_MACHINE_THUMB = 0x1C2, /**< ARM or Thumb */
LIEF_PE_MACHINE_WCEMIPSV2 = 0x169 /**< MIPS little-endian WCE v2 */
};
enum LIEF_PE_HEADER_CHARACTERISTICS {
LIEF_PE_HEADER_CHARACTERISTICS_INVALID = 0x0000,
LIEF_PE_HEADER_CHARACTERISTICS_RELOCS_STRIPPED = 0x0001, /**< The file does not contain base relocations and must be loaded at its preferred base. If this cannot be done, the loader will error.*/
LIEF_PE_HEADER_CHARACTERISTICS_EXECUTABLE_IMAGE = 0x0002, /**< The file is valid and can be run.*/
LIEF_PE_HEADER_CHARACTERISTICS_LINE_NUMS_STRIPPED = 0x0004, /**< COFF line numbers have been stripped. This is deprecated and should be 0*/
LIEF_PE_HEADER_CHARACTERISTICS_LOCAL_SYMS_STRIPPED = 0x0008, /**< COFF symbol table entries for local symbols have been removed. This is deprecated and should be 0.*/
LIEF_PE_HEADER_CHARACTERISTICS_AGGRESSIVE_WS_TRIM = 0x0010, /**< Aggressively trim working set. This is deprecated and must be 0.*/
LIEF_PE_HEADER_CHARACTERISTICS_LARGE_ADDRESS_AWARE = 0x0020, /**< Image can handle > 2GiB addresses. */
LIEF_PE_HEADER_CHARACTERISTICS_BYTES_REVERSED_LO = 0x0080, /**< Little endian: the LSB precedes the MSB in memory. This is deprecated and should be 0.*/
LIEF_PE_HEADER_CHARACTERISTICS_32BIT_MACHINE = 0x0100, /**< Machine is based on a 32bit word architecture. */
LIEF_PE_HEADER_CHARACTERISTICS_DEBUG_STRIPPED = 0x0200, /**< Debugging info has been removed. */
LIEF_PE_HEADER_CHARACTERISTICS_REMOVABLE_RUN_FROM_SWAP = 0x0400, /**< If the image is on removable media, fully load it and copy it to swap. */
LIEF_PE_HEADER_CHARACTERISTICS_NET_RUN_FROM_SWAP = 0x0800, /**< If the image is on network media, fully load it and copy it to swap. */
LIEF_PE_HEADER_CHARACTERISTICS_SYSTEM = 0x1000, /**< The image file is a system file, not a user program.*/
LIEF_PE_HEADER_CHARACTERISTICS_DLL = 0x2000, /**< The image file is a DLL. */
LIEF_PE_HEADER_CHARACTERISTICS_UP_SYSTEM_ONLY = 0x4000, /**< This file should only be run on a uniprocessor machine. */
LIEF_PE_HEADER_CHARACTERISTICS_BYTES_REVERSED_HI = 0x8000 /**< Big endian: the MSB precedes the LSB in memory. This is deprecated */
};
struct Pe_Header_t {
uint8_t signature[4];
enum LIEF_PE_MACHINE_TYPES machine;
@@ -44,10 +84,11 @@ struct Pe_Header_t {
typedef struct Pe_Header_t Pe_Header_t;
LIEF_API const char* lief_pe_header_machine_str(enum LIEF_PE_MACHINE_TYPES e);
LIEF_API const char* lief_pe_header_characteristics_str(enum LIEF_PE_HEADER_CHARACTERISTICS e);
#ifdef __cplusplus
}
#endif
/** @} */
#endif
+2 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,6 @@
#include "LIEF/PE/enums.h"
#include "LIEF/PE/ImportEntry.h"
/** @defgroup pe_import_c_api Import
* @ingroup pe_c_api
* @addtogroup pe_import_c_api
* @brief Import C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,5 +41,4 @@ typedef struct Pe_Import_t Pe_Import_t;
}
#endif
/** @} */
#endif
+2 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,14 +22,6 @@
#include "LIEF/PE/enums.h"
/** @defgroup pe_import_entry_c_api Import Entry
* @ingroup pe_c_api
* @addtogroup pe_import_entry_c_api
* @brief Import Entry C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -52,5 +44,4 @@ typedef struct Pe_ImportEntry_t Pe_ImportEntry_t;
}
#endif
/** @} */
#endif
+37 -12
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,23 +13,48 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef C_LIEF_PE_OPTIONAL_HEADER_H_
#define C_LIEF_PE_OPTIONAL_HEADER_H_
#ifndef C_LIEF_PE_OPTIONAL_HEADER_H
#define C_LIEF_PE_OPTIONAL_HEADER_H
#include <inttypes.h>
#include "LIEF/PE/enums.h"
/** @defgroup pe_optional_header_c_api OptionalHeader
* @ingroup pe_c_api
* @addtogroup pe_optional_header_c_api
* @brief OptionalHeader C API
*
* @{
*/
#include "LIEF/visibility.h"
#ifdef __cplusplus
extern "C" {
#endif
enum LIEF_PE_DLL_CHARACTERISTICS {
LIEF_PE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020, /**< ASLR with 64 bit address space. */
LIEF_PE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040, /**< DLL can be relocated at load time. */
LIEF_PE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080, /**< Code integrity checks are enforced. */
LIEF_PE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100, /**< Image is NX compatible. */
LIEF_PE_DLL_CHARACTERISTICS_NO_ISOLATION = 0x0200, /**< Isolation aware, but do not isolate the image. */
LIEF_PE_DLL_CHARACTERISTICS_NO_SEH = 0x0400, /**< Does not use structured exception handling (SEH). No SEH handler may be called in this image. */
LIEF_PE_DLL_CHARACTERISTICS_NO_BIND = 0x0800, /**< Do not bind the image. */
LIEF_PE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000, /**< Image should execute in an AppContainer. */
LIEF_PE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000, /**< A WDM driver. */
LIEF_PE_DLL_CHARACTERISTICS_GUARD_CF = 0x4000, /**< Image supports Control Flow Guard. */
LIEF_PE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000 /**< Terminal Server aware. */
};
enum LIEF_PE_SUBSYSTEM {
LIEF_PE_SUBSYSTEM_UNKNOWN = 0, /**< An unknown subsystem. */
LIEF_PE_SUBSYSTEM_NATIVE = 1, /**< Device drivers and native Windows processes */
LIEF_PE_SUBSYSTEM_WINDOWS_GUI = 2, /**< The Windows GUI subsystem. */
LIEF_PE_SUBSYSTEM_WINDOWS_CUI = 3, /**< The Windows character subsystem. */
LIEF_PE_SUBSYSTEM_OS2_CUI = 5, /**< The OS/2 character subsytem. */
LIEF_PE_SUBSYSTEM_POSIX_CUI = 7, /**< The POSIX character subsystem. */
LIEF_PE_SUBSYSTEM_NATIVE_WINDOWS = 8, /**< Native Windows 9x driver. */
LIEF_PE_SUBSYSTEM_WINDOWS_CE_GUI = 9, /**< Windows CE. */
LIEF_PE_SUBSYSTEM_EFI_APPLICATION = 10, /**< An EFI application. */
LIEF_PE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, /**< An EFI driver with boot services. */
LIEF_PE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, /**< An EFI driver with run-time services. */
LIEF_PE_SUBSYSTEM_EFI_ROM = 13, /**< An EFI ROM image. */
LIEF_PE_SUBSYSTEM_XBOX = 14, /**< XBOX. */
LIEF_PE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 /**< A BCD application. */
};
struct Pe_OptionalHeader_t {
enum LIEF_PE_PE_TYPES magic;
uint8_t major_linker_version;
@@ -65,10 +90,10 @@ struct Pe_OptionalHeader_t {
typedef struct Pe_OptionalHeader_t Pe_OptionalHeader_t;
LIEF_API const char* lief_pe_subsytem_str(enum LIEF_PE_SUBSYSTEM e);
#ifdef __cplusplus
}
#endif
/** @} */
#endif
+41 -11
View File
@@ -1,5 +1,5 @@
/* Copyright 2017 - 2023 R. Thomas
* Copyright 2017 - 2023 Quarkslab
/* Copyright 2017 - 2024 R. Thomas
* Copyright 2017 - 2024 Quarkslab
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,18 +19,50 @@
#include <inttypes.h>
#include "LIEF/PE/enums.h"
/** @defgroup pe_section_c_api Section
* @ingroup pe_c_api
* @addtogroup pe_section_c_api
* @brief Section C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
enum LIEF_PE_SECTION_CHARACTERISTICS {
LIEF_PE_SECTION_CHARACTERISTICS_TYPE_NO_PAD = 0x00000008,
LIEF_PE_SECTION_CHARACTERISTICS_CNT_CODE = 0x00000020,
LIEF_PE_SECTION_CHARACTERISTICS_CNT_INITIALIZED_DATA = 0x00000040,
LIEF_PE_SECTION_CHARACTERISTICS_CNT_UNINITIALIZED_DATA = 0x00000080,
LIEF_PE_SECTION_CHARACTERISTICS_LNK_OTHER = 0x00000100,
LIEF_PE_SECTION_CHARACTERISTICS_LNK_INFO = 0x00000200,
LIEF_PE_SECTION_CHARACTERISTICS_LNK_REMOVE = 0x00000800,
LIEF_PE_SECTION_CHARACTERISTICS_LNK_COMDAT = 0x00001000,
LIEF_PE_SECTION_CHARACTERISTICS_GPREL = 0x00008000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_PURGEABLE = 0x00010000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_16BIT = 0x00020000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_LOCKED = 0x00040000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_PRELOAD = 0x00080000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_1BYTES = 0x00100000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_2BYTES = 0x00200000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_4BYTES = 0x00300000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_8BYTES = 0x00400000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_16BYTES = 0x00500000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_32BYTES = 0x00600000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_64BYTES = 0x00700000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_128BYTES = 0x00800000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_256BYTES = 0x00900000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_512BYTES = 0x00A00000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_1024BYTES = 0x00B00000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_2048BYTES = 0x00C00000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_4096BYTES = 0x00D00000,
LIEF_PE_SECTION_CHARACTERISTICS_ALIGN_8192BYTES = 0x00E00000,
LIEF_PE_SECTION_CHARACTERISTICS_LNK_NRELOC_OVFL = 0x01000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_DISCARDABLE = 0x02000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_NOT_CACHED = 0x04000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_NOT_PAGED = 0x08000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_SHARED = 0x10000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_EXECUTE = 0x20000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_READ = 0x40000000,
LIEF_PE_SECTION_CHARACTERISTICS_MEM_WRITE = 0x80000000
};
struct Pe_Section_t {
const char* name;
uint64_t virtual_address;
@@ -50,10 +82,8 @@ struct Pe_Section_t {
typedef struct Pe_Section_t Pe_Section_t;
#ifdef __cplusplus
}
#endif
/** @} */
#endif
+1
View File
@@ -16,6 +16,7 @@ extern "C" {
#undef _LIEF_EN_2
#undef _LIEF_EI
#ifdef __cplusplus
}
#endif
Loaded 100 of 1812 files, more files were not shown because too many files have changed in this diff. Show more