Skip to content

Commit d29ea12

Browse files
committed
address maskray review comments
1 parent 635d348 commit d29ea12

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

lld/ELF/ICF.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ template <class ELFT> void ICF<ELFT>::run() {
602602
fold(sym);
603603
auto it = symbolEquivalence.findLeader(sym);
604604
if (it != symbolEquivalence.member_end() && *it != sym) {
605-
print() << "Redirecting " << sym->getName() << " to " << (*it)->getName();
605+
print() << "redirecting '" << sym->getName() << "' in symtab to '" << (*it)->getName() << "'";
606606
ctx.symtab->redirect(sym, *it);
607607
}
608608
}
@@ -612,8 +612,8 @@ template <class ELFT> void ICF<ELFT>::run() {
612612
for (Symbol *&sym : file->getMutableGlobalSymbols()) {
613613
auto it = symbolEquivalence.findLeader(sym);
614614
if (it != symbolEquivalence.member_end() && *it != sym) {
615-
print() << "Redirecting " << sym->getName() << " to "
616-
<< (*it)->getName();
615+
print() << "redirecting '" << sym->getName() << "' to '"
616+
<< (*it)->getName() << "'";
617617
sym = *it;
618618
}
619619
}

lld/test/ELF/aarch64-got-merging-icf.s

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
// REQUIRES: aarch64
22

33
# RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t
4+
# RUN: llvm-mc -filetype=obj -crel -triple=aarch64 %s -o %tcrel
45
# RUN: ld.lld %t -o %t2 --icf=all
6+
# RUN: ld.lld %tcrel -o %tcrel2 --icf=all
7+
58
# RUN: llvm-objdump --section-headers %t2 | FileCheck %s --check-prefix=EXE
9+
# RUN: llvm-objdump --section-headers %tcrel2 | FileCheck %s --check-prefix=EXE
610

711
# RUN: ld.lld -shared %t -o %t3 --icf=all
12+
# RUN: ld.lld -shared %tcrel -o %tcrel3 --icf=all
13+
814
# RUN: llvm-objdump --section-headers %t3 | FileCheck %s --check-prefix=DSO
15+
# RUN: llvm-objdump --section-headers %tcrel3 | FileCheck %s --check-prefix=DSO
916

10-
## All .rodata.* sections should merge into a single GOT entry
17+
## All global g* symbols should merge into a single GOT entry while non-global
18+
## gets its own GOT entry.
1119
# EXE: {{.*}}.got 00000010{{.*}}
1220

1321
## When symbols are preemptible in DSO mode, GOT entries wouldn't be merged
@@ -50,7 +58,8 @@ bl f1_\index
5058

5159
.endm
5260

53-
# another set of sections merging: g1 <- g2
61+
## Another set of sections merging: g1 <- g2. Linker should be able to
62+
## resolve both g1 and g2 to g0 based on ICF on previous sections.
5463

5564
.section .text.t1_0,"ax",@progbits
5665
t1_0:

lld/test/ELF/icf-preemptible.s

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@
1717
# EXE-NEXT: selected section {{.*}}:(.text.h1)
1818
# EXE-NEXT: removing identical section {{.*}}:(.text.h2)
1919
# EXE-NEXT: removing identical section {{.*}}:(.text.h3)
20-
# EXE-NEXT: Redirecting f2 to f1
21-
# EXE-NEXT: Redirecting g2 to g1
22-
# EXE-NEXT: Redirecting g3 to g1
20+
# EXE-NEXT: redirecting 'f2' in symtab to 'f1'
21+
# EXE-NEXT: redirecting 'g2' in symtab to 'g1'
22+
# EXE-NEXT: redirecting 'g3' in symtab to 'g1'
23+
# EXE-NEXT: redirecting 'f2' to 'f1'
24+
# EXE-NEXT: redirecting 'g2' to 'g1'
25+
# EXE-NEXT: redirecting 'g3' to 'g1'
26+
# EXE-NOT: {{.}}
2327

2428
## Definitions are preemptible in a DSO. Only leaf functions can be folded.
2529
# DSO-NOT: {{.}}

0 commit comments

Comments
 (0)