Conversation
|
hmm, I don't quite understand this PR (and CI is failing). Would you mind to briefly describe (maybe in symbols.ml) what is happening in there? I'm fine with the general idea to support cross-installation and linkage of hacl-raw and hacl (until they're merged into one). |
|
I'm curious: which symbols clash? why not use a |
|
I looked a bit deeper into this issue, and cannot reproduce the issue to fix here. AFAICT more recent "hacl-star" use camlHacl_XXX symbols. If this issue is reproducible, I'd appreciate a test, I tried with: (test
(name colink)
(package hacl_x25519)
(modules colink)
(libraries hacl_x25519 hacl-star))colink.ml: let () =
let _, _ = Hacl_x25519.gen_key ~rng:Cstruct.create in
Hacl_star.(EverCrypt.Curve25519.secret_to_public (Bytes.create 32) (Bytes.create 32))and both hacl-star 0.2.0 and 0.3.0. |
|
Here's an example of a link failure due to a collision between I've tried to construct a minimal reproduction of this failure – which occurs in the wild for the Tezos monorepo – but haven't been successful. This patch fixes the issue, however. |
|
I can't repro this either with the small test case, even though there is clearly a symbol clash. However, hacl-star appears to use ctypes-foreign (and hence libffi) to load in its bindings, which means we may need to work a little harder to trigger the clash. |
|
Just to clear the status of this PR:
|
|
Ok, the error is, indeed, not reproducible with the snippet of @hannesm but it is reproducible when we use: Into details, the real diff is between order of libraries at the link time (
|
|
I confirm that I can reproduce @dinosaure's issue in linux but not on macos. No idea what the linker is doing here :-) |
|
What's confusing me is why the symbols are appearing at link time at all, since hacl-star-raw appears to use ctypes-foreign to dynamically load them. |
I don't really understand underlayer with In other side, I clean-up this PR - again, I'm not really convince about what I did but it seems a middle-term solution for us. When MirageOS 4 will be available (and the question about C flags solved), I will propose something else which is more sustainable. So if you want a release, we can cut one for Tezos. |
This PR should fix clash of names (linking error) and add a prefix
mirage__into extracted C file ofhacl- only for the UNIX/usual back-end but we should not apply that onfreestandingandxenartifacts.