This repository was archived by the owner on Feb 5, 2019. It is now read-only.
File tree 10 files changed +17
-22
lines changed 10 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -425,17 +425,11 @@ template <class ELFT> void ICF<ELFT>::run() {
425
425
log (" ICF needed " + Twine (Cnt) + " iterations" );
426
426
427
427
auto Print = [&](const Twine &Prefix, size_t I) {
428
- if (!Config->PrintIcfSections && ! errorHandler (). Verbose )
428
+ if (!Config->PrintIcfSections )
429
429
return ;
430
- std::string Filename =
431
- Sections[I]->File ? Sections[I]->File ->getName () : " <internal>" ;
432
- std::string S = (Prefix + " section '" + Sections[I]->Name +
433
- " ' from file '" + Filename + " '" )
434
- .str ();
435
- if (Config->PrintIcfSections )
436
- message (S);
437
- else
438
- log (S);
430
+ InputSection *S = Sections[I];
431
+ std::string File = S->File ? S->File ->getName () : " <internal>" ;
432
+ message (Prefix + " section '" + S->Name + " ' from file '" + File + " '" );
439
433
};
440
434
441
435
// Merge sections by the equivalence class.
Original file line number Diff line number Diff line change 2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-absolute.s -o %t2
5
- # RUN: ld.lld %t %t2 -o %t3 --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t %t2 -o %t3 --icf=all --print-icf-sections | FileCheck %s
6
6
7
7
# CHECK: selected section '.text.f1' from file
8
8
# CHECK: removing identical section '.text.f2' from file
Original file line number Diff line number Diff line change 1
1
# REQUIRES: x86
2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
- # RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
4
+ # RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
5
5
6
6
# CHECK: selected section '.text.f1' from file [[T:'.*']]
7
7
# CHECK: removing identical section '.text.f2' from file [[T]]
Original file line number Diff line number Diff line change 2
2
# This test is to make sure that we can handle implicit addends properly.
3
3
4
4
# RUN: llvm-mc -filetype=obj -triple=i386-unknown-linux %s -o %t
5
- # RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections 2>&1 | FileCheck %s
6
6
7
7
# CHECK: selected section '.text.f1' from file [[T:'.*']]
8
8
# CHECK: removing identical section '.text.f2' from file [[T]]
Original file line number Diff line number Diff line change 2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge-sec.s -o %t2
5
- # RUN: ld.lld %t %t2 -o %t3 --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t %t2 -o %t3 --icf=all --print-icf-sections | FileCheck %s
6
6
7
7
# CHECK: selected section '.text.f1' from file
8
8
# CHECK: removing identical section '.text.f2' from file
Original file line number Diff line number Diff line change 2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge.s -o %t1
5
- # RUN: ld.lld %t %t1 -o %t1.out --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t %t1 -o %t1.out --icf=all --print-icf-sections | FileCheck %s
6
6
7
7
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge2.s -o %t2
8
- # RUN: ld.lld %t %t2 -o %t3.out --icf=all --verbose 2>&1 | FileCheck --check-prefix=NOMERGE %s
8
+ # RUN: ld.lld %t %t2 -o %t3.out --icf=all --print-icf-sections | FileCheck --check-prefix=NOMERGE %s
9
9
10
10
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/icf-merge3.s -o %t3
11
- # RUN: ld.lld %t %t3 -o %t3.out --icf=all --verbose 2>&1 | FileCheck --check-prefix=NOMERGE %s
11
+ # RUN: ld.lld %t %t3 -o %t3.out --icf=all --print-icf-sections | FileCheck --check-prefix=NOMERGE %s
12
12
13
13
# CHECK: selected section '.text.f1' from file
14
14
# CHECK: removing identical section '.text.f2' from file
Original file line number Diff line number Diff line change 1
1
# REQUIRES: x86
2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
- # RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
4
+ # RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
5
5
6
6
# CHECK: selected section '.text.f1' from file [[T:'.*']]
7
7
# CHECK: removing identical section '.text.f2' from file [[T]]
Original file line number Diff line number Diff line change 2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/icf2.s -o %t2
5
- # RUN: ld.lld %t1 %t2 -o %t --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t1 %t2 -o %t --icf=all --print-icf-sections 2>&1 | FileCheck %s
6
6
7
7
# CHECK: selected section '.text.f1' from file
8
8
# CHECK: removing identical section '.text.f2' from file
Original file line number Diff line number Diff line change 1
1
# REQUIRES: x86
2
2
3
3
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4
- # RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
4
+ # RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections | FileCheck %s
5
5
# RUN: llvm-objdump -t %t2 | FileCheck -check-prefix=ALIGN %s
6
6
7
7
# CHECK: selected section '.text.f1' from file [[T:'.*']]
Original file line number Diff line number Diff line change 2
2
3
3
### Make sure that we do not merge data.
4
4
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
5
- # RUN: ld.lld %t -o %t2 --icf=all --verbose 2>&1 | FileCheck %s
5
+ # RUN: ld.lld %t -o %t2 --icf=all --verbose --print-icf-sections 2>&1 | FileCheck %s
6
6
# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=SEC %s
7
7
8
8
# SEC: .rodata PROGBITS 0000000000200120 000120 000002 00 A 0 0 1
11
11
# CHECK-NOT: selected section '.rodata.d2'
12
12
13
13
# We do merge rodata if passed --icf-data
14
- # RUN: ld.lld %t -o %t2 --icf=all --verbose --ignore-data-address-equality 2>&1 | FileCheck --check-prefix=DATA %s
14
+ # RUN: ld.lld %t -o %t2 --icf=all --print-icf-sections --ignore-data-address-equality | \
15
+ # RUN: FileCheck --check-prefix=DATA %s
15
16
# RUN: llvm-readelf -S -W %t2 | FileCheck --check-prefix=DATA-SEC %s
16
17
17
18
# DATA: selected section '.rodata.d1' from file [[T:'.*']]
You can’t perform that action at this time.
0 commit comments