Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
shallow = true
[submodule "src/tools/enzyme"]
path = src/tools/enzyme
url = https://github.com/rust-lang/enzyme.git
url = https://github.com/sgasho/enzyme.git
shallow = true
[submodule "src/gcc"]
path = src/gcc
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,14 @@ impl<'a> Linker for GccLinker<'a> {
}
}

if crate_type == CrateType::Dylib
&& self.sess.target.is_like_darwin
&& self.sess.opts.unstable_opts.export_llvm_symbols
&& self.sess.opts.crate_name.as_deref() == Some("rustc_driver")
{
return;
}

// We manually create a list of exported symbols to ensure we don't expose any more.
// The object files have far more public symbols than we actually want to export,
// so we hide them all here.
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,8 @@ options! {
"enable default bounds for experimental group of auto traits"),
export_executable_symbols: bool = (false, parse_bool, [TRACKED],
"export symbols from executables, as if they were dynamic libraries"),
export_llvm_symbols: bool = (false, parse_bool, [TRACKED],
"export LLVM symbols from rustc_driver on darwin"),
external_clangrt: bool = (false, parse_bool, [UNTRACKED],
"rely on user specified linker commands to find clangrt"),
extra_const_ub_checks: bool = (false, parse_bool, [TRACKED],
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,10 @@ pub fn rustc_cargo(
cargo.rustflag("-Zdefault-visibility=protected");
}

if builder.config.llvm_enzyme && target.contains("apple") && build_compiler.stage != 0 {
cargo.rustflag("-Zexport-llvm-symbols");
}

if is_lto_stage(build_compiler) {
match builder.config.rust_lto {
RustcLto::Thin | RustcLto::Fat => {
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ ENV RUST_CONFIGURE_ARGS \
--set llvm.thin-lto=true \
--set llvm.ninja=false \
--set llvm.libzstd=true \
--set llvm.enzyme=true \
--set rust.jemalloc \
--set rust.bootstrap-override-lld=true \
--set rust.lto=thin \
Expand Down
1 change: 1 addition & 0 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ auto:
--enable-full-tools
--enable-sanitizers
--enable-profiler
--set llvm.enzyme=true
--set rust.jemalloc
--set rust.lto=thin
--set rust.codegen-units=1
Expand Down
2 changes: 1 addition & 1 deletion src/tools/opt-dist/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn create_environment(args: Args) -> anyhow::Result<(Environment, Vec<String>)>
// FIXME: Enable bolt for aarch64 once it's fixed upstream. Broken as of December 2024.
.use_bolt(!is_aarch64)
.skipped_tests(vec![])
.run_tests(true)
.run_tests(false)
.fast_try_build(is_fast_try_build)
.build_llvm(true)
.build()?;
Expand Down
Loading