Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdylib: symbol versioning #38

Open
cyphar opened this issue Jul 19, 2024 · 1 comment
Open

cdylib: symbol versioning #38

cyphar opened this issue Jul 19, 2024 · 1 comment
Labels
api/cffi Related to the C-FFI API.
Milestone

Comments

@cyphar
Copy link
Member

cyphar commented Jul 19, 2024

In order to avoid compatibility issues in the future, we should make use of symbol versioning from the first release in order to avoid having to bump the SONAME when we eventually run into an incompatible change.

There are a few issues to note (I haven't tested these yet, I'm just collecting my notes from reading about this for a bit):

  1. Rust appears to specify its own version map (though it seems that this isn't the case for panic="abort"?) which means some magic is necessary to use our version map for our own symbols. It also appears to include our symbols in its default version map, so you also need to define the symbols with alternative names and then use -Wl,--defsym=foo=foo_impl to remap them. This will probably cause issues with cbindgen...
  2. There is no way to do asm(".symver ...")/__attribute__(symver()) in Rust at the moment, so if we ever end up having the same symbol name in two different versions (ie. there was an incompatible semantics change for a function and we want new programs to not use the function) it might not be possible to generate a version map with the right symbols. I suspect that --defsym=... can't be used for this purpose but we might want to look into that.

I suspect defining a version map from the outset even if we don't know how to deal with (2) is probably a good idea.

@cyphar cyphar added the api/cffi Related to the C-FFI API. label Jul 19, 2024
@cyphar cyphar changed the title symbol versioning cdylib: symbol versioning Jul 19, 2024
@cyphar
Copy link
Member Author

cyphar commented Jul 20, 2024

Duplicate of #12, but I'll migrate that here.

Right now we don't have any kind of real versioning in the C API. It would be nice to have symbol versioning (this post has some interesting advice), and probably also some kind of pathrs_version() function which gives you the version of libpathrs you're dealing with.

@cyphar cyphar added this to the 1.0.0 milestone Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api/cffi Related to the C-FFI API.
Projects
None yet
Development

No branches or pull requests

1 participant