summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-07-18 08:34:35 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-07-18 08:34:35 +0000
commite35e6448f99d69c40f7073794abbd75b9a0a75c0 (patch)
treeb5e7af5240f39dc506abaddd69224b296994f645 /llvm/test
parent6fdac3b23ad9229c953a0cede9c01af6c5605792 (diff)
downloadbcm5719-llvm-e35e6448f99d69c40f7073794abbd75b9a0a75c0.tar.gz
bcm5719-llvm-e35e6448f99d69c40f7073794abbd75b9a0a75c0.zip
[llvm-objdump] - Stop reporting bogus section IDs.
Imagine we have a file with few sections, and one of them is .foo with index N != 0. Problem is that when llvm-objdump is given a -section=.foo parameter it lists .foo as a section at index 0. That makes impossible to write test cases which needs to find the index of the particular section, while ignoring dumping of others. The patch fixes that. Differential revision: https://reviews.llvm.org/D49372 llvm-svn: 337361
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-objdump/X86/section-index.s25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/section-index.s b/llvm/test/tools/llvm-objdump/X86/section-index.s
new file mode 100644
index 00000000000..6ca86ea19b5
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/section-index.s
@@ -0,0 +1,25 @@
+# RUN: llvm-mc %s -filetype=obj -triple=x86_64-pc-linux -o %t
+
+# RUN: llvm-objdump -section-headers %t | FileCheck %s
+# CHECK: Idx Name
+# CHECK: 3 .foo
+# CHECK-NEXT: 4 .bar
+# CHECK-NEXT: 5 .zed
+
+## Check we report the valid section index
+## when requesting a specific section.
+# RUN: llvm-objdump -section-headers -section=.bar %t \
+# RUN: | FileCheck %s --check-prefix=BAR
+# BAR: Idx Name
+# BAR-NEXT: 4 .bar
+# BAR-NOT: foo
+# BAR-NOT: zed
+
+.section .foo, "ax", %progbits
+nop
+
+.section .bar, "ax", %progbits
+nop
+
+.section .zed, "ax", %progbits
+nop
OpenPOWER on IntegriCloud