Skip to content

Commit b6ccc88

Browse files
committed
[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"
Test cleanups. (cherry picked from commit b305b8a)
1 parent e3ac79a commit b6ccc88

11 files changed

+49
-62
lines changed

lld/test/ELF/gc-sections-linkorder.s

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# REQUIRES: x86
2+
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4+
# RUN: ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null | FileCheck %s --implicit-check-not=removing
5+
6+
# CHECK: removing unused section {{.*}}.o:(.foo2)
7+
# CHECK: removing unused section {{.*}}.o:(bar2)
8+
# CHECK: removing unused section {{.*}}.o:(.zed2)
9+
10+
.global _start
11+
_start:
12+
.quad .foo1
13+
14+
.section .foo1,"a"
15+
.quad 0
16+
17+
.section .foo2,"a"
18+
.quad 0
19+
20+
.section bar1,"ao",@progbits,.foo1
21+
.quad .zed1
22+
.quad .foo1
23+
24+
.section bar2,"ao",@progbits,.foo2
25+
.quad .zed2
26+
.quad .foo2
27+
28+
.section .zed1,"a"
29+
.quad 0
30+
31+
.section .zed2,"a"
32+
.quad 0

lld/test/ELF/gc-sections-metadata2.s renamed to lld/test/ELF/gc-sections-linkorder2.s

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# REQUIRES: x86
2-
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3-
# RUN: ld.lld --gc-sections %t.o -o %t
4-
# RUN: llvm-objdump -section-headers %t | FileCheck %s
52

6-
# CHECK: .foo
7-
# CHECK: .bar
8-
# CHECK: .zed
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
4+
# RUN: ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null | count 0
95

106
.globl _start
117
_start:
128
.quad .foo
139

10+
## .foo is retained, so sections linking to it are retained as well.
1411
.section .foo,"a"
1512
.quad 0
1613
.section .bar,"ao",@progbits,.foo

lld/test/ELF/gc-sections-metadata.s

Lines changed: 0 additions & 38 deletions
This file was deleted.

lld/test/ELF/linkorder-err.s

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# REQUIRES: x86
2+
3+
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4+
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
5+
6+
# CHECK: error: a section .foo with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.merge)
7+
8+
.section .merge,"aM",@progbits,8
9+
.quad 0
10+
.section .foo,"ao",@progbits,.merge
11+
.quad 0

lld/test/ELF/section-metadata-err2.s renamed to lld/test/ELF/linkorder-err2.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
55

66
## Check we do not crash and report proper errors.
7-
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}section-metadata-err2.s.tmp.o:(.foo)
8-
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}section-metadata-err2.s.tmp.o:(.foo)
7+
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.foo)
8+
# CHECK-NEXT: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.foo)
99

1010
.section .foo,"aM",@progbits,8
1111
.quad 0

lld/test/ELF/section-metadata-err3.s renamed to lld/test/ELF/linkorder-err3.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
55

66
# CHECK: error: incompatible section flags for .bar
7-
# CHECK-NEXT: >>> {{.*}}section-metadata-err3.s.tmp.o:(.bar): 0x2
7+
# CHECK-NEXT: >>> {{.*}}.o:(.bar): 0x2
88
# CHECK-NEXT: >>> output section .bar: 0x82
99

1010
.section .foo,"a",@progbits

0 commit comments

Comments
 (0)