COFF: Enable ICF by default.

MSVC linker enables ICF as long as /opt:ref is eanbled, so do we.

llvm-svn: 247817
This commit is contained in:
Rui Ueyama 2015-09-16 16:41:38 +00:00
parent c04d5dbf20
commit b02a320f5e
5 changed files with 5 additions and 6 deletions

View File

@ -66,6 +66,7 @@ struct Configuration {
bool NoEntry = false;
std::string OutputFile;
bool DoGC = true;
bool DoICF = true;
bool Relocatable = true;
bool Force = false;
bool Debug = false;
@ -88,9 +89,6 @@ struct Configuration {
DefinedRelative *SEHTable = nullptr;
DefinedAbsolute *SEHCount = nullptr;
// True if /opt:icf is specified.
bool DoICF = false;
// Used for /opt:lldlto=N
unsigned LTOOptLevel = 2;

View File

@ -367,6 +367,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
std::string S = StringRef(Arg->getValue()).lower();
if (S == "noref") {
Config->DoGC = false;
Config->DoICF = false;
continue;
}
if (S == "icf" || StringRef(S).startswith("icf=")) {

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1
# RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log
# CHECK: Selected foo

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1
# RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log
# CHECK: Selected foo

View File

@ -1,6 +1,6 @@
# RUN: yaml2obj < %s > %t.obj
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
# RUN: /opt:icf /verbose %t.obj > %t.log 2>&1
# RUN: /verbose %t.obj > %t.log 2>&1
# RUN: FileCheck %s < %t.log
# CHECK: Selected foo