Comments (5)
The same happens if you implement the function in a static library you link into the dylib. Rustc doesn't know that the function is defined within the dylib, so it doesn't mark it as exported in the version script.
from rust.
I think that behavior is fine in theory: there is no way for rust to know that the symbol is defined. but I believe there is currently a way to force the exporting of the symbol. E.g. this does not work
std::arch::global_asm! {
".global foo",
"foo:",
"ret",
}
extern "C" {
#[export_name = "foo"]
pub fn foo();
}
because
8 | #[export_name = "foo"]
| ^^^^^^^^^^^^^^^^^^^^^^
9 | pub fn foo();
| ------------- not a free function, impl method or static
So could it be a solution to provide a way to explicitly export the symbol?
from rust.
global_asm and static libraries should probably be handled the same for symbol export. You could look at the issue for the staticlib version of this behavior if such an option is already suggested.
from rust.
@bjorn3 would you mind linking the staticlib issue? I could not find it, unless you meant #104707 although that looks like the opposite problem to this one (too many exported symbols vs not enough).
from rust.
#78827, rust-lang/rfcs#2771, rust-lang/rfcs#3556
from rust.
Related Issues (20)
- ICE: field should be captured by immutable ref if we have an `Fn` instance
- [E0403] False positive generated for implicit future type HOT 3
- signal: 4 (SIGILL) when testing virtual-function-elimination HOT 1
- interrupted by SIGSEGV on riscv64 HOT 6
- anyhow Result + collect = missleading error messages
- Consider using random keys for incr. comp. hashing HOT 4
- E0050 emitted unexpectedly on missing `:`
- Duplicated label on E0381 HOT 1
- ### Summary
- <!--
- Unnecessary alloca Without Optimization Flags HOT 4
- Can't cast higher-ranked safe fn to (not higher-ranked) unsafe fn ptr
- Regression in clone impl of enum with variant that has a field with a bivariant substitution HOT 3
- A different case of `implementation of "FnOnce` is not general enough" HOT 2
- ICE compiling internal project
- Weird AVX 512 code generated with std::simd when using -Zbuild-std HOT 1
- Long ty names written to disk can leak username info in paths
- Unify/streamline long type name written to disk mechanism
- Build to AArch64 errors with "error: fixup value out of range"
- Incorrect relative jump (rjmp) code generation in latest nightly release for AVR toolchain HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust.