Commit dddd37d9 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r310526:

------------------------------------------------------------------------
r310526 | ruiu | 2017-08-09 14:32:38 -0700 (Wed, 09 Aug 2017) | 3 lines

Add --icf=none option.

--icf=none negates --icf=all.
------------------------------------------------------------------------

llvm-svn: 310656
parent cdfccb83
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,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);
+3 −1
Original line number Diff line number Diff line
@@ -126,7 +126,9 @@ def hash_style: S<"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">;

def image_base : J<"image-base=">, HelpText<"Set the base address">;

+22 −0
Original line number Diff line number Diff line
# 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