-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rust binding to LFS64 ABI-compat symbols rather than public names on musl libc #2934
Comments
Is the position that the Similar question around I'm guessing the answers to the above are all "yes" since I'm assuming that musl's offset/size types have always been 64-bit and the methods have always used the 64-bit underlying syscalls. Hence there being no need to have separate names for compatibility reasons. Lastly is there a list of affected symbols or is it simply "all the ones that end with |
The intent going forward is that the
Yes.
That's basically it (modulo
|
Excellent, I've pushed a proposed change in #2935 that leaves the There's code in the stdlib (and likely elsewhere in the wider world) that explicitly calls the |
Great, that seems like the correct fix. I don't think there's any reason to object to having the aliases in a FFI context like this. One (I think the main) reason we didn't do it in a pure C context was that the types were wrong: without |
In that (those?) cases is there an actual (ABI) difference between |
No, there's no ABI difference. At an ABI/FFI level everything is fine. It's only not-okay if you consider the C sources/IR cross-translation-unit as having to follow the C TBA rules and you defined |
The answer is "yes, actually", because lifetime analysis replaces it functionally. As a result, Unsafe Rust has historically been allowed to rely on pointer-casting in a way that would make a seasoned C developer blanch, so it would be very hard to change, even amongst things people say are "very hard to change". |
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
Alias all LFS64 symbols to their non-LFS64 counterparts on musl As per #2934 the LFS64 symbols on musl-libc are simply aliases to the non-LFS64 symbols. Currently this is done both in the header files (as `#define` entries) and in the library (as aliasing symbols). There is a desire in musl to drop the ABI compatibility shims (the symbol aliases) - currently the `libc` crate exports the LFS64 symbols by `extern`-ing the compatibility shims which will fail if musl removes them. This changes the musl build of libc to replicate the aliasing that's in the C header files (with `pub use xxx as xxx64`) so the API from the `libc` crate is unchanged, but the crate is now compatible with the upcoming musl release. I've also checked and all the LFS64 types (e.g. `off64_t`) are already the same as their non-LFS64 equivalents. This is an annoying change to test, `libc-test` seems expect to build against `musl 1.1.24` (in fact, does Rust even support `musl 1.2`? It's not obvious that it does... e.g. see https://github.com/rust-lang/libc/blob/d99c37d97c7a075ffc7f4260f2dd134d1ee3daaa/src/unix/linux_like/linux/musl/mod.rs#L288-L292)
Alias all LFS64 symbols to their non-LFS64 counterparts on musl As per #2934 the LFS64 symbols on musl-libc are simply aliases to the non-LFS64 symbols. Currently this is done both in the header files (as `#define` entries) and in the library (as aliasing symbols). There is a desire in musl to drop the ABI compatibility shims (the symbol aliases) - currently the `libc` crate exports the LFS64 symbols by `extern`-ing the compatibility shims which will fail if musl removes them. This changes the musl build of libc to replicate the aliasing that's in the C header files (with `pub use xxx as xxx64`) so the API from the `libc` crate is unchanged, but the crate is now compatible with the upcoming musl release. I've also checked and all the LFS64 types (e.g. `off64_t`) are already the same as their non-LFS64 equivalents. This is an annoying change to test, `libc-test` seems expect to build against `musl 1.1.24` (in fact, does Rust even support `musl 1.2`? It's not obvious that it does... e.g. see https://github.com/rust-lang/libc/blob/d99c37d97c7a075ffc7f4260f2dd134d1ee3daaa/src/unix/linux_like/linux/musl/mod.rs#L288-L292)
Alias all LFS64 symbols to their non-LFS64 counterparts on musl As per #2934 the LFS64 symbols on musl-libc are simply aliases to the non-LFS64 symbols. Currently this is done both in the header files (as `#define` entries) and in the library (as aliasing symbols). There is a desire in musl to drop the ABI compatibility shims (the symbol aliases) - currently the `libc` crate exports the LFS64 symbols by `extern`-ing the compatibility shims which will fail if musl removes them. This changes the musl build of libc to replicate the aliasing that's in the C header files (with `pub use xxx as xxx64`) so the API from the `libc` crate is unchanged, but the crate is now compatible with the upcoming musl release. I've also checked and all the LFS64 types (e.g. `off64_t`) are already the same as their non-LFS64 equivalents. This is an annoying change to test, `libc-test` seems expect to build against `musl 1.1.24` (in fact, does Rust even support `musl 1.2`? It's not obvious that it does... e.g. see https://github.com/rust-lang/libc/blob/d99c37d97c7a075ffc7f4260f2dd134d1ee3daaa/src/unix/linux_like/linux/musl/mod.rs#L288-L292)
Fixed by #2935 |
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap At this point USE=system-boostrap will be required with >= musl-1.2.4 until uptream merges these patches and updates their boostrap. This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, for those that are still experiencing issues these steps should resolve them: 1. Downgrade to musl-1.2.3 2. Rebuild dev-lang/rust with these patches 3. Upgrade to musl-1.2.4 again 4. Rebuild rust with USE=system-bootstrap This was tested with musl-1.2.3, musl-1.2.4 and glibc-2.37-r3. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, may need -system-bootstrap after updating musl. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-Commit: rust-lang/libc@1e8c55c Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, may need -system-bootstrap after updating musl. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-Commit: rust-lang/libc@1e8c55c Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
This fixes the build with musl-1.2.4, may need -system-bootstrap after updating musl. Closes: https://bugs.gentoo.org/903607 Upstream-PR: rust-lang/rust#106246 Upstream-Issue: rust-lang/libc#2934 Upstream-PR: rust-lang/libc#2935 Upstream-Commit: rust-lang/libc@1e8c55c Upstream-PR: rust-random/getrandom#326 Upstream-Commit: rust-random/getrandom@7f73e3c Signed-off-by: orbea <[email protected]>
It's come to our attention as part of removing the legacy LFS64 glibc-ABI-compat symbols that Rust's libc crate is apparently binding to the LFS64 ("large file support") symbol names like
fopen64
, etc. rather than the standard symbol names. In the musl API/ABI (defined by our public headers) the LFS64 interfaces exist only as macros remapping to the standard function names, and the nonstandard LFS64 names are purely a glibc-ABI-compat mechanism that will not be linkable in the future (i.e. only available to already-dynamic-linked binaries referencing these symbols). This is part of an effort to get rid of the macros (which cause a lot of havok on various C++ projects), which is blocked on having the symbols present, because the prevalence of autoconf link-only tests makes it unsafe to have the symbols linkable without declarations in the headers.What needs to happen here in order for Rust to reference only the standard libc interface names on musl targets?
The text was updated successfully, but these errors were encountered: