[PATCH] D37119: lld-link: Use opt:noref by default in debug builds
Alex Telishev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 14:57:48 PDT 2017
alex.telishev updated this revision to Diff 112615.
alex.telishev added a comment.
Fixed tests and added test for /DEBUG implying /opt:noref.
https://reviews.llvm.org/D37119
Files:
lld/COFF/Driver.cpp
lld/test/COFF/icf-associative.test
lld/test/COFF/icf-simple.test
lld/test/COFF/pdb-global-gc.yaml
Index: lld/test/COFF/pdb-global-gc.yaml
===================================================================
--- lld/test/COFF/pdb-global-gc.yaml
+++ lld/test/COFF/pdb-global-gc.yaml
@@ -1,7 +1,7 @@
# RUN: yaml2obj %s -o %t.obj
# RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc -filetype=obj -o %t2.obj
-# RUN: lld-link %t.obj %t2.obj -debug -entry:main \
-# RUN: -nodefaultlib -debug -out:%t.exe -pdb:%t.pdb -verbose
+# RUN: lld-link %t.obj %t2.obj -debug -opt:ref -entry:main \
+# RUN: -nodefaultlib -debug -opt:ref -out:%t.exe -pdb:%t.pdb -verbose
# RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s
# This tests the case where an __imp_ chunk is discarded by linker GC. The debug
Index: lld/test/COFF/icf-simple.test
===================================================================
--- lld/test/COFF/icf-simple.test
+++ lld/test/COFF/icf-simple.test
@@ -12,6 +12,9 @@
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /verbose /opt:noref,noicf %t.obj > %t.log 2>&1
# RUN: FileCheck -check-prefix=NOICF %s < %t.log
+# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
+# RUN: /verbose /debug %t.obj > %t.log 2>&1
+# RUN: FileCheck -check-prefix=NOICF %s < %t.log
# NOICF-NOT: Removed foo
# NOICF-NOT: Removed bar
Index: lld/test/COFF/icf-associative.test
===================================================================
--- lld/test/COFF/icf-associative.test
+++ lld/test/COFF/icf-associative.test
@@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
-# RUN: /debug /verbose %t.obj > %t.log 2>&1
+# RUN: /debug /opt:icf /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log
# CHECK: Selected foo
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -756,15 +756,6 @@
if (Args.hasArg(OPT_force) || Args.hasArg(OPT_force_unresolved))
Config->Force = true;
- // Handle /debug
- if (Args.hasArg(OPT_debug)) {
- Config->Debug = true;
- Config->DebugTypes =
- Args.hasArg(OPT_debugtype)
- ? parseDebugType(Args.getLastArg(OPT_debugtype)->getValue())
- : getDefaultDebugType(Args);
- }
-
// Create a dummy PDB file to satisfy build sytem rules.
if (auto *Arg = Args.getLastArg(OPT_pdb))
Config->PDBPath = Arg->getValue();
@@ -842,6 +833,19 @@
if (auto *Arg = Args.getLastArg(OPT_implib))
Config->Implib = Arg->getValue();
+ // Handle /debug
+ if (Args.hasArg(OPT_debug)) {
+ Config->Debug = true;
+ Config->DebugTypes =
+ Args.hasArg(OPT_debugtype)
+ ? parseDebugType(Args.getLastArg(OPT_debugtype)->getValue())
+ : getDefaultDebugType(Args);
+
+ // msvc linker uses /opt:noref by default in debug builds
+ Config->DoGC = false;
+ Config->DoICF = false;
+ }
+
// Handle /opt
for (auto *Arg : Args.filtered(OPT_opt)) {
std::string Str = StringRef(Arg->getValue()).lower();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37119.112615.patch
Type: text/x-patch
Size: 3092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170824/f0b3f2b0/attachment.bin>
More information about the llvm-commits
mailing list