-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)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
Proc macros must not be compiled with -Ztls-model=initial-exec
as -Ztls-model=initial-exec
is incompatible with dlopen. Glibc is somewhat lenient with dlopening dylibs compiled with -Ztls-model=initial-exec
for as long as there is room, but other libc implementations may not provide enough room or provide room at all. For example on FreeBSD trying to use rustc_driver results in the following error:
https://cirrus-ci.com/task/4557776715776000
error: /.rustup/toolchains/nightly-2024-12-28-x86_64-unknown-freebsd/lib/rustlib/x86_64-unknown-freebsd/lib/librustc_fluent_macro-60e8ff74c2f2aaa5.so: No space available for static Thread Local Storage
--> src/lib.rs:16:1
|
16 | extern crate rustc_middle;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
To fix this issue, the set of exclusions at
rust/src/bootstrap/src/bin/rustc.rs
Lines 166 to 173 in ceb0441
// `-Ztls-model=initial-exec` must not be applied to proc-macros, see | |
// issue https://github.com/rust-lang/rust/issues/100530 | |
if env::var("RUSTC_TLS_MODEL_INITIAL_EXEC").is_ok() | |
&& crate_type != Some("proc-macro") | |
&& !matches!(crate_name, Some("proc_macro2" | "quote" | "syn" | "synstructure")) | |
{ | |
cmd.arg("-Ztls-model=initial-exec"); | |
} |
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)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.