[llvm-branch-commits] [lld] b6ccc88 - [ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 14 22:36:17 PDT 2020


Author: Fangrui Song
Date: 2020-04-14T22:31:55-07:00
New Revision: b6ccc88d575c78cb6cfebf545ef2c8d159cbdf3c

URL: https://github.com/llvm/llvm-project/commit/b6ccc88d575c78cb6cfebf545ef2c8d159cbdf3c
DIFF: https://github.com/llvm/llvm-project/commit/b6ccc88d575c78cb6cfebf545ef2c8d159cbdf3c.diff

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

Test cleanups.

(cherry picked from commit b305b8a256eade076bb13f52668a6015631ac0e5)

Added: 
    lld/test/ELF/gc-sections-linkorder-err.s
    lld/test/ELF/gc-sections-linkorder.s
    lld/test/ELF/gc-sections-linkorder2.s
    lld/test/ELF/linkerscript/discard-linkorder.s
    lld/test/ELF/linkerscript/linkorder.s
    lld/test/ELF/linkerscript/linkorder2.s
    lld/test/ELF/linkorder-err.s
    lld/test/ELF/linkorder-err2.s
    lld/test/ELF/linkorder-err3.s

Modified: 
    

Removed: 
    lld/test/ELF/gc-sections-metadata-err.s
    lld/test/ELF/gc-sections-metadata.s
    lld/test/ELF/gc-sections-metadata2.s
    lld/test/ELF/linkerscript/discard-section-metadata.s
    lld/test/ELF/linkerscript/section-metadata.s
    lld/test/ELF/linkerscript/section-metadata2.s
    lld/test/ELF/section-metadata-err.s
    lld/test/ELF/section-metadata-err2.s
    lld/test/ELF/section-metadata-err3.s


################################################################################
diff  --git a/lld/test/ELF/gc-sections-metadata-err.s b/lld/test/ELF/gc-sections-linkorder-err.s
similarity index 100%
rename from lld/test/ELF/gc-sections-metadata-err.s
rename to lld/test/ELF/gc-sections-linkorder-err.s

diff  --git a/lld/test/ELF/gc-sections-linkorder.s b/lld/test/ELF/gc-sections-linkorder.s
new file mode 100644
index 000000000000..54a29abde8e1
--- /dev/null
+++ b/lld/test/ELF/gc-sections-linkorder.s
@@ -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", at progbits,.foo1
+.quad .zed1
+.quad .foo1
+
+.section bar2,"ao", at progbits,.foo2
+.quad .zed2
+.quad .foo2
+
+.section .zed1,"a"
+.quad 0
+
+.section .zed2,"a"
+.quad 0

diff  --git a/lld/test/ELF/gc-sections-metadata2.s b/lld/test/ELF/gc-sections-linkorder2.s
similarity index 60%
rename from lld/test/ELF/gc-sections-metadata2.s
rename to lld/test/ELF/gc-sections-linkorder2.s
index 3a3b640b280a..b22bc589f56e 100644
--- a/lld/test/ELF/gc-sections-metadata2.s
+++ b/lld/test/ELF/gc-sections-linkorder2.s
@@ -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", at progbits,.foo

diff  --git a/lld/test/ELF/gc-sections-metadata.s b/lld/test/ELF/gc-sections-metadata.s
deleted file mode 100644
index 2e696f8752bd..000000000000
--- a/lld/test/ELF/gc-sections-metadata.s
+++ /dev/null
@@ -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", at progbits,.foo1
-.quad .zed1
-.quad .foo1
-
-.section bar2,"ao", at progbits,.foo2
-.quad .zed2
-.quad .foo2
-
-.section .zed1,"a"
-.quad 0
-
-.section .zed2,"a"
-.quad 0

diff  --git a/lld/test/ELF/linkerscript/discard-section-metadata.s b/lld/test/ELF/linkerscript/discard-linkorder.s
similarity index 100%
rename from lld/test/ELF/linkerscript/discard-section-metadata.s
rename to lld/test/ELF/linkerscript/discard-linkorder.s

diff  --git a/lld/test/ELF/linkerscript/section-metadata.s b/lld/test/ELF/linkerscript/linkorder.s
similarity index 100%
rename from lld/test/ELF/linkerscript/section-metadata.s
rename to lld/test/ELF/linkerscript/linkorder.s

diff  --git a/lld/test/ELF/linkerscript/section-metadata2.s b/lld/test/ELF/linkerscript/linkorder2.s
similarity index 100%
rename from lld/test/ELF/linkerscript/section-metadata2.s
rename to lld/test/ELF/linkerscript/linkorder2.s

diff  --git a/lld/test/ELF/linkorder-err.s b/lld/test/ELF/linkorder-err.s
new file mode 100644
index 000000000000..85409ecfc9ef
--- /dev/null
+++ b/lld/test/ELF/linkorder-err.s
@@ -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", at progbits,8
+.quad 0
+.section .foo,"ao", at progbits,.merge
+.quad 0

diff  --git a/lld/test/ELF/section-metadata-err2.s b/lld/test/ELF/linkorder-err2.s
similarity index 55%
rename from lld/test/ELF/section-metadata-err2.s
rename to lld/test/ELF/linkorder-err2.s
index 3191c1f4d3b6..ccacd00768b2 100644
--- a/lld/test/ELF/section-metadata-err2.s
+++ b/lld/test/ELF/linkorder-err2.s
@@ -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", at progbits,8
 .quad 0

diff  --git a/lld/test/ELF/section-metadata-err3.s b/lld/test/ELF/linkorder-err3.s
similarity index 85%
rename from lld/test/ELF/section-metadata-err3.s
rename to lld/test/ELF/linkorder-err3.s
index 5c4875b9da5e..2e36ab457677 100644
--- a/lld/test/ELF/section-metadata-err3.s
+++ b/lld/test/ELF/linkorder-err3.s
@@ -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", at progbits

diff  --git a/lld/test/ELF/section-metadata-err.s b/lld/test/ELF/section-metadata-err.s
deleted file mode 100644
index c9104303e434..000000000000
--- a/lld/test/ELF/section-metadata-err.s
+++ /dev/null
@@ -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", at progbits,8
-.quad 0
-
-.section .bar,"ao", at progbits,.foo


        


More information about the llvm-branch-commits mailing list