Closed nojb closed 1 year ago
It's not a strong enough objection to say "this shouldn't be in flexlink", but it does a feel little as though a compiler function is being added to a linker largely because the linker has the Coff
module 🙂
I'm vaguely wondering if either #embed
(C23, so it might be prudent not to hold our breath!) or a solution based on resource files might be better for this in the long run? I don't have any performance evidence, but I'm wondering if there's a reason that PDB is always in a separate file i.e. while in ELF we can clearly have the debugging information present with no issue, I'm left wondering why PE goes to great lengths to reference external debugging data, rather than ever allowing it to be embedded.
You are right; I'm also not convinced of the approach (I closed https://github.com/ocaml/ocaml/pull/10654). Let's close this for now.
This PR adds an "incbin" (see https://github.com/graphitemaster/incbin) feature to
flexdll
, allowing to include binary blobs in the final binary. The motivation is https://github.com/ocaml/ocaml/pull/10159 and https://github.com/ocaml/ocaml/pull/10654, namely including debug information for bytecode binaries built with--output-complete-exe
with MSVC, but the functionality makes sense independently.Concretely, a new flag
-incbin <sym> <file>
is added which has the effect of embedding<file>
inside the final binary and defining two symbols:<sym>_data
and<sym>_size
:<sym>_data
points to the beginning of the binary blob, and<sym>_size
is a 32-bit int containing the size of the binary blob.I'm still testing it, but feedback would be welcome!