Skip to content

Commit c6a64ee

Browse files
committed
Remove current code for embedding command-line args in PDB
1 parent ae12bc2 commit c6a64ee

File tree

17 files changed

+1
-160
lines changed

17 files changed

+1
-160
lines changed

compiler/rustc_codegen_llvm/src/back/command_line_args.rs

Lines changed: 0 additions & 37 deletions
This file was deleted.

compiler/rustc_codegen_llvm/src/back/command_line_args/tests.rs

Lines changed: 0 additions & 25 deletions
This file was deleted.

compiler/rustc_codegen_llvm/src/back/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pub(crate) mod archive;
2-
mod command_line_args;
32
pub(crate) mod lto;
43
pub(crate) mod owned_target_machine;
54
mod profiling;

compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ impl OwnedTargetMachine {
3838
output_obj_file: &CStr,
3939
debug_info_compression: &CStr,
4040
use_emulated_tls: bool,
41-
argv0: &str,
42-
command_line_args: &str,
4341
use_wasm_eh: bool,
4442
) -> Result<Self, LlvmError<'static>> {
4543
// SAFETY: llvm::LLVMRustCreateTargetMachine copies pointed to data
@@ -66,10 +64,6 @@ impl OwnedTargetMachine {
6664
output_obj_file.as_ptr(),
6765
debug_info_compression.as_ptr(),
6866
use_emulated_tls,
69-
argv0.as_ptr(),
70-
argv0.len(),
71-
command_line_args.as_ptr(),
72-
command_line_args.len(),
7367
use_wasm_eh,
7468
)
7569
};

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use rustc_span::{BytePos, InnerSpan, Pos, SpanData, SyntaxContext, sym};
3131
use rustc_target::spec::{CodeModel, FloatAbi, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
3232
use tracing::{debug, trace};
3333

34-
use crate::back::command_line_args::quote_command_line_args;
3534
use crate::back::lto::ThinBuffer;
3635
use crate::back::owned_target_machine::OwnedTargetMachine;
3736
use crate::back::profiling::{
@@ -253,19 +252,6 @@ pub(crate) fn target_machine_factory(
253252

254253
let use_emulated_tls = matches!(sess.tls_model(), TlsModel::Emulated);
255254

256-
// Command-line information to be included in the target machine.
257-
// This seems to only be used for embedding in PDB debuginfo files.
258-
// FIXME(Zalathar): Maybe skip this for non-PDB targets?
259-
let argv0 = std::env::current_exe()
260-
.unwrap_or_default()
261-
.into_os_string()
262-
.into_string()
263-
.unwrap_or_default();
264-
let command_line_args = quote_command_line_args(&sess.expanded_args);
265-
// Self-profile counter for the number of bytes produced by command-line quoting.
266-
// Values are summed, so the summary result is cumulative across all TM factories.
267-
sess.prof.artifact_size("quoted_command_line_args", "-", command_line_args.len() as u64);
268-
269255
let debuginfo_compression = sess.opts.debuginfo_compression.to_string();
270256
match sess.opts.debuginfo_compression {
271257
rustc_session::config::DebugInfoCompression::Zlib => {
@@ -326,8 +312,6 @@ pub(crate) fn target_machine_factory(
326312
&output_obj_file,
327313
&debuginfo_compression,
328314
use_emulated_tls,
329-
&argv0,
330-
&command_line_args,
331315
use_wasm_eh,
332316
)
333317
})

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,10 +2492,6 @@ unsafe extern "C" {
24922492
OutputObjFile: *const c_char,
24932493
DebugInfoCompression: *const c_char,
24942494
UseEmulatedTls: bool,
2495-
Argv0: *const c_uchar, // See "PTR_LEN_STR".
2496-
Argv0Len: size_t,
2497-
CommandLineArgs: *const c_uchar, // See "PTR_LEN_STR".
2498-
CommandLineArgsLen: size_t,
24992495
UseWasmEH: bool,
25002496
) -> *mut TargetMachine;
25012497

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,6 @@ pub struct CodegenContext<B: WriteBackendMethods> {
346346
pub split_dwarf_kind: rustc_session::config::SplitDwarfKind,
347347
pub pointer_size: Size,
348348

349-
/// All commandline args used to invoke the compiler, with @file args fully expanded.
350-
/// This will only be used within debug info, e.g. in the pdb file on windows
351-
/// This is mainly useful for other tools that reads that debuginfo to figure out
352-
/// how to call the compiler with the same arguments.
353-
pub expanded_args: Vec<String>,
354-
355349
/// Emitter to use for diagnostics produced during codegen.
356350
pub diag_emitter: SharedEmitter,
357351
/// LLVM optimizations for which we want to print remarks.
@@ -1153,7 +1147,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
11531147
remark: sess.opts.cg.remark.clone(),
11541148
remark_dir,
11551149
incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()),
1156-
expanded_args: tcx.sess.expanded_args.clone(),
11571150
diag_emitter: shared_emitter.clone(),
11581151
output_filenames: Arc::clone(tcx.output_filenames(())),
11591152
module_config: regular_config,

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send))
269269
make_codegen_backend: None,
270270
registry: diagnostics_registry(),
271271
using_internal_features: &USING_INTERNAL_FEATURES,
272-
expanded_args: args,
273272
};
274273

275274
callbacks.config(&mut config);

compiler/rustc_interface/src/interface.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,6 @@ pub struct Config {
376376
/// enabled. Makes it so that "please report a bug" is hidden, as ICEs with
377377
/// internal features are wontfix, and they are usually the cause of the ICEs.
378378
pub using_internal_features: &'static std::sync::atomic::AtomicBool,
379-
380-
/// All commandline args used to invoke the compiler, with @file args fully expanded.
381-
/// This will only be used within debug info, e.g. in the pdb file on windows
382-
/// This is mainly useful for other tools that reads that debuginfo to figure out
383-
/// how to call the compiler with the same arguments.
384-
pub expanded_args: Vec<String>,
385379
}
386380

387381
/// Initialize jobserver before getting `jobserver::client` and `build_session`.
@@ -480,7 +474,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
480474
util::rustc_version_str().unwrap_or("unknown"),
481475
config.ice_file,
482476
config.using_internal_features,
483-
config.expanded_args,
484477
);
485478

486479
codegen_backend.init(&sess);

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
271271
bool TrapUnreachable, bool Singlethread, bool VerboseAsm,
272272
bool EmitStackSizeSection, bool RelaxELFRelocations, bool UseInitArray,
273273
const char *SplitDwarfFile, const char *OutputObjFile,
274-
const char *DebugInfoCompression, bool UseEmulatedTls, const char *Argv0,
275-
size_t Argv0Len, const char *CommandLineArgs, size_t CommandLineArgsLen,
276-
bool UseWasmEH) {
274+
const char *DebugInfoCompression, bool UseEmulatedTls, bool UseWasmEH) {
277275

278276
auto OptLevel = fromRust(RustOptLevel);
279277
auto RM = fromRust(RustReloc);
@@ -344,11 +342,6 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
344342

345343
Options.EmitStackSizeSection = EmitStackSizeSection;
346344

347-
if (Argv0 != nullptr)
348-
Options.MCOptions.Argv0 = {Argv0, Argv0Len};
349-
if (CommandLineArgs != nullptr)
350-
Options.MCOptions.CommandlineArgs = {CommandLineArgs, CommandLineArgsLen};
351-
352345
#if LLVM_VERSION_GE(21, 0)
353346
TargetMachine *TM = TheTarget->createTargetMachine(Trip, CPU, Feature,
354347
Options, RM, CM, OptLevel);

0 commit comments

Comments
 (0)