-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
cdylib link error after TLS unused -> used transition #69798
Copy link
Copy link
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-incr-compArea: Incremental compilationArea: Incremental compilationA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesA-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-incr-compArea: Incremental compilationArea: Incremental compilationA-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesA-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Type
Fields
Give feedbackNo fields configured for issues without a type.
From nightly-2020-02-28 (nightly-2020-02-27 was fine), I get link errors if I compile a cdylib with a thread local that isn't used, then compile again after referencing the thread local.
To reproduce, create a.rs:
Then run:
Uncomment the commented line and rerun the above command.
This produces the following link error:
It's possible however that the underlying bug is actually older though, since at opt-level=1, I get link errors from 1.32.0 onwards (1.31.0 was fine). In that case, the Drop implementation isn't needed.
Linking fails with:
undefined reference to 'core::ptr::drop_in_place'The exact symbol that's reported varies.
Versions:
rustc 1.43.0-nightly (2890b37 2020-03-06)
cc (Debian 9.2.1-16) 9.2.1 20191030
GNU ld (GNU Binutils for Debian) 2.33.1