summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-08-09 21:32:38 +0000
committerRui Ueyama <ruiu@google.com>2017-08-09 21:32:38 +0000
commitae704a54729d0a6e2c72b7fd7e364c33a7989f57 (patch)
tree399e9f4ad0ce6bdab4f70b3f1a17aaa45a55e45c
parentab04a08c49623ad3738e53ad2828419a8ffc3246 (diff)
downloadbcm5719-llvm-ae704a54729d0a6e2c72b7fd7e364c33a7989f57.tar.gz
bcm5719-llvm-ae704a54729d0a6e2c72b7fd7e364c33a7989f57.zip
Add --icf=none option.
--icf=none negates --icf=all. llvm-svn: 310526
-rw-r--r--lld/ELF/Driver.cpp2
-rw-r--r--lld/ELF/Options.td4
-rw-r--r--lld/test/ELF/icf-none.s22
3 files changed, 26 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a52693b0537..78b3ed90c30 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -637,7 +637,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->Fini = Args.getLastArgValue(OPT_fini, "_fini");
Config->GcSections = getArg(Args, OPT_gc_sections, OPT_no_gc_sections, false);
Config->GdbIndex = Args.hasArg(OPT_gdb_index);
- Config->ICF = Args.hasArg(OPT_icf);
+ Config->ICF = getArg(Args, OPT_icf_all, OPT_icf_none, false);
Config->Init = Args.getLastArgValue(OPT_init, "_init");
Config->LTOAAPipeline = Args.getLastArgValue(OPT_lto_aa_pipeline);
Config->LTONewPmPasses = Args.getLastArgValue(OPT_lto_newpm_passes);
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 0de0d739fc2..c047b75d11a 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -139,7 +139,9 @@ defm hash_style: Eq<"hash-style">,
def help: F<"help">, HelpText<"Print option help">;
-def icf: F<"icf=all">, HelpText<"Enable identical code folding">;
+def icf_all: F<"icf=all">, HelpText<"Enable identical code folding">;
+
+def icf_none: F<"icf=none">, HelpText<"Disable identical code folding">;
defm image_base : Eq<"image-base">, HelpText<"Set the base address">;
diff --git a/lld/test/ELF/icf-none.s b/lld/test/ELF/icf-none.s
new file mode 100644
index 00000000000..671f2085f66
--- /dev/null
+++ b/lld/test/ELF/icf-none.s
@@ -0,0 +1,22 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld %t -o %t2 --icf=all --icf=none --verbose | FileCheck %s
+
+# CHECK-NOT: selected .text.f1
+
+.globl _start, f1, f2
+_start:
+ ret
+
+.section .text.f1, "ax"
+f1:
+ mov $60, %rax
+ mov $42, %rdi
+ syscall
+
+.section .text.f2, "ax"
+f2:
+ mov $60, %rax
+ mov $42, %rdi
+ syscall
OpenPOWER on IntegriCloud