brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.6 KiB · 015616e Raw
132 lines · plain
1## In this test we test how llvm-readelf prints file headers.2 3## Case 1: Test EM_386 object.4# RUN: yaml2obj %s --docnum=1 -o %t15# RUN: llvm-readelf -h %t1 | FileCheck %s --check-prefix=I3866# RUN: llvm-readelf --file-header %t1 \7# RUN:   | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=I3868# RUN: llvm-readelf --file-headers %t1  \9# RUN:   | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=I38610 11#      I386:ELF Header:12# I386-NEXT:  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 0013# I386-NEXT:  Class:                             ELF3214# I386-NEXT:  Data:                              2's complement, little endian15# I386-NEXT:  Version:                           1 (current)16# I386-NEXT:  OS/ABI:                            UNIX - System V17# I386-NEXT:  ABI Version:                       018# I386-NEXT:  Type:                              REL (Relocatable file)19# I386-NEXT:  Machine:                           Intel 8038620# I386-NEXT:  Version:                           0x121# I386-NEXT:  Entry point address:               0x1122334422# I386-NEXT:  Start of program headers:          52 (bytes into file)23# I386-NEXT:  Start of section headers:          112 (bytes into file)24# I386-NEXT:  Flags:                             0x025# I386-NEXT:  Size of this header:               52 (bytes)26# I386-NEXT:  Size of program headers:           32 (bytes)27# I386-NEXT:  Number of program headers:         128# I386-NEXT:  Size of section headers:           40 (bytes)29# I386-NEXT:  Number of section headers:         430# I386-NEXT:  Section header string table index: 331 32--- !ELF33FileHeader:34  Class:   ELFCLASS3235  Data:    ELFDATA2LSB36  Type:    ET_REL37  Machine: EM_38638  Entry:   0x1122334439Sections:40  - Name: .foo41    Type: SHT_PROGBITS42ProgramHeaders:43  - Type: PT_LOAD44    Flags: [ PF_R ]45 46## Case 2: Test EM_X86_64 object.47# RUN: yaml2obj %s --docnum=2 -o %t248# RUN: llvm-readelf -h %t2 | FileCheck %s --check-prefix=X86-6449# RUN: llvm-readelf --file-header %t2 \50# RUN:   | FileCheck %s --check-prefix=X86-64 --strict-whitespace --match-full-lines51# RUN: llvm-readelf --file-headers %t2 \52# RUN:   | FileCheck %s --check-prefix=X86-64 --strict-whitespace --match-full-lines53 54#      X86-64:ELF Header:55# X86-64-NEXT:  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 0056# X86-64-NEXT:  Class:                             ELF6457# X86-64-NEXT:  Data:                              2's complement, little endian58# X86-64-NEXT:  Version:                           1 (current)59# X86-64-NEXT:  OS/ABI:                            UNIX - System V60# X86-64-NEXT:  ABI Version:                       061# X86-64-NEXT:  Type:                              REL (Relocatable file)62# X86-64-NEXT:  Machine:                           Advanced Micro Devices X86-6463# X86-64-NEXT:  Version:                           0x164# X86-64-NEXT:  Entry point address:               0x112233445566778865# X86-64-NEXT:  Start of program headers:          64 (bytes into file)66# X86-64-NEXT:  Start of section headers:          152 (bytes into file)67# X86-64-NEXT:  Flags:                             0x068# X86-64-NEXT:  Size of this header:               64 (bytes)69# X86-64-NEXT:  Size of program headers:           56 (bytes)70# X86-64-NEXT:  Number of program headers:         171# X86-64-NEXT:  Size of section headers:           64 (bytes)72# X86-64-NEXT:  Number of section headers:         473# X86-64-NEXT:  Section header string table index: 374 75--- !ELF76FileHeader:77  Class:   ELFCLASS6478  Data:    ELFDATA2LSB79  Type:    ET_REL80  Machine: EM_X86_6481  Entry:   0x112233445566778882Sections:83  - Name: .foo84    Type: SHT_PROGBITS85ProgramHeaders:86  - Type: PT_LOAD87    Flags: [ PF_R ]88 89## Case 3: Use an arbitrary machine type that allows to show how we print Flags.90##         Here we use an EM_MIPS object for that.91# RUN: yaml2obj %s --docnum=3 -o %t392# RUN: llvm-readelf -h %t3 | FileCheck %s --check-prefix=MIPSEL93# RUN: llvm-readelf --file-header %t3 \94# RUN:   | FileCheck %s --check-prefix=MIPSEL --strict-whitespace --match-full-lines95# RUN: llvm-readelf --file-headers %t3 \96# RUN:   | FileCheck %s --check-prefix=MIPSEL --strict-whitespace --match-full-lines97 98#      MIPSEL:ELF Header:99# MIPSEL-NEXT:  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00100# MIPSEL-NEXT:  Class:                             ELF32101# MIPSEL-NEXT:  Data:                              2's complement, little endian102# MIPSEL-NEXT:  Version:                           1 (current)103# MIPSEL-NEXT:  OS/ABI:                            UNIX - System V104# MIPSEL-NEXT:  ABI Version:                       0105# MIPSEL-NEXT:  Type:                              REL (Relocatable file)106# MIPSEL-NEXT:  Machine:                           MIPS R3000107# MIPSEL-NEXT:  Version:                           0x1108# MIPSEL-NEXT:  Entry point address:               0x0109# MIPSEL-NEXT:  Start of program headers:          52 (bytes into file)110# MIPSEL-NEXT:  Start of section headers:          112 (bytes into file)111# MIPSEL-NEXT:  Flags:                             0x50001000, o32, mips32112# MIPSEL-NEXT:  Size of this header:               52 (bytes)113# MIPSEL-NEXT:  Size of program headers:           32 (bytes)114# MIPSEL-NEXT:  Number of program headers:         1115# MIPSEL-NEXT:  Size of section headers:           40 (bytes)116# MIPSEL-NEXT:  Number of section headers:         4117# MIPSEL-NEXT:  Section header string table index: 3118 119--- !ELF120FileHeader:121  Class:   ELFCLASS32122  Data:    ELFDATA2LSB123  Type:    ET_REL124  Machine: EM_MIPS125  Flags:   [ EF_MIPS_ARCH_32, EF_MIPS_ABI_O32 ]126Sections:127  - Name: .foo128    Type: SHT_PROGBITS129ProgramHeaders:130  - Type: PT_LOAD131    Flags: [ PF_R ]132