diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp index 8fc9ac54d04a2..19bf2d1617057 100644 --- a/lld/MinGW/Driver.cpp +++ b/lld/MinGW/Driver.cpp @@ -375,7 +375,9 @@ bool link(ArrayRef argsArr, llvm::raw_ostream &stdoutOS, StringRef s = a->getValue(); if (s == "all") add("-opt:icf"); - else if (s == "safe" || s == "none") + else if (s == "safe") + add("-opt:safeicf"); + else if (s == "none") add("-opt:noicf"); else error("unknown parameter: --icf=" + s); diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test index 1fdd494754af4..a07c95edb580d 100644 --- a/lld/test/MinGW/driver.test +++ b/lld/test/MinGW/driver.test @@ -205,10 +205,12 @@ GC-SECTIONS: -opt:ref RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ICF-NONE %s RUN: ld.lld -### -m i386pep foo.o --icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s RUN: ld.lld -### -m i386pep foo.o -icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s -RUN: ld.lld -### -m i386pep foo.o --icf=safe 2>&1 | FileCheck -check-prefix ICF-NONE %s -RUN: ld.lld -### -m i386pep foo.o -icf=safe 2>&1 | FileCheck -check-prefix ICF-NONE %s ICF-NONE: -opt:noicf +RUN: ld.lld -### -m i386pep foo.o --icf=safe 2>&1 | FileCheck -check-prefix ICF-SAFE %s +RUN: ld.lld -### -m i386pep foo.o -icf=safe 2>&1 | FileCheck -check-prefix ICF-SAFE %s +ICF-SAFE: -opt:safeicf + RUN: ld.lld -### -m i386pep foo.o --icf=all 2>&1 | FileCheck -check-prefix ICF %s RUN: ld.lld -### -m i386pep foo.o -icf=all 2>&1 | FileCheck -check-prefix ICF %s RUN: ld.lld -### -m i386pep foo.o --icf all 2>&1 | FileCheck -check-prefix ICF %s