-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
When a dylib crate has a public inline(always) functions in it that use, as an implementation, other, private functions, using these public functions from other crates will fail with linkage errors because we fail to "export" the private functions.
An example project can be seen here. In this example the driver dylib crate privately externs a symbol from a static C library and uses it to implement an inline(always) interface/wrapper. The user crate then attempts to use the inline(always) wrapper, but linking fails with an error such as this:
/tmp/user/driver/src/lib.rs:8: undefined reference to `private_extern_symbol'
When inspecting the libdriver.so we can see that the extern symbol does indeed exist but is "private":
0000000000001100 t private_extern_symbol
I think we might be un-exporting items too aggressively here. cc @michaelwoerister @oli-obk
Blocks #55617
Regression from 1.36.0 (example builds successfully) to 1.37 (example fails to build).