[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
[llvm-project.git] / llvm / test / tools / llvm-objdump / multiple-symbols.s
blob24c169e32147b4d64f8ddd22a3f9501c60ae8b1d
1 // This test checks the behavior of llvm-objdump's --disassemble-symbols and
2 // --show-all-symbols options, in the presence of multiple symbols defined at
3 // the same address in an object file.
5 // The test input file contains an Arm and a Thumb function, each with two
6 // function-type symbols defined at its entry point. Also, because it's Arm,
7 // there's a $a mapping symbol defined at the start of the section, and a $t
8 // mapping symbol at the point where Arm code stops and Thumb code begins.
10 // By default, llvm-objdump will pick one of the symbols to disassemble at each
11 // point where any are defined at all. The tie-break sorting criterion is
12 // alphabetic, so it will be the alphabetically later symbol in each case: of
13 // the names aaaa and bbbb for the Arm function it picks bbbb, and of cccc and
14 // dddd for the Thumb function it picks dddd.
16 // Including an Arm and a Thumb function also re-checks that these changes to
17 // the display of symbols doesn't affect the recognition of mapping symbols for
18 // the purpose of switching disassembly mode.
20 @ REQUIRES: arm-registered-target
22 @ RUN: llvm-mc -triple armv8a-unknown-linux -filetype=obj %s -o %t.o
24 // All the run lines below should generate some subset of this
25 // display, with different parts included:
27 @ HEAD: Disassembly of section .text:
28 @ HEAD-EMPTY:
29 @ AMAP-NEXT: 00000000 <$a.0>:
30 @ AAAA-NEXT: 00000000 <aaaa>:
31 @ BBBB-NEXT: 00000000 <bbbb>:
32 @ AABB-NEXT: 0: e0800080 add r0, r0, r0, lsl #1
33 @ AABB-NEXT: 4: e12fff1e bx lr
34 @ BOTH-EMPTY:
35 @ TMAP-NEXT: 00000008 <$t.1>:
36 @ CCCC-NEXT: 00000008 <cccc>:
37 @ DDDD-NEXT: 00000008 <dddd>:
38 @ CCDD-NEXT: 8: eb00 0080 add.w r0, r0, r0, lsl #2
39 @ CCDD-NEXT: c: 4770 bx lr
41 // The default disassembly chooses just the alphabetically later symbol of each
42 // set, namely bbbb and dddd.
44 @ RUN: llvm-objdump --triple armv8a -d %t.o | FileCheck --check-prefixes=HEAD,BBBB,AABB,BOTH,DDDD,CCDD %s
46 // With the --show-all-symbols option, all the symbols are shown, including the
47 // administrative mapping symbols.
49 @ RUN: llvm-objdump --triple armv8a --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB,BOTH,TMAP,CCCC,DDDD,CCDD %s
51 // If we use --disassemble-symbols to ask for the disassembly of aaaa or bbbb
52 // or both, then we expect the second cccc/dddd function not to appear in the
53 // output at all. Also, we want to see whichever symbol we asked about, or both
54 // if we asked about both.
56 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa -d %t.o | FileCheck --check-prefixes=HEAD,AAAA,AABB %s
57 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=bbbb -d %t.o | FileCheck --check-prefixes=HEAD,BBBB,AABB %s
58 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa,bbbb -d %t.o | FileCheck --check-prefixes=HEAD,AAAA,BBBB,AABB %s
60 // With _any_ of those three options and also --show-all-symbols, the
61 // disassembled code is still limited to just the symbol(s) you asked about,
62 // but all symbols defined at the same address are mentioned, whether you asked
63 // about them or not.
65 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s
66 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=bbbb --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s
67 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa,bbbb --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s
69 // Similarly for the Thumb function and its symbols. This time we must check
70 // that the aaaa/bbbb block of code was not disassembled _before_ the output
71 // we're expecting.
73 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc -d %t.o | FileCheck --check-prefixes=HEAD,CCCC,CCDD %s
74 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=dddd -d %t.o | FileCheck --check-prefixes=HEAD,DDDD,CCDD %s
75 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc,dddd -d %t.o | FileCheck --check-prefixes=HEAD,CCCC,DDDD,CCDD %s
77 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s
78 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=dddd --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s
79 @ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc,dddd --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s
81 .text
82 .globl aaaa
83 .globl bbbb
84 .globl cccc
85 .globl dddd
87 .arm
88 aaaa:
89 bbbb:
90 add r0, r0, r0, lsl #1
91 bx lr
93 .thumb
94 cccc:
95 dddd:
96 add.w r0, r0, r0, lsl #2
97 bx lr