1# RUN: yaml2obj --docnum=1 -DCONTENT=FA000002E59F100CE0800001E12FFF1E4802EB00308047703141592627182818 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s 2# RUN: yaml2obj --docnum=1 -DCONTENT=020000FA0C109FE5010080E01EFF2FE1024800EB803070473141592627182818 -DFLAG=,EF_ARM_BE8 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s 3# RUN: yaml2obj --docnum=2 -DCONTENT=FA000002E59F100CE0800001E12FFF1E4802EB00308047703141592627182818 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s 4 5## Test llvm-objdump disassembly of all three kinds of 6## AAELF32-compliant big-endian ELF file. 7## 8## In image files, by default AArch32 ELF stores the instructions 9## big-endian ('BE32' style), unless the EF_ARM_BE8 flag is set in the 10## ELF header, which indicates that instructions are stored 11## little-endian ('BE8' style). llvm-objdump should detect the flag and 12## handle both types, using the $a, $t and $d mapping symbols to 13## distinguish Arm instructions, Thumb instructions, and data. 14## 15## Relocatable object files always use the BE32 style. (The linker is 16## expected to byte-swap code sections, using the same the mapping 17## symbols to decide how, if it's going to generate an image with BE8 18## instruction endianness and the BE8 flag set.) 19## 20## This test checks all three cases of this. It provides llvm-objdump 21## with the BE32 and BE8 versions of the same image file, with the code 22## section byte-swapped, and the EF_ARM_BE8 flag absent and present 23## respectively to indicate that. We also provide a matching object 24## file. We expect the identical disassembly from both, apart from the 25## detail that addresses in the ELF images start at 0x8000 and section 26## offsets in the object start at 0. 27 28# CHECK: 0: fa000002 blx 29# CHECK-NEXT: 4: e59f100c ldr r1, [pc, #12] 30# CHECK-NEXT: 8: e0800001 add r0, r0, r1 31# CHECK-NEXT: c: e12fff1e bx lr 32# CHECK: 10: 4802 ldr r0, [pc, #8] 33# CHECK-NEXT: 12: eb00 3080 add.w r0, r0, r0, lsl #14 34# CHECK-NEXT: 16: 4770 bx lr 35# CHECK: 18: 31 41 59 26 .word 0x31415926 36# CHECK-NEXT: 1c: 27 18 28 18 .word 0x27182818 37 38--- !ELF 39FileHeader: 40 Class: ELFCLASS32 41 Data: ELFDATA2MSB 42 Type: ET_EXEC 43 Machine: EM_ARM 44 Flags: [ EF_ARM_EABI_UNKNOWN[[FLAG=]] ] 45 Entry: 0x8000 46ProgramHeaders: 47 - Type: PT_LOAD 48 Flags: [ PF_X, PF_R ] 49 FirstSec: .text 50 LastSec: .text 51 VAddr: 0x8000 52 Align: 0x4 53Sections: 54 - Name: .text 55 Type: SHT_PROGBITS 56 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 57 Address: 0x8000 58 AddressAlign: 0x4 59 Content: [[CONTENT]] 60Symbols: 61 - Name: '$a' 62 Section: .text 63 Value: 0x8000 64 - Name: '$t' 65 Section: .text 66 Value: 0x8010 67 - Name: '$d' 68 Section: .text 69 Value: 0x8018 70 71--- !ELF 72FileHeader: 73 Class: ELFCLASS32 74 Data: ELFDATA2MSB 75 Type: ET_REL 76 Machine: EM_ARM 77Sections: 78 - Name: .text 79 Type: SHT_PROGBITS 80 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 81 AddressAlign: 0x4 82 Content: [[CONTENT]] 83Symbols: 84 - Name: '$a' 85 Section: .text 86 - Name: '$t' 87 Section: .text 88 Value: 0x10 89 - Name: '$d' 90 Section: .text 91 Value: 0x18 92