[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"

Test cleanups.
This commit is contained in:
Fangrui Song 2020-02-26 16:24:58 -08:00
parent c965fd942f
commit b305b8a256
11 changed files with 49 additions and 62 deletions

View File

@ -0,0 +1,32 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null | FileCheck %s --implicit-check-not=removing
# CHECK: removing unused section {{.*}}.o:(.foo2)
# CHECK: removing unused section {{.*}}.o:(bar2)
# CHECK: removing unused section {{.*}}.o:(.zed2)
.global _start
_start:
.quad .foo1
.section .foo1,"a"
.quad 0
.section .foo2,"a"
.quad 0
.section bar1,"ao",@progbits,.foo1
.quad .zed1
.quad .foo1
.section bar2,"ao",@progbits,.foo2
.quad .zed2
.quad .foo2
.section .zed1,"a"
.quad 0
.section .zed2,"a"
.quad 0

View File

@ -1,16 +1,13 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld --gc-sections %t.o -o %t
# RUN: llvm-objdump -section-headers %t | FileCheck %s
# CHECK: .foo
# CHECK: .bar
# CHECK: .zed
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld --gc-sections --print-gc-sections %t.o -o /dev/null | count 0
.globl _start
_start:
.quad .foo
## .foo is retained, so sections linking to it are retained as well.
.section .foo,"a"
.quad 0
.section .bar,"ao",@progbits,.foo

View File

@ -1,38 +0,0 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld --gc-sections %t.o -o %t
# RUN: llvm-objdump -section-headers %t | FileCheck %s
# CHECK: 1 .foo1
# CHECK-NEXT: bar1
# CHECK-NEXT: .zed1
# CHECK-NEXT: .text
# CHECK-NEXT: .comment
# CHECK-NEXT: .symtab
# CHECK-NEXT: .shstrtab
# CHECK-NEXT: .strtab
.global _start
_start:
.quad .foo1
.section .foo1,"a"
.quad 0
.section .foo2,"a"
.quad 0
.section bar1,"ao",@progbits,.foo1
.quad .zed1
.quad .foo1
.section bar2,"ao",@progbits,.foo2
.quad .zed2
.quad .foo2
.section .zed1,"a"
.quad 0
.section .zed2,"a"
.quad 0

View File

@ -0,0 +1,11 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: error: a section .foo with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.merge)
.section .merge,"aM",@progbits,8
.quad 0
.section .foo,"ao",@progbits,.merge
.quad 0

View File

@ -4,8 +4,8 @@
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
## Check we do not crash and report proper errors.
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}section-metadata-err2.s.tmp.o:(.foo)
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}section-metadata-err2.s.tmp.o:(.foo)
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.foo)
# CHECK-NEXT: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}.o:(.foo)
.section .foo,"aM",@progbits,8
.quad 0

View File

@ -4,7 +4,7 @@
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: error: incompatible section flags for .bar
# CHECK-NEXT: >>> {{.*}}section-metadata-err3.s.tmp.o:(.bar): 0x2
# CHECK-NEXT: >>> {{.*}}.o:(.bar): 0x2
# CHECK-NEXT: >>> output section .bar: 0x82
.section .foo,"a",@progbits

View File

@ -1,15 +0,0 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: error: a section .bar with SHF_LINK_ORDER should not refer a non-regular section: {{.*}}section-metadata-err.s.tmp.o:(.foo)
.global _start
_start:
.quad .foo
.section .foo,"aM",@progbits,8
.quad 0
.section .bar,"ao",@progbits,.foo