brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · 1b13f09 Raw
98 lines · plain
1// This test checks the behavior of llvm-objdump's --disassemble-symbols and2// --show-all-symbols options, in the presence of multiple symbols defined at3// the same address in an object file.4 5// The test input file contains an Arm and a Thumb function, each with two6// 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 $t8// mapping symbol at the point where Arm code stops and Thumb code begins.9 10// By default, llvm-objdump will pick one of the symbols to disassemble at each11// point where any are defined at all. The tie-break sorting criterion is12// alphabetic, so it will be the alphabetically later symbol in each case: of13// the names aaaa and bbbb for the Arm function it picks bbbb, and of cccc and14// dddd for the Thumb function it picks dddd.15 16// Including an Arm and a Thumb function also re-checks that these changes to17// the display of symbols doesn't affect the recognition of mapping symbols for18// the purpose of switching disassembly mode.19 20@ REQUIRES: arm-registered-target21 22@ RUN: llvm-mc -triple armv8a-unknown-linux -filetype=obj %s -o %t.o23 24// All the run lines below should generate some subset of this25// display, with different parts included:26 27@ HEAD:          Disassembly of section .text:28@ HEAD-EMPTY:29@ AMAP-NEXT:     00000000 <$a>:30@ AAAA-NEXT:     00000000 <aaaa>:31@ BBBB-NEXT:     00000000 <bbbb>:32@ AABB-NEXT:            0: e0800080      add     r0, r0, r0, lsl #133@ AABB-NEXT:            4: e12fff1e      bx      lr34@ BOTH-EMPTY:    35@ TMAP-NEXT:     00000008 <$t>:36@ CCCC-NEXT:     00000008 <cccc>:37@ DDDD-NEXT:     00000008 <dddd>:38@ CCDD-NEXT:            8: eb00 0080     add.w   r0, r0, r0, lsl #239@ CCDD-NEXT:            c: 4770          bx      lr40 41// The default disassembly chooses just the alphabetically later symbol of each42// set, namely bbbb and dddd.43 44@ RUN: llvm-objdump --triple armv8a -d %t.o | FileCheck --check-prefixes=HEAD,BBBB,AABB,BOTH,DDDD,CCDD %s45 46// With the --show-all-symbols option, all the symbols are shown, including the47// administrative mapping symbols.48 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 %s50 51// If we use --disassemble-symbols to ask for the disassembly of aaaa or bbbb52// or both, then we expect the second cccc/dddd function not to appear in the53// output at all. Also, we want to see whichever symbol we asked about, or both54// if we asked about both.55 56@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa -d %t.o | FileCheck --check-prefixes=HEAD,AAAA,AABB %s57@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=bbbb -d %t.o | FileCheck --check-prefixes=HEAD,BBBB,AABB %s58@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa,bbbb -d %t.o | FileCheck --check-prefixes=HEAD,AAAA,BBBB,AABB %s59 60// With _any_ of those three options and also --show-all-symbols, the61// 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 asked63// about them or not.64 65@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s66@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=bbbb --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s67@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=aaaa,bbbb --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,AMAP,AAAA,BBBB,AABB %s68 69// Similarly for the Thumb function and its symbols. This time we must check70// that the aaaa/bbbb block of code was not disassembled _before_ the output71// we're expecting.72 73@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc -d %t.o | FileCheck --check-prefixes=HEAD,CCCC,CCDD %s74@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=dddd -d %t.o | FileCheck --check-prefixes=HEAD,DDDD,CCDD %s75@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc,dddd -d %t.o | FileCheck --check-prefixes=HEAD,CCCC,DDDD,CCDD %s76 77@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s78@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=dddd --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s79@ RUN: llvm-objdump --triple armv8a --disassemble-symbols=cccc,dddd --show-all-symbols -d %t.o | FileCheck --check-prefixes=HEAD,TMAP,CCCC,DDDD,CCDD %s80 81.text82.globl aaaa83.globl bbbb84.globl cccc85.globl dddd86 87.arm88aaaa:89bbbb:90        add     r0, r0, r0, lsl #191        bx      lr92 93.thumb94cccc:95dddd:96        add.w   r0, r0, r0, lsl #297        bx      lr98