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

Replace libLLVM symlink with linker script #121967

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2035,10 +2035,18 @@ fn install_llvm_file(
// If we have a symlink like libLLVM-18.so -> libLLVM.so.18.1, install the target of the
// symlink, which is what will actually get loaded at runtime.
builder.install(&t!(fs::canonicalize(source)), destination, 0o644);

let full_dest = destination.join(source.file_name().unwrap());
if install_symlink {
// If requested, also install the symlink. This is used by download-ci-llvm.
let full_dest = destination.join(source.file_name().unwrap());
// For download-ci-llvm, also install the symlink, to match what LLVM does. Using a
// symlink is fine here, as this is not a rustup component.
builder.copy(&source, &full_dest);
} else {
// Otherwise, replace the symlink with an equivalent linker script. This is used when
// projects like miri link against librustc_driver.so. We don't use a symlink, as
// these are not allowed inside rustup components.
let link = t!(fs::read_link(source));
t!(std::fs::write(full_dest, format!("INPUT({})\n", link.display())));
}
} else {
builder.install(&source, destination, 0o644);
Expand Down
Loading