Compare commits

...
583 Commits
Author SHA1 Message Date
Romain Thomas d4900dab6a Bump version 2025-01-01 15:33:56 +01:00
Romain Thomas 564b5e36bd Update changelog 2024-12-26 18:15:26 +01:00
Saikari 0c39baf6ef Fix missing headers (#1143) 2024-12-23 07:30:33 +01:00
Romain Thomas 75a27f0e8d Change autocxx-build version to 0.27.0
The minimal Rust version for the bindings is `1.74.0`.
Recently, the `home` [^1] package raised its minimal supported rust version
to `v1.81.0` which breaks our min-rust requirement.

Before this commit, `lief-ffigen` was depending on this package via the
following dependency tree:

```
lief-ffigen v0.17.0 (/src/api/rust/cargo/lief-ffigen)
├── autocxx-build v0.26.0
│   ├── autocxx-engine v0.26.0
│   │   ├── autocxx-bindgen v0.65.1
│   │   │   └── which v4.4.2
│   │   │       └── home v0.5.11
```

It turns out that `which` is no longer a dependency of `autocxx-bindgen`
since this commit: c03964c0257b03ad4762b57f3ffb96d32d49c0ce[^2].

This commit is part of the `0.27.0` release of `autocxx-engine`.

[^1]: https://crates.io/crates/home
[^2]: https://github.com/adetaylor/rust-bindgen/commit/c03964c0257b03ad4762b57f3ffb96d32d49c0ce
2024-12-21 06:24:49 +01:00
Richard Dzenis cf6e59c2bd MachO::Binary: treat all sections in the same way during shift (#1134)
Previously there were exceptions for zerofill sections because offset
checks were not correct. After fixing checks for offsets/va, special
handling of zerofill sections is no longer needed.
2024-12-21 06:24:40 +01:00
bbe03e7fcb MachO::Binary::shift_command: fix exports of dyld (#1133)
* MachO::Binary::shift_command: fix shift of dyld exports

Despite the field name `address` it stores a file offset.

Co-authored-by: Richard Dzenis <rdzenis@whitecryption.com>

* MachO::Binary::shift_command: fix comparison in DyldExportsTrie update

`ExportInfo` is meant to be updated if `info.address()` is beyond the
point where shift happens; however, offset comparison was reversed.

Additionally, compare with `from_offset`, because despite the field name
`address` it stores a file offset.

Co-authored-by: Richard Dzenis <rdzenis@whitecryption.com>

* Add macho/test_exports_after_shift

This test checks that exports in dyld_info are shifted correctly.

* Add macho/test_chained_exports_after_shift

This test checks that exports in dyld_exports_trie
are shifted correctly.

---------

Co-authored-by: Peteris Ledins <peteris.ledins@zimperium.com>
Co-authored-by: Javier Lopez-Gomez <javier.lopez-gomez@zimperium.com>
2024-12-21 06:24:25 +01:00
Romain Thomas 4b1c25e094 Don't fail on a .x versioning 2024-12-12 21:05:51 +01:00
e557086089 Fix MachO::Binary::shift_command (#1131)
* Fix MachO::Binary::shift_command virtual_address

Function argument `from_offset` is a file offset that we need to adjust
before adding to VA of segment.

Co-authored-by: Richard Dzenis <rdzenis@whitecryption.com>

* Fix symbols shift in MachO::Binary::shift_command

Fix adjustments of symbols: their values should be compared
to VA instead of file offset.

Co-authored-by: Richard Dzenis <rdzenis@whitecryption.com>

* Add test for shift of symbols in MachO

* Cleanup tests/macho/test_symbols.py

---------

Co-authored-by: Uldis Kalnins <ukalnins@whitecryption.com>
Co-authored-by: Romain Thomas <me@romainthomas.fr>
2024-12-12 20:51:11 +01:00
Richard Dzenis 2239937afb MachO::Binary::remove(Symbol): search symbol by ptr instead of name
The previous implementation was searching symbol by name, due to this it
could delete other symbol with the same name, instead of `sym` that was
passed to the function.
2024-12-11 18:17:08 +01:00
a9b7bf23de Update segment offsets in MachO::Binary::extend_segment (#1132)
* Update segment offsets in MachO::Binary::extend_segment

Co-authored-by: Richard Dzenis <rdzenis@whitecryption.com>

* Add test to check MachO::Binary::offset_seg_ cache is updated

---------

Co-authored-by: Uldis Kalnins <ukalnins@whitecryption.com>
2024-12-11 18:07:16 +01:00
Uwe L. Korn 90647ac131 Move destructor of ChainedBindingInfo out of the header 2024-12-11 18:01:11 +01:00
Romain Thomas e01f92a06c Fix missing visibility 2024-12-11 11:11:18 +01:00
Romain Thomas 52d9567115 Update changelog 2024-12-10 20:49:50 +01:00
Romain Thomas 6f084e8452 Fix missing write() API 2024-12-10 20:22:54 +01:00
Romain Thomas ba3b16ca6d Resolve #1138 2024-12-10 18:32:57 +01:00
Romain Thomas 55baebb815 Nightly only 2024-12-10 16:44:53 +01:00
Romain Thomas e9e7ed2675 Make sure the documentation is aware of env variables 2024-12-10 15:21:31 +01:00
Romain Thomas 441bb4620b Bump version 2024-12-10 10:58:04 +01:00
Romain Thomas 793657de4a Update doc 2024-12-10 10:51:47 +01:00
Romain Thomas 0ff950c080 Update nanobind 2024-12-10 05:30:37 +01:00
Romain Thomas e54ef047c5 Update README 2024-12-09 20:57:40 +01:00
Romain Thomas 11c4d4de16 Add bindings to add a Mach-O library 2024-12-09 18:24:51 +01:00
Romain Thomas 9448caf756 Rust: Add add_library for ELF binaries 2024-12-09 17:18:29 +01:00
Romain Thomas a11b1b72a9 Expose write() operation in Rust 2024-12-09 16:58:29 +01:00
Romain Thomas f7171b620f Update README 2024-12-09 16:57:36 +01:00
Romain Thomas c84c8f04f9 Add --force-reinstall flag 2024-12-09 16:27:47 +01:00
Romain Thomas 52a5d5dcc9 Additional fixes for #1130 2024-12-09 16:18:59 +01:00
Romain Thomas f1b35862c8 Make sure segment's offset is not null when refreshing cache
Related to #1130
2024-12-09 14:46:50 +01:00
Romain Thomas bd6f6272a5 Resolve #1130 2024-12-09 11:59:14 +01:00
Romain Thomas b5df89fbd6 Update discord link 2024-12-09 10:46:36 +01:00
Romain Thomas 68caa323ea Reduce binary size while adding segments or relocating PHDR
Commit based on the work of @Miniman2718

Resolve: #1085
2024-12-09 05:46:17 +01:00
Romain Thomas 426b2406bb Fix wording 2024-12-08 21:00:12 +01:00
Romain Thomas 7ebe5fd8cf Update doc 2024-12-08 20:46:03 +01:00
Romain Thomas 68fa8898fb Add support for user-provided flags 2024-12-08 13:42:51 +01:00
Romain Thomas 28552b543b Disable AESNI for x86 target 2024-12-08 09:47:44 +01:00
Romain Thomas deffb40fab Cleanup GHA 2024-12-08 08:18:28 +01:00
Romain Thomas 5aa3d72c09 Add aarch64 testing 2024-12-08 05:16:35 +01:00
Romain Thomas 9c0c01a7bc Add LLVM version 2024-12-07 20:36:22 +01:00
Romain Thomas 40245aef53 Disable test 2024-12-07 19:34:51 +01:00
Romain Thomas e1bd74698e Expose llvm::MCInst as a (forwarded) reference 2024-12-07 18:51:22 +01:00
Romain Thomas c1a7332233 Add support for AArch64 operands 2024-12-07 18:27:27 +01:00
Romain Thomas 8dc62e85e7 Remove beta notice 2024-12-07 09:14:16 +01:00
Romain Thomas 8d244837cf Add LLVM PR 2024-12-07 07:58:08 +01:00
Romain Thomas 69d777e4c0 Add support for x86/x86-64 operands 2024-12-07 06:01:28 +01:00
Romain Thomas 917a118769 Fix documentation 2024-12-07 05:41:44 +01:00
Romain Thomas fbe2640c44 Disable code-check 2024-11-30 09:21:47 +01:00
Romain Thomas de58725db9 Initial assembler 2024-11-30 07:54:08 +01:00
Romain Thomas 7c1d66da6e Disable doc 2024-11-30 07:48:16 +01:00
Romain Thomas fd7f68258e Fix GHA test 2024-11-30 07:02:51 +01:00
Romain Thomas 1e7b4beb00 Minor updates 2024-11-30 05:40:00 +01:00
Romain Thomas de49dceba9 Update nanobind
Resolve: #1128
2024-11-30 05:30:21 +01:00
Romain Thomas b0366b3388 Add support to send metrics 2024-11-30 05:01:14 +01:00
Romain Thomas efd36faa80 Avoid (auto)generating opcodes 2024-11-23 10:12:07 +01:00
Kursat Aktas 56dab60d5a Introducing LIEF Guru on Gurubase.io
Signed-off-by: Kursat Aktas <kursat.ce@gmail.com>
2024-11-23 08:08:33 +01:00
Romain Thomas 6d88ded3da Fix type 2024-11-23 07:46:40 +01:00
Romain Thomas 102a6171a7 Some updates 2024-11-23 07:45:56 +01:00
Romain Thomas dacd4cd1f5 Fix symbol visibility 2024-11-23 07:32:03 +01:00
Romain Thomas 33a8e16976 Improve disassembler support 2024-11-23 07:31:41 +01:00
Romain Thomas d75f90d8dd Update doc 2024-11-23 06:58:33 +01:00
Romain Thomas a07a8b83d2 Update tests 2024-11-23 06:58:32 +01:00
Romain Thomas 4e8838a5a7 Improve the documentation 2024-11-23 06:56:34 +01:00
Romain Thomas 313343b681 Add extended version helper 2024-11-23 06:15:39 +01:00
Romain Thomas a2100f9aeb Update typing 2024-11-23 05:47:09 +01:00
Romain Thomas 8b8b84d180 Add support to disassemble DWARF Function 2024-11-23 05:46:27 +01:00
Romain Thomas fb86a0a103 Add default constructor 2024-11-23 05:33:26 +01:00
Romain Thomas c58b8dbf09 Update tests 2024-11-23 05:30:25 +01:00
Romain Thomas b4c96c41c1 Export LIEF_CORE_EXTENDED to know whether this is an extended build 2024-11-23 04:36:14 +01:00
Romain Thomas 590eb2626f Fix visibility 2024-11-17 19:51:10 +01:00
Romain Thomas 7b6f8484ee Fix typo 2024-11-17 12:20:19 +01:00
Romain Thomas e573911098 Fix memleak 2024-11-17 06:29:16 +01:00
Romain Thomas 4479894a07 Lint code 2024-11-17 04:58:12 +01:00
Romain Thomas b63dca262f Add nanobind custom type caster for LIEF::span 2024-11-16 18:35:35 +01:00
Romain Thomas 36106937d1 Fix with normalize_path 2024-11-16 12:22:09 +01:00
Romain Thomas ca6ddf5cdd Enhance DWARF types support 2024-11-16 10:16:16 +01:00
Romain Thomas ca485c3921 Return an empty stream when the size is 0 2024-11-16 09:12:30 +01:00
Romain Thomas c796782a1f Fix visibility 2024-11-10 20:30:29 +01:00
Romain Thomas 5fc182b1d5 Update changelog 2024-11-10 10:04:52 +01:00
Jevin Sweval e81ae09f77 Fix ELF/MachO to point empty symbol names to offet 0, required to be NUL
ELF/MachO symtab entries with NUL name should use zero offset into strtab
2024-11-10 10:02:26 +01:00
Romain Thomas ccd41bb820 Remove C enums 2024-11-09 16:15:08 +01:00
Philippe Ombredanne b06aa7ae7b Fix minor typo (#1122)
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
2024-11-09 09:22:47 +01:00
Romain Thomas 7a4291bcf1 Improve relocation support 2024-11-09 06:30:58 +01:00
Romain Thomas 94aa4db095 Explicitly specify index.html 2024-11-09 06:02:02 +01:00
Romain Thomas 3f233e5a95 Add support for eBPF relocations 2024-11-09 06:01:04 +01:00
Romain Thomas c6a6471cbf Clean object relocation processing 2024-11-09 05:39:58 +01:00
Romain Thomas 72e7f8178c Add get_section_idx helpers 2024-11-09 05:23:15 +01:00
Romain Thomas 3e951ba3f7 Update documentation 2024-11-09 05:06:01 +01:00
Romain Thomas 86c2d48512 Update tests 2024-11-09 05:05:38 +01:00
Romain Thomas a0ffe4592b Fix missing attribute 2024-11-09 05:01:20 +01:00
Romain Thomas 5cf93ae26d Add DWARF support for DW_TAG_typedef support 2024-11-09 04:59:44 +01:00
Romain Thomas f2c54ee5cf Add DWARF imported function iterator 2024-11-09 04:55:27 +01:00
Romain Thomas 89ad5b378a Add DWARF is_external API (matching DW_AT_external) 2024-11-09 04:48:28 +01:00
Romain Thomas 445083677d Add comment 2024-11-03 18:06:24 +01:00
Romain Thomas d3ae4debe7 Code cleaning 2024-11-02 18:04:28 +01:00
Romain Thomas f7a127eac3 Initial disassembler support 2024-11-02 16:42:41 +01:00
Romain Thomas 86e1769fb0 Enable creating a RPathCommand
Resolve #1078
2024-11-02 10:47:50 +01:00
Romain Thomas ee4e12a442 Make sure project() is at the top 2024-11-01 06:45:19 +01:00
Romain Thomas 699ae7ed96 Change Doxygen comment style 2024-11-01 06:45:19 +01:00
Romain Thomas 8c7b2911a3 Rust ELF enhancement 2024-11-01 06:45:19 +01:00
Romain Thomas 0f8bea0275 Enhance logging API 2024-11-01 06:45:19 +01:00
Romain Thomas 0459322666 Resolve #1121 2024-11-01 06:45:19 +01:00
Romain Thomas ccaca6028b Update documentation 2024-11-01 06:45:19 +01:00
Romain Thomas 94d0e05697 Fix ordinal check error
Credit: @kkent030315 m4b/goblin#428
2024-11-01 06:33:18 +01:00
Romain Thomas e81492631f Silent warning when accessing entrypoint for abstraction 2024-11-01 06:17:42 +01:00
Romain Thomas 0120636b12 Better PPC/PPC64 support for the LC_THREAD_COMMAND 2024-11-01 06:15:52 +01:00
Romain Thomas 19dd162314 Add RISC-V processor flags 2024-11-01 06:01:26 +01:00
Romain Thomas f00553ec14 Add C-SKY architecture 2024-11-01 05:58:37 +01:00
Romain Thomas 538b6a5ebf Add support for x86_64-unknown-linux-musl Rust target 2024-10-27 12:54:44 +01:00
Romain Thomas 27be4e6b2d Add support for GNU_PROPERTY_AARCH64_FEATURE_PAUTH 2024-10-26 15:46:14 +02:00
Romain Thomas 086c49fb7a Add is_targeting_android to determine if an ELF targets Android 2024-10-26 08:48:08 +02:00
Emmanuel FerdmanandRomain Thomas ec233a499f Update authenticode reader reference (#1120)
* Fix memory issues raised by GHSA-xpwf-7qj6-m6r4 & GHSA-c2f3-2xpq-pjj9

* Update authenticode reader reference

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

---------

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
Co-authored-by: Romain Thomas <me@romainthomas.fr>
2024-10-26 06:15:53 +02:00
Romain Thomas 7908c18a72 Fix visibility 2024-10-26 06:11:57 +02:00
Romain Thomas 42207c97ed Lower C++ standard 2024-10-26 06:10:46 +02:00
Romain Thomas 11b5d7ce9e Rust: lower minimal Linux requirement 2024-10-26 06:01:45 +02:00
Romain Thomas 4cc1dd26be Refactor and clean code in LIEF's abstract layer
Resolve #1119
2024-10-26 05:36:49 +02:00
Romain Thomas 8784fb5aa5 Refactor LIEF's Abstract Function 2024-10-26 05:03:52 +02:00
Romain Thomas c56dfab748 Fix memory issues raised by GHSA-xpwf-7qj6-m6r4 & GHSA-c2f3-2xpq-pjj9 2024-10-20 15:36:18 +02:00
Romain Thomas 7559d2d0e8 Update changelog 2024-10-19 16:50:09 +02:00
Romain Thomas 864bf8180c Update links 2024-10-19 16:45:44 +02:00
Romain Thomas b8e7216f1f Move Android formats doc in an Android/ dedicated section 2024-10-19 06:30:28 +02:00
Romain Thomas 442fb46395 Initial support for Apple's dyld shared cache 2024-10-19 06:29:24 +02:00
Romain Thomas 91a4710fc5 Make sure nlohmann/json is only using C++11 standard 2024-10-19 05:11:29 +02:00
Romain Thomas 07b3241fe1 Improve objc support
- Add `LIEF::objc::DeclOpt` to tweak the generated output
- Add `objc::Class:to_decl` & `objc::Class::to_decl`
- Improve the documentation
- Fix issue with Small method address
2024-10-19 04:45:13 +02:00
Romain Thomas b6de8801b2 Improve documentation 2024-10-19 04:39:01 +02:00
Romain Thomas e45dfb71bb Fix infinite loop while processing PE resource tree
Resolve #1115
2024-10-12 20:47:51 +02:00
Romain Thomas e98d6e7d0a #1114 follow up 2024-10-12 06:31:57 +02:00
Romain Thomas 17b86f8b37 Make sure the Mach-O parsing depth matches C++
Resolve #1114
2024-10-08 05:10:39 +02:00
Romain Thomas 11f65a051e Cleanup 2024-10-07 21:15:34 +02:00
Romain Thomas 6cdc09388c Make sure the pos does not change
Resolve #1113
2024-10-07 21:12:25 +02:00
Romain Thomas 0dc889591e Fix missing quotes 2024-10-06 13:29:09 +02:00
Romain Thomas 1090999cc0 Update README 2024-10-06 13:27:44 +02:00
Romain Thomas ba294bd181 Make sure we have a correct visibility 2024-10-05 05:49:38 +02:00
Romain Thomas b11bc1ebd2 Add rustls-tls to the changelog 2024-10-05 05:33:20 +02:00
Romain Thomas 6dfe3870a7 Fix link 2024-10-05 05:31:49 +02:00
Romain Thomas a3f034d767 Fix clash with Windows's header #define 2024-10-05 05:29:00 +02:00
Romain Thomas 3def579f75 Add support for creating and analyzing chained fixups & bindings 2024-10-05 05:23:39 +02:00
Romain Thomas 78dec19bbd Add method to accept a std::unique_ptr 2024-10-05 04:49:42 +02:00
Romain Thomas 8d65798590 Define CPU_SUBTYPE_ARM64E into the Header object 2024-10-05 04:39:39 +02:00
Romain Thomas 4fb6145bd3 Fix missing operator= 2024-10-05 04:24:43 +02:00
Romain Thomas d0fb24a2a8 Fix typo 2024-10-05 04:19:32 +02:00
Romain Thomas 0127c29e09 Fix scope 2024-10-05 04:18:52 +02:00
Romain Thomas f8d30efa17 Remove unused header 2024-10-05 04:16:19 +02:00
Romain Thomas e4f23d14d3 Fix Mach-O endianness support (resolve #1110) 2024-09-29 11:12:11 +02:00
Romain Thomas cf14dae8a8 Update spdlog 2024-09-28 18:30:16 +02:00
Romain Thomas 0913977621 Fix error from 201a87e25c 2024-09-28 18:30:15 +02:00
Romain Thomas 0f4ed10aba Fix logging 2024-09-28 18:30:10 +02:00
Manuel Zabelt b8b2ae0b02 Adjusted authenticode_reader.py to use Attribute.TYPE instead of SIG_ATTRIBUTE_TYPES (#1111)
Inspired by this change: 8dd8a255a8
2024-09-28 06:19:15 +02:00
Romain Thomas 0fa2d49924 Update logging interface 2024-09-28 06:13:38 +02:00
Romain Thomas 68f51a7708 Improve virtual_size computation 2024-09-28 04:52:34 +02:00
Romain Thomas a526c52233 Fix missing ostream 2024-09-21 07:41:18 +02:00
Mike Nawrocki 165b9f6535 Python: mark add_relocation return value reference (#1108)
Makes the return value from the PE::Binary add_relocation method an
internal reference.
2024-09-21 07:18:12 +02:00
Romain Thomas 388fc5e46f Fix missing relationship between Mach-O's symbol & libraries 2024-09-21 07:15:49 +02:00
Romain Thomas 77c633cc22 Add missing bindings 2024-09-21 07:13:46 +02:00
Romain Thomas 7115533c1e Fix va_ranges issue 2024-09-21 06:32:44 +02:00
Romain Thomas 3cca7ba4b2 Add cast helpers 2024-09-21 06:32:40 +02:00
Romain Thomas 144e5fe76d Resolve #1107 2024-09-19 11:50:07 +02:00
Romain Thomas 201a87e25c Disable mbedtls platform entropy 2024-09-19 11:47:14 +02:00
HuntragonandRadu Bloch 2b5a5eb339 Add rustls-tls feature to reqwest (#1105)
Co-authored-by: Radu Bloch <radu.bloch@n3uron.com>
2024-09-19 11:23:50 +02:00
Mike Nawrocki 53ea6eae0b Python: mark add_entry return value as reference (#1106)
Makes the return value from the PE::Reference add_entry method an
internal reference.
2024-09-19 11:17:30 +02:00
Romain Thomas 5c1f3613cb More values for BuildVersion::PLATFORMS 2024-09-19 10:43:26 +02:00
Romain Thomas 544332db2c Add helpers to determine the platform targeted by a Mach-O 2024-09-19 10:35:42 +02:00
Romain Thomas 33276acad7 Fix bound checking 2024-09-19 10:21:40 +02:00
Romain Thomas 06df59cefe Fix PKCS#1 1.5 padding (resolve #1101) 2024-09-19 10:20:16 +02:00
Romain Thomas ca0b20aa74 Shrink final buffer 2024-09-19 09:48:50 +02:00
Romain Thomas c8cc69c77e Make sure we support buffer larger than 1000.
See: https://github.com/python/cpython/blob/453da532fee26dc4f83d4cab77eb9bdb17b941e6/Python/sysmodule.c#L4001
2024-09-19 09:44:49 +02:00
Romain Thomas d1906ad2d5 Upgrade MbedTLS from 3.2.1 to 3.6.1 2024-09-19 09:18:36 +02:00
Romain Thomas 02327492c8 Fix test 2024-09-14 08:22:43 +02:00
Romain Thomas 94adbf5f2a Fix types (from #1100) 2024-09-14 08:07:29 +02:00
Romain Thomas e5285687d0 Only print warning if the original is not 0 2024-09-14 08:05:37 +02:00
ShallowFeatherandRomain Thomas dbc9d9f9fa Fix type (#1100)
Fix the function type of security_cookie

Co-authored-by: Romain Thomas <7450402+romainthomas@users.noreply.github.com>
2024-09-14 07:30:36 +02:00
Romain Thomas bf931df303 Fix error when rewriting an ELF with DT_RELR relocations 2024-09-14 06:31:20 +02:00
Romain Thomas cd81ed3ba6 Add get_int_from_virtual_address in the abstract layer 2024-09-14 05:57:08 +02:00
Romain Thomas 1bcd416433 Update log message 2024-09-14 05:30:07 +02:00
Romain Thomas 27261eb427 Make sure the pointer is valid when accessing the array 2024-09-14 05:11:01 +02:00
Romain Thomas 3581c8e3bf Add helper to check the permission 2024-09-14 05:10:57 +02:00
Romain Thomas 155febcb77 Expose the chained's next value 2024-09-14 05:01:01 +02:00
Romain Thomas 24c3295a4c Use chain_address 2024-09-14 04:40:22 +02:00
Romain Thomas f3abf22971 Fix support for 'weird' layout 2024-09-14 04:36:54 +02:00
Romain Thomas fa41703c1a Add payload helper to access the raw content of the command 2024-09-14 04:23:18 +02:00
Romain Thomas fae9ae78d6 Add slice/to_vector helpers 2024-09-08 14:48:20 +02:00
Romain Thomas e8811ec19f Fix error 2024-09-08 14:41:30 +02:00
Romain Thomas f27947b8e0 Resolve #1097 2024-09-07 06:20:43 +02:00
Romain Thomas 8da28da98e Fix enum class error 2024-09-07 05:40:55 +02:00
Romain Thomas 6a40c07614 Add 'contains' helper 2024-09-07 05:36:52 +02:00
Romain Thomas 48cf0dbd41 Fix typo 2024-09-07 05:30:49 +02:00
Romain Thomas c59a66ade1 Add stream interface for sections/segments 2024-09-07 05:23:06 +02:00
Romain Thomas 3ee28a5079 Allow SpanStream to be copyable 2024-09-07 05:15:39 +02:00
Romain Thomas 92305cfa2c Use stride 2024-09-07 04:49:45 +02:00
Romain Thomas 77330160ea Fallback on the virtual address if the offset is corrupted 2024-09-07 04:31:54 +02:00
Romain Thomas 39b21e4319 Add NONE entry 2024-09-01 14:18:11 +02:00
Romain Thomas 8a32bcb963 Add operator== / operator!= 2024-08-31 19:15:28 +02:00
Romain Thomas c31361c188 Add test case for #1090 2024-08-31 18:10:08 +02:00
Romain Thomas 5584fdf129 Fix error 2024-08-31 10:19:04 +02:00
Romain Thomas 88cadfdb3b Fix new line 2024-08-31 10:01:07 +02:00
Romain Thomas d574f58004 Update position 2024-08-31 09:53:43 +02:00
Aiden-Isik 93e2e65a6f Add PowerPC Big Endian 0x1F2 (found on Xbox 360) (#1090) 2024-08-31 09:25:22 +02:00
Romain Thomas 2001d8c9b7 Resolve #1093 2024-08-31 09:19:27 +02:00
Romain Thomas 9b2bd35380 Add move constructor 2024-08-31 07:40:14 +02:00
Romain Thomas 0e04b4a44e Fix doc 2024-08-31 07:36:25 +02:00
Romain Thomas 993f24bdc1 Add Mach-O symbol stubs iterator 2024-08-31 07:35:26 +02:00
Romain Thomas 990dbcaa77 Fix typo 2024-08-31 07:07:01 +02:00
Romain Thomas 5915877834 Add require_extended_version error type 2024-08-31 07:06:47 +02:00
Romain Thomas 32b5234cf9 Perfect forwarding compliance 2024-08-31 07:04:03 +02:00
Romain Thomas 0ff2f093c0 Enhance demangling support (especially with LIEF extended) 2024-08-31 07:01:05 +02:00
Romain Thomas e31dfeb3cc Support for C++20 2024-08-31 06:00:08 +02:00
Romain Thomas 5e70549e0f Support parsing commands from a different binary stream 2024-08-31 05:51:58 +02:00
Romain Thomas 1921d282aa Remove new line 2024-08-31 05:14:42 +02:00
Romain Thomas 222a160cf5 Add the attribute from_dyld_shared_cache 2024-08-31 05:13:36 +02:00
Romain Thomas 81f8792e8c Remove unused variables 2024-08-31 05:11:22 +02:00
Romain Thomas d28e879ad3 Fix support for Mach-O indirect symbols indexed with 0xc0000000 (LOCAL and ABS) 2024-08-31 05:10:36 +02:00
Romain Thomas ce0ba58a54 Add function to read *objects* into vector 2024-08-31 04:59:34 +02:00
Romain Thomas eeebbaf819 Remove unwanted new lines 2024-08-31 04:47:36 +02:00
Romain Thomas 0ad4b8c5c0 Use the space given by the PE's FileAlignment
Resolve #1088
2024-08-25 14:02:53 +02:00
Romain Thomas ecbedb4d09 Resolve: #1089 2024-08-24 15:57:32 +02:00
Romain Thomas 47d707f3a5 Fix missing include 2024-08-24 09:43:02 +02:00
Romain Thomas d7e7fcce18 Fix typo 2024-08-24 08:17:29 +02:00
Romain Thomas b39d4e330e Fix missing <string> header 2024-08-24 08:11:26 +02:00
Romain Thomas ea4a6b299f Add support for binding operation infered from indirect symbol table 2024-08-24 07:30:25 +02:00
Romain Thomas 62929828ce Expose a bindings iterator 2024-08-24 07:01:27 +02:00
Romain Thomas 5c21a22cde Fix missing header guard 2024-08-24 06:04:21 +02:00
Romain Thomas bc31ee5dce Expose an iterator over the indirect symbols located in DynamicSymbolCommand 2024-08-24 06:02:46 +02:00
Romain Thomas 7bd0c8aa6f Resolve #1087 2024-08-24 05:45:06 +02:00
Romain Thomas cd7a7e1240 Fix function 2024-08-24 05:33:58 +02:00
Romain Thomas 01867d52ed Update parsing trie function to support a BinaryStream as input 2024-08-24 05:23:11 +02:00
Romain Thomas 2de226dcd9 Expose function to add a symbol 2024-08-24 04:56:56 +02:00
Romain Thomas 919c52597f Improve output 2024-08-24 04:46:37 +02:00
Romain Thomas f979004437 Resolve #1086 2024-08-24 04:44:44 +02:00
Romain Thomas 932f58cbf4 Add virtual address info so that content can be read from VA (or offset) 2024-08-24 04:30:29 +02:00
Romain Thomas ce3ff3f573 Update layout & comments 2024-08-18 12:54:24 +02:00
Romain Thomas b267a99cb8 Update LIEF Python package README 2024-08-18 12:34:38 +02:00
Romain Thomas de60b62424 Update changelog 2024-08-17 18:00:23 +02:00
Romain Thomas beb49468ff Fix OSX version 2024-08-17 14:03:32 +02:00
Romain Thomas 7c3b4a3f9f Add demangle utility (resolve: #1054) 2024-08-17 05:30:57 +02:00
Romain Thomas f864b71d02 Cleanup utils.hpp header 2024-08-17 05:03:25 +02:00
Romain Thomas ab85865f27 Improve support for RISC-V architecture
Resolve: #1082
2024-08-17 04:57:30 +02:00
Peter Meerwald-Stadler 42df4964f0 Fix some more typos (#1084) 2024-08-02 21:28:08 +02:00
Peter Meerwald-Stadler b29613f4e9 Fix some typos in the PE Authenticode tutorial (#1083) 2024-08-02 21:27:00 +02:00
Romain Thomas 24d48ad0b5 Fix Mach-O issue 2024-07-27 21:01:04 +02:00
f4bf30dfbc Support new Dynamic tags for X86_64 (#1081)
* Add new X86_64 specific Dynamic Tag

See https://sourceware.org/git/?p=glibc.git;a=commit;h=848746e88ec2aa22e8dea25f2110e2b2c59c712e

* Add missing Dynamic Tag in C api

---------

Co-authored-by: Romain Thomas <me@romainthomas.fr>
Co-authored-by: Romain Thomas <7450402+romainthomas@users.noreply.github.com>
2024-07-27 11:00:43 +02:00
f954c50e74 Fix header when compile with LIEF_EXTERNAL_SPDLOG=ON (#1080)
* Fix header when compile with LIEF_EXTERNAL_SPDLOG

The header <algorithm> can be missing and std::remove_if may not be found
in DynamicEntryArray.cpp and DynamicEntryRunPath.cpp.
This is the case when compiled with LIEF_EXTERNAL_SPDLOG=ON
and fetch spdlog using FetchContent with the option OVERRIDE_FIND_PACKAGE.

---------

Co-authored-by: Romain Thomas <me@romainthomas.fr>
Co-authored-by: Romain Thomas <7450402+romainthomas@users.noreply.github.com>
2024-07-27 10:59:10 +02:00
Romain Thomas 9673580c5a Fix formatting 2024-07-27 10:54:37 +02:00
Romain Thomas dfb67f2a2d Cleanup Mach-O build engine 2024-07-27 07:49:34 +02:00
Romain Thomas ff72aa9242 Fix warnings 2024-07-27 05:31:44 +02:00
Romain Thomas 8a2ec4eeae Fix typo 2024-07-27 05:28:30 +02:00
Romain Thomas 2f7620f527 Add support for LC_ROUTINE/LC_ROUTINE64 2024-07-27 05:27:10 +02:00
Romain Thomas 4800a80769 Add support for Mach-O LC_SUBCLIENT command 2024-07-27 05:01:30 +02:00
Romain Thomas 999daa3ce7 More inline helpers 2024-07-27 04:31:10 +02:00
Romain Thomas ff8bc78393 Update changelog 2024-07-23 18:03:50 +02:00
Romain Thomas cb7132c776 Bump macos runner version 2024-07-23 18:00:26 +02:00
Romain Thomas 3d1663f31c Bump version 2024-07-23 17:45:54 +02:00
Romain Thomas fa10efc138 Fix expired certificates 2024-07-23 17:30:23 +02:00
Romain Thomas ab1387add8 Add utilities 2024-07-23 16:58:13 +02:00
Romain Thomas d4e767b3d9 Add OFF level and the API to get the current level 2024-07-23 16:58:12 +02:00
Romain Thomas fd1cc42b6d Add support for Mach-O .hwx files 2024-07-23 16:58:08 +02:00
Romain Thomas 3eac86c9e6 Add documentation link 2024-07-21 21:18:44 +02:00
Romain Thomas 8e2964f722 Add stable doc info 2024-07-21 21:12:31 +02:00
Romain Thomas 38b7f9279b Add warning about Rust documentation 2024-07-21 21:06:29 +02:00
Romain Thomas ad4e824b97 Bump version 2024-07-21 19:10:00 +02:00
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
2280 changed files with 468890 additions and 56213 deletions
+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"
+28 -21
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,31 @@ 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 any(re.match(s, branch) for s in self._branches):
return True
return False
def deploy(self, directories: list[str]):
s3dir = None
if GithubDeploy.is_tagged():
s3dir = GithubDeploy.tag_name()
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("_", "-")
branch = GithubDeploy.branch()
if branch is None:
logger.warning("Can't resolve the branch name")
sys.exit(1)
s3dir = self._default_dir
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
+6 -6
View File
@@ -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
+8 -15
View File
@@ -1,24 +1,16 @@
name: 'iOS'
on: push
env:
python-version: '3.10'
jobs:
ios-sdk:
runs-on: macos-11.0
runs-on: macos-13
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
+44 -31
View File
@@ -5,7 +5,7 @@ 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
+164 -71
View File
@@ -4,8 +4,22 @@ 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,20 +266,5 @@ 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
documentation:
needs: [deploy]
runs-on: ubuntu-latest
container:
image: liefproject/manylinux_2_28_x86_64
env:
CIRCLE_CI_URL: "https://circleci.com/api/v2/project/gh/lief-project/doc/pipeline"
CIRCLE_CI_TOKEN: ${{ secrets.CIRCLE_CI_TOKEN }}
steps:
- name: Trigger documentation
if: github.ref == 'refs/heads/master'
run: |
curl --request POST --url ${CIRCLE_CI_URL} \
--header "Circle-Token: ${CIRCLE_CI_TOKEN}" \
--header 'content-type: application/json' \
--data '{"parameters":{"lief-branch":"master"}}'
liefproject/deploy \
python3 /src/.github/deploy.py /runner_tmp/artifacts
+44 -37
View File
@@ -6,9 +6,9 @@ env:
jobs:
osx-sdk:
runs-on: macos-11.0
runs-on: macos-13
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,38 +42,37 @@ 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
retention-days: 1
osx-testing:
runs-on: macos-11.0
runs-on: macos-13
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
runs-on: macos-13
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.0-rc.1']
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%
-44
View File
@@ -1,44 +0,0 @@
name: 'sanitize'
on: workflow_dispatch
jobs:
gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-e BUILD_DIR=/tmp/build_gcc \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/gcc.sh
clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-e BUILD_DIR=/tmp/build_clang \
-e SRC_DIR=/src \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/clang.sh
asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: compile
shell: bash
run: |
docker run --rm \
-v $GITHUB_WORKSPACE:/src \
liefproject/sanity:latest bash /src/scripts/docker/asan_check.sh
+38 -36
View File
@@ -2,8 +2,10 @@ name: LIEF Windows
on:
push:
branches:
- 'main'
- 'master'
- 'release-**'
- 'release/**'
tags:
- '**'
@@ -13,7 +15,7 @@ env:
jobs:
build-sdk:
runs-on: windows-2019
runs-on: windows-2022
strategy:
matrix:
arch: ['x64', 'x86']
@@ -22,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 }}
@@ -36,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 }}
@@ -56,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
@@ -72,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:
@@ -82,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 }}
@@ -96,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 }}
@@ -127,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 }}
@@ -172,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 }}
@@ -190,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: |
@@ -216,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
@@ -229,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:
+16 -14
View File
@@ -4,16 +4,18 @@ on:
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]
@@ -22,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 }}
@@ -34,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 }}
@@ -57,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'
+97 -275
View File
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.24)
project(LIEF LANGUAGES C CXX)
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 +22,38 @@ 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_PATCH "0")
set(LIEF_VERSION_MINOR "16")
set(LIEF_VERSION_PATCH "1")
endif()
if (DEFINED ENV{LIEF_COMMIT})
set(LIEF_COMMIT_HASH "$ENV{LIEF_COMMIT}")
endif()
if (DEFINED ENV{LIEF_BRANCH})
set(LIEF_GIT_BRANCH "$ENV{LIEF_BRANCH}")
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 +97,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,131 +111,60 @@ 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)
endif()
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}")
set_source_files_properties(${mbedtls_src_files} PROPERTIES GENERATED TRUE)
target_sources(LIB_LIEF PRIVATE ${mbedtls_src_files})
target_compile_definitions(LIB_LIEF PRIVATE -DMBEDTLS_NO_PLATFORM_ENTROPY)
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)
target_compile_definitions(LIB_LIEF PRIVATE
-DMBEDTLS_CONFIG_FILE="${CMAKE_CURRENT_SOURCE_DIR}/config/mbedtls/config.h"
)
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 +175,18 @@ 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)
if(LIEF_ENABLE_JSON)
# Make nlohmann/json is only using C++11 API.
# Especially, MSVC[14.37.32822] is buggy with (no)rtti & std::any
# Ref:
# - https://github.com/nlohmann/json/issues/3900
# - https://github.com/microsoft/STL/issues/4349#issuecomment-1920093172
target_compile_definitions(LIB_LIEF PRIVATE JSON_HAS_CPP_11)
endif()
# Logging Configuration
# =====================
target_compile_definitions(LIB_LIEF PRIVATE SPDLOG_DISABLE_DEFAULT_LOGGER
SPDLOG_NO_EXCEPTIONS
SPDLOG_FUNCTION=)
@@ -299,47 +195,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 +203,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 +239,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)
@@ -423,7 +281,7 @@ endif()
if(LIEF_OPT_UTFCPP_EXTERNAL)
find_package(utf8cpp REQUIRED)
target_link_libraries(LIB_LIEF PRIVATE utf8cpp)
target_link_libraries(LIB_LIEF PRIVATE utf8cpp::utf8cpp)
else()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/internal/utfcpp/utf8.h
COMMAND
@@ -462,28 +320,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 +392,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 +406,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 +439,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 +483,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 +506,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 +524,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 +541,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 +550,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.
+105 -51
View File
@@ -1,34 +1,34 @@
<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">
<a href="https://discord.gg/7hRFGWYedu">
<a href="https://discord.gg/jGQtyAYChJ">
<img src="https://img.shields.io/discord/1117013848914931762">
</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">
@@ -38,27 +38,40 @@
<a href="https://twitter.com/LIEF_project">
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/lief_project">
</a>
&nbsp;
<a href="https://gurubase.io/g/lief">
<img src="https://img.shields.io/badge/Gurubase-Ask%20LIEF%20Guru-006BFF">
</a>
</p>
<br />
<p align="center">
<a href="https://lief-project.github.io/blog/"><b>Blog</b></a> •
<a href="https://lief-project.github.io/doc/latest/index.html"><b>Documentation</b></a> •
<a href="https://lief.re/blog/"><b>Blog</b></a> •
<a href="https://lief.re/doc/latest/index.html"><b>Documentation</b></a> •
<a href="#user-content-about-1"><b>About</b></a>
</p>
<br />
# About
The purpose of this project is to provide a cross platform library which can parse,
The purpose of this project is to provide a cross-platform library to parse,
modify and abstract ELF, PE and MachO formats.
Main features:
**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
* **Parsing**: LIEF can parse ELF, PE, MachO, OAT, DEX, VDEX, ART and provides an user-friendly API to access to internals.
* **Modify**: LIEF can use to modify some parts of these formats (adding a section, changing a symbol's name, ...)
* **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
**Extended features**:
* [**DWARF/PDB** Support](https://lief.re/doc/latest/extended/debug_info/index.html)
* [**Objective-C** Metadata](https://lief.re/doc/latest/extended/objc/index.html)
* [**Dyld Shared Cache**](https://lief.re/doc/latest/extended/dsc/index.html) with support for extracting Dylib
* [**Disassembler**](https://lief.re/doc/latest/extended/disassembler/index.html): AArch64, x86/x86-64, ARM, RISC-V, Mips, PowerPC, eBPF
* [**Assembler**](https://lief.re/doc/latest/extended/assembler/index.html): AArch64, x86/x86-64
# Content
@@ -66,22 +79,23 @@ Main features:
- [Download / Install](#downloads--install)
- [Getting started](#getting-started)
- [Documentation](#documentation)
- [Sphinx](https://lief-project.github.io/doc/stable/index.html)
- [Doxygen](https://lief-project.github.io/doc/latest/doxygen/index.html)
- [Rust](https://lief.re/doc/stable/rust/lief/)
- [Sphinx](https://lief.re/doc/latest/index.html)
- [Doxygen](https://lief.re/doc/latest/doxygen/index.html)
- Tutorials:
- [Parse and manipulate formats](https://lief-project.github.io/doc/latest/tutorials/01_play_with_formats.html)
- [Create a PE from scratch](https://lief-project.github.io/doc/latest/tutorials/02_pe_from_scratch.html)
- [Play with ELF symbols](https://lief-project.github.io/doc/latest/tutorials/03_elf_change_symbols.html)
- [ELF Hooking](https://lief-project.github.io/doc/latest/tutorials/04_elf_hooking.html)
- [Infecting the plt/got](https://lief-project.github.io/doc/latest/tutorials/05_elf_infect_plt_got.html)
- [PE Hooking](https://lief-project.github.io/doc/latest/tutorials/06_pe_hooking.html)
- [PE Resources](https://lief-project.github.io/doc/latest/tutorials/07_pe_resource.html)
- [Transforming an ELF executable into a library](https://lief-project.github.io/doc/latest/tutorials/08_elf_bin2lib.html)
- [How to use frida on a non-rooted device](https://lief-project.github.io/doc/latest/tutorials/09_frida_lief.html)
- [Android formats](https://lief-project.github.io/doc/latest/tutorials/10_android_formats.html)
- [Mach-O modification](https://lief-project.github.io/doc/latest/tutorials/11_macho_modification.html)
- [ELF Coredump](https://lief-project.github.io/doc/latest/tutorials/12_elf_coredump.html)
- [PE Authenticode](https://lief-project.github.io/doc/latest/tutorials/13_pe_authenticode.html)
- [Parse and manipulate formats](https://lief.re/doc/latest/tutorials/01_play_with_formats.html)
- [Create a PE from scratch](https://lief.re/doc/latest/tutorials/02_pe_from_scratch.html)
- [Play with ELF symbols](https://lief.re/doc/latest/tutorials/03_elf_change_symbols.html)
- [ELF Hooking](https://lief.re/doc/latest/tutorials/04_elf_hooking.html)
- [Infecting the plt/got](https://lief.re/doc/latest/tutorials/05_elf_infect_plt_got.html)
- [PE Hooking](https://lief.re/doc/latest/tutorials/06_pe_hooking.html)
- [PE Resources](https://lief.re/doc/latest/tutorials/07_pe_resource.html)
- [Transforming an ELF executable into a library](https://lief.re/doc/latest/tutorials/08_elf_bin2lib.html)
- [How to use frida on a non-rooted device](https://lief.re/doc/latest/tutorials/09_frida_lief.html)
- [Android formats](https://lief.re/doc/latest/tutorials/10_android_formats.html)
- [Mach-O modification](https://lief.re/doc/latest/tutorials/11_macho_modification.html)
- [ELF Coredump](https://lief.re/doc/latest/tutorials/12_elf_coredump.html)
- [PE Authenticode](https://lief.re/doc/latest/tutorials/13_pe_authenticode.html)
- [Contact](#contact)
- [About](#about)
- [Authors](#authors)
@@ -90,12 +104,27 @@ Main features:
## Downloads / Install
First, make sure to have an updated version of setuptools:
## C++
```console
pip install setuptools --upgrade
```cmake
find_package(LIEF REQUIRED)
target_link_libraries(my-project LIEF::LIEF)
```
## Rust
```toml
[package]
name = "my-awesome-project"
version = "0.0.1"
edition = "2021"
[dependencies]
lief = "0.16.2"
```
## Python
To install the latest **version** (release):
```console
@@ -105,22 +134,23 @@ 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] --force-reinstall --index-url https://lief.s3-website.fr-par.scw.cloud/latest lief==0.16.0.dev0
```
### Packages
- LIEF Extended: https://extended.lief.re (GitHub OAuth)
- **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.16.0**: https://github.com/lief-project/LIEF/releases/tag/0.16.0
Here are guides to install or integrate LIEF:
* [Python](https://lief-project.github.io/doc/latest/installation.html#python)
* [VisualStudio](https://lief-project.github.io/doc/latest/installation.html#visual-studio-integration)
* [XCode](https://lief-project.github.io/doc/latest/installation.html#xcode-integration)
* [CMake](https://lief-project.github.io/doc/latest/installation.html#cmake-integration)
* [Python](https://lief.re/doc/latest/installation.html#python)
* [Visual Studio](https://lief.re/doc/latest/installation.html#visual-studio-integration)
* [XCode](https://lief.re/doc/latest/installation.html#xcode-integration)
* [CMake](https://lief.re/doc/latest/installation.html#cmake-integration)
## Getting started
@@ -131,15 +161,34 @@ 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++
@@ -150,17 +199,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;
@@ -189,10 +244,9 @@ int main(int argc, char** argv) {
## Documentation
* [Main documentation](https://lief-project.github.io/doc/latest/index.html)
* [Tutorial](https://lief-project.github.io/doc/latest/tutorials/index.html)
* [API](https://lief-project.github.io/doc/latest/api/index.html)
* [Doxygen](https://lief-project.github.io/doc/latest/doxygen/index.html)
* [Main documentation](https://lief.re/doc/latest/index.html)
* [Doxygen](https://lief.re/doc/latest/doxygen/index.html)
* [Rust](https://lief.re/doc/stable/rust/lief/)
## Contact
@@ -203,11 +257,11 @@ int main(int argc, char** argv) {
### Authors
Romain Thomas ([@rh0main](https://twitter.com/rh0main)) - [Quarkslab](https://www.quarkslab.com)
Romain Thomas ([@rh0main](https://www.romainthomas.fr/)) - [Quarkslab](https://www.quarkslab.com)
### 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.16.0/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
File diff suppressed because it is too large Load Diff
+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
}
+55 -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,65 @@
* 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_POWERPCBE = 0x1F2, /**< Power PC big endian */
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 +85,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
+2 -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.
@@ -19,12 +19,6 @@
#ifndef C_LIEF_LOGGING_H_
#define C_LIEF_LOGGING_H_
/** @defgroup logging_c_api Logging
* @brief Logging C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
@@ -42,6 +36,5 @@ LIEF_API void lief_logging_set_level(uint32_t level);
}
#endif
/** @} */
#endif

Some files were not shown because too many files have changed in this diff Show More