summaryrefslogtreecommitdiff
path: root/test/ELF/linkerscript/discard-print-gc.s
diff options
context:
space:
mode:
Diffstat (limited to 'test/ELF/linkerscript/discard-print-gc.s')
-rw-r--r--test/ELF/linkerscript/discard-print-gc.s19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ELF/linkerscript/discard-print-gc.s b/test/ELF/linkerscript/discard-print-gc.s
new file mode 100644
index 000000000000..2a230e53dc2b
--- /dev/null
+++ b/test/ELF/linkerscript/discard-print-gc.s
@@ -0,0 +1,19 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple x86_64-pc-linux %s -o %t.o -filetype=obj
+# RUN: ld.lld -o %t.so --gc-sections %t.o --print-gc-sections -shared 2>&1 | \
+# RUN: FileCheck -check-prefix=CHECK %s
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.foo) } }" > %t.script
+# RUN: ld.lld -o %t.so -T %t.script %t.o --print-gc-sections -shared 2>&1 | \
+# RUN: FileCheck -check-prefix=QUIET --allow-empty %s
+
+# RUN: echo "SECTIONS { .foo : { *(.foo) } }" > %t2.script
+# RUN: ld.lld -o %t.so -T %t2.script --gc-sections %t.o --print-gc-sections -shared 2>&1 | \
+# RUN: FileCheck -check-prefix=CHECK %s
+
+.section .foo,"a"
+.quad 0
+
+# CHECK: removing unused section from '.foo'
+# QUIET-NOT: removing unused section from '.foo'