Skip to content

Commit a6c8c7d

Browse files
committed
Always pass /DEBUG flag to MSVC linker
Closes #28448.
1 parent fb5de8c commit a6c8c7d

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/librustc_trans/back/linker.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use back::archive;
1919
use metadata::csearch;
2020
use middle::dependency_format::Linkage;
2121
use session::Session;
22-
use session::config::DebugInfoLevel::{NoDebugInfo, LimitedDebugInfo, FullDebugInfo};
2322
use session::config::CrateTypeDylib;
2423
use session::config;
2524
use syntax::ast;
@@ -286,17 +285,9 @@ impl<'a> Linker for MsvcLinker<'a> {
286285
}
287286

288287
fn debuginfo(&mut self) {
289-
match self.sess.opts.debuginfo {
290-
NoDebugInfo => {
291-
// Do nothing if debuginfo is disabled
292-
},
293-
LimitedDebugInfo |
294-
FullDebugInfo => {
295-
// This will cause the Microsoft linker to generate a PDB file
296-
// from the CodeView line tables in the object files.
297-
self.cmd.arg("/DEBUG");
298-
}
299-
}
288+
// This will cause the Microsoft linker to generate a PDB file
289+
// from the CodeView line tables in the object files.
290+
self.cmd.arg("/DEBUG");
300291
}
301292

302293
fn whole_archives(&mut self) {

src/test/run-make/output-type-permutations/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ all:
55
$(call REMOVE_RLIBS,bar)
66
$(call REMOVE_DYLIBS,bar)
77
rm $(TMPDIR)/libbar.a
8-
rm -f $(TMPDIR)/bar.{exp,lib}
8+
rm -f $(TMPDIR)/bar.{exp,lib,pdb}
99
# Check that $(TMPDIR) is empty.
1010
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
1111

1212
$(RUSTC) foo.rs --crate-type=bin
1313
rm $(TMPDIR)/$(call BIN,bar)
14+
rm -f $(TMPDIR)/bar.pdb
1415
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
1516

1617
$(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link
@@ -19,6 +20,7 @@ all:
1920
rm $(TMPDIR)/bar.s
2021
rm $(TMPDIR)/bar.o
2122
rm $(TMPDIR)/$(call BIN,bar)
23+
rm -f $(TMPDIR)/bar.pdb
2224
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
2325

2426
$(RUSTC) foo.rs --emit=asm -o $(TMPDIR)/foo
@@ -39,6 +41,7 @@ all:
3941

4042
$(RUSTC) foo.rs --emit=link -o $(TMPDIR)/$(call BIN,foo)
4143
rm $(TMPDIR)/$(call BIN,foo)
44+
rm -f $(TMPDIR)/foo.pdb
4245
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
4346

4447
$(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo
@@ -47,7 +50,7 @@ all:
4750

4851
$(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/$(call BIN,foo)
4952
rm $(TMPDIR)/$(call BIN,foo)
50-
rm -f $(TMPDIR)/foo.{exp,lib}
53+
rm -f $(TMPDIR)/foo.{exp,lib,pdb}
5154
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
5255

5356
$(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo
@@ -56,6 +59,7 @@ all:
5659

5760
$(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/$(call BIN,foo)
5861
rm $(TMPDIR)/$(call BIN,foo)
62+
rm -f $(TMPDIR)/foo.pdb
5963
[ "$$(ls -1 $(TMPDIR) | wc -l)" -eq "0" ]
6064

6165
$(RUSTC) foo.rs --emit=asm,llvm-ir,llvm-bc,obj,link --crate-type=staticlib

0 commit comments

Comments
 (0)