# coff: improve default COFF/PE object parser · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/c84e5ee87852eafff0cbf986bf02c5221cbcec35)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: c84e5ee87852eafff0cbf986bf02c5221cbcec35

Requested commit: c84e5ee87852eafff0cbf986bf02c5221cbcec35

Commit: c84e5ee87852eafff0cbf986bf02c5221cbcec35

Tree: a978b80bbcc7273ad3a0e3d4de843a8a3ec947e9

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
coff: improve default COFF/PE object parser

We now do not allocate memory for headers and other metadata unless
requested by the caller. Instead, we read-in the entire contents
of the image into memory and operate on pointers and casts wherever
possible. I have a left a TODO to hook up Windows' memory-mapped API
here in-place of standard `readToEndAlloc` which should be more memory
proof on memory constrained hosts.

This commit also supplements our `std.coff` with a lot missing basic
extern structs required to make our COFF linker.

```

## Parents

- [9043e665a549b87fa73ade7af06682368092d8a9](https://git.cafe/gitcafe/zig/commit/9043e665a549b87fa73ade7af06682368092d8a9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/c84e5ee87852eafff0cbf986bf02c5221cbcec35?format=markdown)
