brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · ad7c1f3 Raw
92 lines · plain
1# RUN: yaml2obj --docnum=1 -DCONTENT=FA000002E59F100CE0800001E12FFF1E4802EB00308047703141592627182818 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s2# RUN: yaml2obj --docnum=1 -DCONTENT=020000FA0C109FE5010080E01EFF2FE1024800EB803070473141592627182818 -DFLAG=,EF_ARM_BE8 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s3# RUN: yaml2obj --docnum=2 -DCONTENT=FA000002E59F100CE0800001E12FFF1E4802EB00308047703141592627182818 %s | llvm-objdump --no-print-imm-hex -d --triple=armv7r - | FileCheck %s4 5## Test llvm-objdump disassembly of all three kinds of6## AAELF32-compliant big-endian ELF file.7##8## In image files, by default AArch32 ELF stores the instructions9## big-endian ('BE32' style), unless the EF_ARM_BE8 flag is set in the10## ELF header, which indicates that instructions are stored11## little-endian ('BE8' style). llvm-objdump should detect the flag and12## handle both types, using the $a, $t and $d mapping symbols to13## distinguish Arm instructions, Thumb instructions, and data.14##15## Relocatable object files always use the BE32 style. (The linker is16## expected to byte-swap code sections, using the same the mapping17## symbols to decide how, if it's going to generate an image with BE818## instruction endianness and the BE8 flag set.)19##20## This test checks all three cases of this. It provides llvm-objdump21## with the BE32 and BE8 versions of the same image file, with the code22## section byte-swapped, and the EF_ARM_BE8 flag absent and present23## respectively to indicate that. We also provide a matching object24## file. We expect the identical disassembly from both, apart from the25## detail that addresses in the ELF images start at 0x8000 and section26## offsets in the object start at 0.27 28# CHECK:             0: fa000002      blx29# CHECK-NEXT:        4: e59f100c      ldr     r1, [pc, #12]30# CHECK-NEXT:        8: e0800001      add     r0, r0, r131# CHECK-NEXT:        c: e12fff1e      bx      lr32# CHECK:            10: 4802          ldr     r0, [pc, #8]33# CHECK-NEXT:       12: eb00 3080     add.w   r0, r0, r0, lsl #1434# CHECK-NEXT:       16: 4770          bx      lr35# CHECK:            18: 31 41 59 26   .word   0x3141592636# CHECK-NEXT:       1c: 27 18 28 18   .word   0x2718281837 38--- !ELF39FileHeader:40  Class:           ELFCLASS3241  Data:            ELFDATA2MSB42  Type:            ET_EXEC43  Machine:         EM_ARM44  Flags:           [ EF_ARM_EABI_UNKNOWN[[FLAG=]] ]45  Entry:           0x800046ProgramHeaders:47  - Type:            PT_LOAD48    Flags:           [ PF_X, PF_R ]49    FirstSec:        .text50    LastSec:         .text51    VAddr:           0x800052    Align:           0x453Sections:54  - Name:            .text55    Type:            SHT_PROGBITS56    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]57    Address:         0x800058    AddressAlign:    0x459    Content:         [[CONTENT]]60Symbols:61  - Name:            '$a'62    Section:         .text63    Value:           0x800064  - Name:            '$t'65    Section:         .text66    Value:           0x801067  - Name:            '$d'68    Section:         .text69    Value:           0x801870 71--- !ELF72FileHeader:73  Class:           ELFCLASS3274  Data:            ELFDATA2MSB75  Type:            ET_REL76  Machine:         EM_ARM77Sections:78  - Name:            .text79    Type:            SHT_PROGBITS80    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]81    AddressAlign:    0x482    Content:         [[CONTENT]]83Symbols:84  - Name:            '$a'85    Section:         .text86  - Name:            '$t'87    Section:         .text88    Value:           0x1089  - Name:            '$d'90    Section:         .text91    Value:           0x1892