-
-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Static and const variables definitions ignore visiblity and link section #146538
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/Target: WASM (WebAssembly), http://webassembly.org/T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
I am working on an Emscripten library for Rust, and Emscripten itself heavily relies on link time trickery, which breaks when symbols are not exported with the right visibility, into the right section.
The following code produces unexpected results:
I expected to see
MYSCRIPTin the LLVM IR to useglobal, placed intomysection.Instead, I saw the following in the IR:
It is clearly visible that the
#[used]attribute is respected.However, the section is not forwarded to the declaration and
internal constantis also incorrect, because I want to export the symbol globally.Meta
rustc --version --verbose: