You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kaisa is a C# parser for [Windows `.lib` archive/library files](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#archive-library-file-format). It is primarily intended to read import libraries, but it does provide basic support for parsing object files too.
9
+
Kaisa is a C# parser for various library files consumed by linkers. It is primarily intended to support locating where and how symbols are exported by dynamic and static libraries. However basic information about unrelated object sections is exposed for advanced users.
It also supports automatic identification of such files. Including a best guess differentiation between Windows and Linux archives (which use the same-yet-different non-standardized format.)
18
+
19
+
Note that PE images (IE: `.dll` files) are not supported since linkers on Windows do not consume them.
10
20
11
21
## License
12
22
13
23
This project is licensed under the MIT License. [See the license file for details](LICENSE.txt).
14
24
15
-
## Library file feature support
25
+
## Archive file feature support
16
26
17
-
The parser should tolerate any library file, but only the following information is explicitly parsed and exposed:
27
+
The parser should tolerate any library archive file, but only the following information is explicitly parsed and exposed:
18
28
19
29
*[V1 index files](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#first-linker-member) (AKA "first linker member")
20
-
*[V2 index files](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#second-linker-member) (AKA "second linker member")
30
+
*[V2 index files*](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#second-linker-member) (AKA "second linker member")
* Extended names from the string table (IE: `/123`) are currently not resolved
27
37
*[The symbol table](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#coff-symbol-table), including [the string table](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#coff-string-table).
28
38
* Note that the string table is not exposed on the API surface. It is discarded after the symbol table is read.
39
+
* ELF object members** (see ELF support below for details.)
40
+
* Unrecognized members (only exposes a data range in case you want to parse something exotic yourself)
41
+
* "Unrecognized" is tricky due to COFF members having no magic signature. For a member to be considered unrecognized, all of the following must be true:
42
+
* It is not recognized as an import object
43
+
* It is not recognized as an ELF file
44
+
* It would have an invalid [COFF machine type](https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types) if it were parsed as a COFF object
45
+
46
+
<sup>\* Specific to Windows archives<br>\*\* Specific to Linux archives</sup>
47
+
48
+
Note that the parser currently requires the symbol index file to be present. As such it cannot be used to parse non-library archive files such as `.deb` packages. It also does not currently understand BSD-style library archives (including those used on macOS.)
49
+
50
+
### Unsupported COFF object member features
29
51
30
52
The following are explicitly not parsed or exposed for COFF objects: (Although enough information is exposed that you should be able to parse them yourself.)
31
53
@@ -36,9 +58,24 @@ The following are explicitly not parsed or exposed for COFF objects: (Although e
36
58
* The (image-only) attribute certificate table
37
59
* Delay-load import only tables (image-only)
38
60
39
-
There is currently no attempt at parsing System V or GNU AR archives since it is currently implemented from the Microsoft spec. Some AR archive fields that are meaningless to the Microsoft spec (such as the UID and GID) are skipped when parsing.
61
+
### Other unsupported features
62
+
63
+
Some AR archive fields that are meaningless to the Microsoft spec (such as the UID and GID) are skipped when parsing. (They aren't particularly useful or important to linkers on Linux either, they're an artifact from archive files being a general-purpose archive format.)
64
+
65
+
## ELF file feature support
66
+
67
+
The parser should tolerate any ELF file, but only the following sections are explicitly parsed and exposed:
68
+
69
+
*[General and dynamic symbols tables](https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.symtab.html) (`SHT_SYMTAB` and `SHT_DYNSYM`)
70
+
* Extended index tables (`SHT_SYMTAB_SHNDX`) -- Not directly exposed but extended indices are automatically resolved on symbols.
* Including whether the section is a [special well-known section](https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.sheader.html#special_sections) or a non-standard operating system or processor-specific extension section.
74
+
* Advanced users can extract the range of these sections for manual parsing if so desired.
75
+
76
+
Additionally, relevant [x64-specific extensions](https://refspecs.linuxfoundation.org/elf/x86_64-abi-0.99.pdf#page=61) are exposed. (Although not many actually affect the features we do expose.)
40
77
41
-
There is no support for PE (image) files. (You can probably use [System.Reflection.PortableExecutable](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.portableexecutable) for those.)
78
+
In theory 32-bit ELF files are supported, but their support is not regularly exercised. Big endian ELF files are not supported unless your app is running on a big endian platform. Developers with more advanced needs might consider evaluating [LibObjectFile](https://github.com/xoofx/LibObjectFile) instead.
0 commit comments