You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another motivation is the ability to ship shared libraries which could be reused by multiple applications on disk (reducing bandwith usage on update, reducing disk usage) and in RAM (through shared .text pages, reducing RAM usage).
It would also make Linux distributions more happy as it would allow usage of shared libraries. Which apart from memory reduction in different ways, also make handling of security issues (or otherwise important bugs) simpler. You only have to update the code in a single place and rebuild that, instead of having to fix lots of copies of the code in different versions and rebuild everything.
Shared libraries can be cool provided that there is a way to work around similar libraries accomplishing something in different ways such as openssl & libressl. There could also be value with making a way to allow a switch in-between static & dynamic libraries that can be set by the person compiling the crate. (possible flag?)
In my opinion, it's very hard to take Rust seriously as a replacement systems programming language if it's not possible in any reasonably sane manner to build applications linking to libraries with a safe, stable ABI.
There are a lot of good reasons for supporting shared libraries, not the least of which is building fully-featured systems for more resource constrained devices (like your average SBC or mobile device). Not having shared libraries really blows up the disk utilization in places where it's not cheap.
@jpakkane describes this really well in his blog post where he conducts an experiment to prove this problem.
In my opinion, it's very hard to take Rust seriously as a replacement systems programming language if it's not possible in any reasonably sane manner to build applications linking to libraries with a safe, stable ABI.
Note that C++ still doesn't have a stable ABI, and it took C decades to get one.
@Serentty Besides other reasons, the current rules can't be frozen because they don't exist.
You can't version implementation-defined behavior without copying the entirety of the implementation, it's not even implementation-specified, and ideally it should be specified at least by an RFC.
If an RFC for a specific ABI is presented, with details for all supported targets, that might work out.
But why would you bother with that when repr(C) and extern "C" exist?
Even if you have such an ABI, it won't be used by libstd types, just like the C one isn't.
(that's one of other reasons I alluded to above, probably the main one)
(looks like eddyb and I were writing these replies at the same time)
I don't see the harm in simply adding one that freezes the current unstable ABI as a stable one that you would have to explicitly ask for, while the unstable one would remain the default
This expresses a common misunderstanding that "the current unstable Rust ABI" is something that is already fully implemented in a well-defined, well-understood way that we know how to support to everyone's satisfaction.
A large chunk of the work here is achieving consensus on what a "Rust ABI" is even supposed to be, and that whatever it's supposed to be would even be a desirable thing to stabilize. There are already loads of comments in this thread expressing disagreement over what it is or reasons why it's undesirable to ever stabilize any version of it.
Okay, so if there's no rigid documentation for how the current ABI works, then that is indeed a problem that prevents it from being frozen.
If an RFC for a specific ABI is presented, with details for all supported targets, that might work out.
But why would you bother with that when repr(C) and extern "C" exist?
Because the C ABI is still quite limited. Not supporting trait objects is a fairly big hurdle, for example.
I just heard from a friend that trait pointers are currently an unstable feature in the C ABI. That actually brings it close to what I would want in a Rust ABI anyway. The only thing really left bothering me is that the standard library can't easily be shipped as separate form the executable, which would be a real bandwidth-saver over CDNs, but because of generics that's probably not entirely possible anyway.
Activity
ranma42 commentedon Jan 20, 2015
nrc commentedon Aug 17, 2016
See #1675 for some motivation for this feature (implementing plugins, that is plugins for Rust programs, not for the compiler).
genodeftest commentedon Dec 16, 2016
Another motivation is the ability to ship shared libraries which could be reused by multiple applications on disk (reducing bandwith usage on update, reducing disk usage) and in RAM (through shared .text pages, reducing RAM usage).
sdroege commentedon Mar 27, 2017
It would also make Linux distributions more happy as it would allow usage of shared libraries. Which apart from memory reduction in different ways, also make handling of security issues (or otherwise important bugs) simpler. You only have to update the code in a single place and rebuild that, instead of having to fix lots of copies of the code in different versions and rebuild everything.
Arzte commentedon Mar 29, 2017
Shared libraries can be cool provided that there is a way to work around similar libraries accomplishing something in different ways such as openssl & libressl. There could also be value with making a way to allow a switch in-between static & dynamic libraries that can be set by the person compiling the crate. (possible flag?)
Conan-Kudo commentedon Mar 29, 2017
In my opinion, it's very hard to take Rust seriously as a replacement systems programming language if it's not possible in any reasonably sane manner to build applications linking to libraries with a safe, stable ABI.
There are a lot of good reasons for supporting shared libraries, not the least of which is building fully-featured systems for more resource constrained devices (like your average SBC or mobile device). Not having shared libraries really blows up the disk utilization in places where it's not cheap.
@jpakkane describes this really well in his blog post where he conducts an experiment to prove this problem.
vks commentedon Mar 29, 2017
Note that C++ still doesn't have a stable ABI, and it took C decades to get one.
82 remaining items
eddyb commentedon Oct 20, 2019
@Serentty Besides other reasons, the current rules can't be frozen because they don't exist.
You can't version implementation-defined behavior without copying the entirety of the implementation, it's not even implementation-specified, and ideally it should be specified at least by an RFC.
If an RFC for a specific ABI is presented, with details for all supported targets, that might work out.
But why would you bother with that when
repr(C)
andextern "C"
exist?Even if you have such an ABI, it won't be used by libstd types, just like the C one isn't.
(that's one of other reasons I alluded to above, probably the main one)
Ixrec commentedon Oct 20, 2019
(looks like eddyb and I were writing these replies at the same time)
This expresses a common misunderstanding that "the current unstable Rust ABI" is something that is already fully implemented in a well-defined, well-understood way that we know how to support to everyone's satisfaction.
A large chunk of the work here is achieving consensus on what a "Rust ABI" is even supposed to be, and that whatever it's supposed to be would even be a desirable thing to stabilize. There are already loads of comments in this thread expressing disagreement over what it is or reasons why it's undesirable to ever stabilize any version of it.
Serentty commentedon Oct 20, 2019
Okay, so if there's no rigid documentation for how the current ABI works, then that is indeed a problem that prevents it from being frozen.
Because the C ABI is still quite limited. Not supporting trait objects is a fairly big hurdle, for example.
Serentty commentedon Oct 20, 2019
I just heard from a friend that trait pointers are currently an unstable feature in the C ABI. That actually brings it close to what I would want in a Rust ABI anyway. The only thing really left bothering me is that the standard library can't easily be shipped as separate form the executable, which would be a real bandwidth-saver over CDNs, but because of generics that's probably not entirely possible anyway.
mzabaluev commentedon Nov 9, 2019
For reference, a blog post by @Gankra: How Swift Achieved Dynamic Linking Where Rust Couldn't
unix_sigpipe
rust-lang/rust#97889kornelski commentedon Dec 21, 2022
cc rust-lang/rust#105586
loganleland commentedon Sep 24, 2023
Hi everyone! I'm interested in rust compiler development. Could anyone point me to code or a spec for how the abi works in rust as of today?
Jzow commentedon Nov 28, 2023
Hi guys, sorry to bother you. May I ask if the latest version of
Rust
has a stableABI
implementationLokathor commentedon Nov 28, 2023
Nope.
And that will probably never be added, so that the language can continue to grow