[lld] r310526 - Add --icf=none option.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 14:32:38 PDT 2017
Author: ruiu
Date: Wed Aug 9 14:32:38 2017
New Revision: 310526
URL: http://llvm.org/viewvc/llvm-project?rev=310526&view=rev
Log:
Add --icf=none option.
--icf=none negates --icf=all.
Added:
lld/trunk/test/ELF/icf-none.s
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Options.td
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=310526&r1=310525&r2=310526&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Aug 9 14:32:38 2017
@@ -637,7 +637,7 @@ void LinkerDriver::readConfigs(opt::Inpu
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);
Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=310526&r1=310525&r2=310526&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Wed Aug 9 14:32:38 2017
@@ -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">;
Added: lld/trunk/test/ELF/icf-none.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/icf-none.s?rev=310526&view=auto
==============================================================================
--- lld/trunk/test/ELF/icf-none.s (added)
+++ lld/trunk/test/ELF/icf-none.s Wed Aug 9 14:32:38 2017
@@ -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
More information about the llvm-commits
mailing list