rust/compiler/rustc_codegen_llvm/src
bors 96fe3c31c2 Auto merge of #147022 - Zalathar:no-args, r=wesleywiser
Remove current code for embedding command-line args in PDB

The compiler currently has code that will obtain a list of quoted command-line arguments, and pass it through to TargetMachine creation, so that the command-line args can be embedded in PDB output.

This PR removes that code, due to subtle concerns that might not have been apparent when it was originally added.

---

Those concerns include:
- The entire command-line quoting process is repeated every time a target-machine-factory is created. In incremental builds this typically occurs 500+ times, instead of happening only once. The repeated quoting constitutes a large chunk of instructions executed in the `large-workspace` benchmark.
  - See https://github.com/rust-lang/rust/pull/146804#issuecomment-3317322958 for an example of the perf consequences of skipping all that work.
  - This overhead occurs even when building for targets or configurations that don't emit PDB output.
- Command-line arguments are obtained in a way that completely bypasses the query system, which is a problem for the integrity of incremental compilation.
  - Fixing this alone is likely to inhibit incremental rebuilds for most or all CGUs, even in builds that don't emit PDB output.
- Command-line arguments and the executable path are obtained in a way that completely bypasses the compiler's path-remapping system, which is a reproducibility hazard.
  - https://github.com/rust-lang/rust/issues/128842

---

Relevant PRs:
- https://github.com/rust-lang/rust/pull/113492
- https://github.com/rust-lang/rust/pull/130446
- https://github.com/rust-lang/rust/pull/131805
- https://github.com/rust-lang/rust/pull/146700
- https://github.com/rust-lang/rust/pull/146973

Zulip thread:
- https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Some.20PDB.20info.20bypasses.20the.20query.20system.20and.20path.20remapping/with/541432211

---

According to rust-lang/rust#96475, one of the big motivations for embedding the command-line arguments was to enable tools like Live++. [It appears that Live++ doesn't actually support Rust yet](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/embeded.20compiler.20args.20and.20--remap-path-prefix/near/523800010), so it's possible that there aren't any existing workflows for this removal to break.

In the future, there could be a case for reintroducing some or all of this functionality, guarded behind an opt-in flag so that it doesn't cause problems for other users. But as it stands, the current implementation puts a disproportionate burden on other users and on compiler maintainers.
2025-10-22 00:21:08 +00:00
..
back Remove current code for embedding command-line args in PDB 2025-10-18 12:24:40 +11:00
builder Auto merge of #142696 - ZuseZ4:offload-device1, r=oli-obk 2025-10-20 10:17:29 +00:00
coverageinfo use declarative macro for #[derive(TryFromU32)] 2025-10-06 14:54:38 +00:00
debuginfo Use LLVMDIBuilderCreateGlobalVariableExpression 2025-10-12 23:36:26 +11:00
llvm Auto merge of #147022 - Zalathar:no-args, r=wesleywiser 2025-10-22 00:21:08 +00:00
abi.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
allocator.rs miri: use allocator_shim_contents codegen helper 2025-10-15 21:23:14 +02:00
asm.rs Allow vector-scalar (vs) registers in ppc inline assembly 2025-10-14 09:52:56 -05:00
attributes.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
base.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
builder.rs remove intrinsic wrapper functions from LLVM bindings 2025-10-09 09:26:44 +02:00
callee.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
common.rs Fix ICE on offsetted ZST pointer 2025-10-15 20:06:46 -04:00
consts.rs refactor: Remove LLVMRustInsertPrivateGlobal and define_private_global 2025-10-08 21:59:48 +02:00
context.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
declare.rs refactor: Remove LLVMRustInsertPrivateGlobal and define_private_global 2025-10-08 21:59:48 +02:00
errors.rs Use the object crate rather than LLVM for extracting bitcode sections 2025-07-25 11:21:28 +00:00
intrinsic.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
lib.rs Rollup merge of #147526 - bjorn3:alloc_shim_weak_shape, r=petrochenkov,RalfJung 2025-10-14 19:47:29 +02:00
llvm_util.rs Add panic=immediate-abort 2025-09-21 13:12:18 -04:00
macros.rs use declarative macro for #[derive(TryFromU32)] 2025-10-06 14:54:38 +00:00
mono_item.rs Replace the llvm::Bool typedef with a proper newtype 2025-08-24 23:09:54 +10:00
type_.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
type_of.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
typetree.rs autodiff: typetree recursive depth query from enzyme with fallback 2025-09-19 05:42:27 +00:00
va_arg.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00
value.rs Consistently import llvm::Type and llvm::Value 2025-10-06 13:09:16 +11:00