xref: /llvm-project/llvm/test/tools/llvm-objdump/multiple-symbols-mangling.s (revision 8e29f3f1c35a88f00a0290b0280468d04932eeb5)
1// This test demonstrates that the alphabetical-order tie breaking between
2// multiple symbols defined at the same address is based on the raw symbol
3// name, not its demangled version.
4
5@ REQUIRES: arm-registered-target
6
7@ RUN: llvm-mc -triple armv8a-unknown-linux -filetype=obj %s -o %t.o
8
9// All the run lines below should generate some subset of this
10// display, with different parts included:
11
12@ COMMON:        Disassembly of section .text:
13@
14@ RAW-B:         00000000 <_Z4bbbbv>:
15@ NICE-B:        00000000 <bbbb()>:
16@ NO-B-NOT:                bbbb
17@ A:             00000000 <aaaa>:
18@ COMMON:               0: e0800080      add     r0, r0, r0, lsl #1
19@ COMMON:               4: e12fff1e      bx      lr
20
21// The default disassembly chooses just the alphabetically later symbol, which
22// is aaaa, because the leading _ on a mangled name sorts before lowercase
23// ASCII.
24
25@ RUN: llvm-objdump --triple armv8a -d %t.o | FileCheck --check-prefixes=COMMON,NO-B,A %s
26
27// With the --show-all-symbols option, bbbb is also shown, in its raw form.
28
29@ RUN: llvm-objdump --triple armv8a --show-all-symbols -d %t.o | FileCheck --check-prefixes=COMMON,RAW-B,A %s
30
31// With --demangle as well, bbbb is demangled, but that doesn't change its
32// place in the sorting order.
33
34@ RUN: llvm-objdump --triple armv8a --show-all-symbols --demangle -d %t.o | FileCheck --check-prefixes=COMMON,NICE-B,A %s
35
36.text
37.globl aaaa
38.globl _Z4bbbv
39aaaa:
40_Z4bbbbv:
41        add r0, r0, r0, lsl #1
42        bx lr
43