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 doesn't include unmangled symbols from dependencies even when explicitly re-exported. #82922

Closed
sadmac7000 opened this issue Mar 9, 2021 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sadmac7000
Copy link

I tried this code:

in foo.rs:

#[no_mangle]
pub unsafe extern "C" fn foo() {}

in bar.rs:

extern crate foo;

pub use foo::*;

On the console:

$ rustc --crate-type=rlib foo.rs
$ rustc --crate-type=cdylib bar.rs -L.
$ readelf -s libbar.so |grep foo

I expected to see this happen:
readelf should show my unmangled symbol.

Instead, this happened:
the symbol is missing from the crate.

Meta

rustc --version --verbose:

rustc 1.48.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.48.0
LLVM version: 11.0
@sadmac7000 sadmac7000 added the C-bug Category: This is a bug. label Mar 9, 2021
@gheoan
Copy link
Contributor

gheoan commented Jul 30, 2021

Is this a duplicate of #50007?

@rustbot modify labels: +A-linkage, +T-compiler

@rustbot rustbot added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 30, 2021
@tmandry
Copy link
Member

tmandry commented Aug 7, 2021

Looks like it is (other issues mentioning cdylib explicitly have been closed as duplicates of it), thanks. Closing as a duplicate of #50007.

@tmandry tmandry closed this as completed Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants